Skip to content

Commit a963c16

Browse files
committed
Formatting
1 parent bdc3c69 commit a963c16

File tree

3 files changed

+87
-90
lines changed

3 files changed

+87
-90
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ErrnoModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public void initialize(PythonCore core) {
192192
builtinConstants.put("ENOTRECOVERABLE", 131);
193193
builtinConstants.put("ERFKILL", 132);
194194
builtinConstants.put("EHWPOISON", 133);
195-
195+
196196
// added manually
197197
builtinConstants.put("EAGAIN", 11);
198198
builtinConstants.put("EWOULDBLOCK", 11);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ZLibModuleBuiltins.java

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ public class ZLibModuleBuiltins extends PythonBuiltins {
101101
protected static final byte Z_FINISH = 4;
102102
protected static final byte Z_BLOCK = 5;
103103
protected static final byte Z_TREES = 6;
104-
104+
105105
// errors
106106
protected static final byte Z_BUF_ERROR = -5;
107-
107+
108108
protected static final String MODULE_NAME = "zlib";
109109

110110
@Override
@@ -119,95 +119,93 @@ public void initialize(PythonCore core) {
119119
builtinConstants.put("DEFLATED", DEFLATED);
120120
builtinConstants.put("DEF_MEM_LEVEL", DEF_MEM_LEVEL);
121121
builtinConstants.put("DEF_BUF_SIZE", DEF_BUF_SIZE);
122-
122+
123123
builtinConstants.put("Z_NO_COMPRESSION", Z_NO_COMPRESSION);
124124
builtinConstants.put("Z_BEST_SPEED", Z_BEST_SPEED);
125125
builtinConstants.put("Z_BEST_COMPRESSION", Z_BEST_COMPRESSION);
126126
builtinConstants.put("Z_DEFAULT_COMPRESSION", Z_DEFAULT_COMPRESSION);
127-
127+
128128
builtinConstants.put("Z_FILTERED", Z_FILTERED);
129129
builtinConstants.put("Z_HUFFMAN_ONLY", Z_HUFFMAN_ONLY);
130130
builtinConstants.put("Z_RLE", Z_RLE);
131131
builtinConstants.put("Z_FIXED", Z_FIXED);
132132
builtinConstants.put("Z_DEFAULT_STRATEGY", Z_DEFAULT_STRATEGY);
133-
133+
134134
builtinConstants.put("Z_NO_FLUSH", Z_NO_FLUSH);
135135
builtinConstants.put("Z_PARTIAL_FLUSH", Z_PARTIAL_FLUSH);
136136
builtinConstants.put("Z_SYNC_FLUSH", Z_SYNC_FLUSH);
137137
builtinConstants.put("Z_FULL_FLUSH", Z_FULL_FLUSH);
138138
builtinConstants.put("Z_FINISH", Z_FINISH);
139139
builtinConstants.put("Z_BLOCK", Z_BLOCK);
140140
builtinConstants.put("Z_TREES", Z_TREES);
141-
141+
142142
}
143-
143+
144144
// zlib.crc32(data[, value])
145145
@Builtin(name = "crc32", minNumOfPositionalArgs = 1, maxNumOfPositionalArgs = 2)
146146
@TypeSystemReference(PythonArithmeticTypes.class)
147147
@GenerateNodeFactory
148148
public abstract static class Crc32Node extends PythonBinaryBuiltinNode {
149149

150-
@Child
151-
private SequenceStorageNodes.ToByteArrayNode toArrayNode;
152-
@Child
153-
private CastToIntegerFromIntNode castToIntNode;
150+
@Child private SequenceStorageNodes.ToByteArrayNode toArrayNode;
151+
@Child private CastToIntegerFromIntNode castToIntNode;
154152

155153
public abstract long execute(PIBytesLike data, Object value);
156154

157155
// we can't use jdk Crc32 class, if there is done init value of crc
158156
private final static int[] CRC32_TABLE = {
159-
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
160-
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
161-
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
162-
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
163-
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
164-
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
165-
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
166-
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
167-
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
168-
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
169-
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
170-
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
171-
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
172-
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
173-
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
174-
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
175-
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
176-
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
177-
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
178-
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
179-
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
180-
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
181-
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
182-
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
183-
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
184-
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
185-
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
186-
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
187-
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
188-
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
189-
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
190-
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
191-
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
192-
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
193-
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
194-
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
195-
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
196-
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
197-
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
198-
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
199-
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
200-
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
201-
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
202-
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
203-
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
204-
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
205-
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
206-
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
207-
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
208-
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
209-
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
210-
0x2d02ef8d
157+
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
158+
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
159+
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
160+
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
161+
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
162+
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
163+
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
164+
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
165+
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
166+
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
167+
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
168+
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
169+
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
170+
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
171+
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
172+
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
173+
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
174+
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
175+
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
176+
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
177+
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
178+
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
179+
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
180+
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
181+
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
182+
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
183+
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
184+
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
185+
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
186+
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
187+
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
188+
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
189+
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
190+
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
191+
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
192+
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
193+
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
194+
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
195+
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
196+
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
197+
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
198+
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
199+
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
200+
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
201+
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
202+
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
203+
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
204+
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
205+
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
206+
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
207+
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
208+
0x2d02ef8d
211209
};
212210

213211
private static int computeCRC32(byte[] bytes, int value) {
@@ -256,15 +254,15 @@ public long doit(PIBytesLike data, long value) {
256254

257255
@Specialization
258256
public long doPInt(PIBytesLike data, PInt value) {
259-
// lost magnitude is ok here.
257+
// lost magnitude is ok here.
260258
int initValue = value.intValue();
261259
byte[] array = getToArrayNode().execute(data.getSequenceStorage());
262260
return ((long) computeCRC32(array, initValue) & 0xFFFFFFFFL);
263261
}
264262

265263
@Specialization
266264
public long doObject(PIBytesLike data, Object value,
267-
@Cached("create()") Crc32Node recursiveNode) {
265+
@Cached("create()") Crc32Node recursiveNode) {
268266
return recursiveNode.execute(data, getCastToIntNode().execute(value));
269267
}
270268

@@ -347,15 +345,15 @@ public long doit(PIBytesLike data, long value) {
347345

348346
@Specialization
349347
public long doPInt(PIBytesLike data, PInt value) {
350-
// lost magnitude is ok here.
348+
// lost magnitude is ok here.
351349
int initValue = value.intValue();
352350
byte[] array = getToArrayNode().execute(data.getSequenceStorage());
353351
return ((long) computeAdler32(array, initValue) & 0xFFFFFFFFL);
354352
}
355353

356354
@Specialization
357355
public long doObject(PIBytesLike data, Object value,
358-
@Cached("create()") Adler32Node recursiveNode) {
356+
@Cached("create()") Adler32Node recursiveNode) {
359357
return recursiveNode.execute(data, getCastToIntNode().execute(value));
360358
}
361359

@@ -375,8 +373,7 @@ protected static Adler32Node create() {
375373
@GenerateNodeFactory
376374
public abstract static class CompressNode extends PythonBinaryBuiltinNode {
377375

378-
@Child
379-
private SequenceStorageNodes.ToByteArrayNode toArrayNode;
376+
@Child private SequenceStorageNodes.ToByteArrayNode toArrayNode;
380377

381378
private SequenceStorageNodes.ToByteArrayNode getToArrayNode() {
382379
if (toArrayNode == null) {
@@ -409,7 +406,7 @@ public PBytes doit(PIBytesLike data, PNone level) {
409406

410407
@Specialization
411408
public PBytes doit(PIBytesLike data, long level,
412-
@Cached("createBinaryProfile()") ConditionProfile wrongLevelProfile) {
409+
@Cached("createBinaryProfile()") ConditionProfile wrongLevelProfile) {
413410
if (wrongLevelProfile.profile(level < -1 || 9 < level)) {
414411
throw raise(ZLibError, "Bad compression level");
415412
}
@@ -424,12 +421,12 @@ public PBytes doit(PIBytesLike data, long level,
424421
@TypeSystemReference(PythonArithmeticTypes.class)
425422
@GenerateNodeFactory
426423
public abstract static class DecompressNode extends PythonTernaryBuiltinNode {
427-
424+
428425
@Child private CastToIntegerFromIntNode castToIntNode;
429426
@Child private SequenceStorageNodes.ToByteArrayNode toArrayNode;
430427

431428
private final ConditionProfile bufSizeProfile = ConditionProfile.createBinaryProfile();
432-
429+
433430
private SequenceStorageNodes.ToByteArrayNode getToArrayNode() {
434431
if (toArrayNode == null) {
435432
CompilerDirectives.transferToInterpreterAndInvalidate();
@@ -447,11 +444,11 @@ private CastToIntegerFromIntNode getCastToIntNode() {
447444
}
448445
return castToIntNode;
449446
}
450-
447+
451448
@TruffleBoundary
452449
private byte[] decompress(byte[] input, @SuppressWarnings("unused") int wbits, int bufsize) {
453450
// decompress
454-
// We don't use wbits currently. There is no easy way how to map to java Inflater.
451+
// We don't use wbits currently. There is no easy way how to map to java Inflater.
455452
Inflater decompresser = new Inflater();
456453
decompresser.setInput(input);
457454
byte[] resultArray = new byte[bufsize];
@@ -470,19 +467,19 @@ private byte[] decompress(byte[] input, @SuppressWarnings("unused") int wbits, i
470467
decompresser.end();
471468
return baos.toByteArray();
472469
}
473-
470+
474471
@Specialization
475472
@TruffleBoundary
476473
public PBytes doit(PIBytesLike data, PNone wbits, PNone bufsize) {
477474
byte[] array = getToArrayNode().execute(data.getSequenceStorage());
478475
return factory().createBytes(decompress(array, MAX_WBITS, DEF_BUF_SIZE));
479476
}
480-
477+
481478
@Specialization
482479
public PBytes decompress(PIBytesLike data, byte wbits, int bufsize) {
483-
return decompress(data, (long)wbits, bufsize);
480+
return decompress(data, (long) wbits, bufsize);
484481
}
485-
482+
486483
@Specialization
487484
public PBytes decompress(PIBytesLike data, long wbits, int bufsize) {
488485
// checking bufsize
@@ -492,16 +489,16 @@ public PBytes decompress(PIBytesLike data, long wbits, int bufsize) {
492489
bufsize = 1;
493490
}
494491
byte[] array = getToArrayNode().execute(data.getSequenceStorage());
495-
return factory().createBytes(decompress(array, (int)wbits, bufsize));
492+
return factory().createBytes(decompress(array, (int) wbits, bufsize));
496493
}
497-
494+
498495
@Specialization
499496
public PBytes decompress(PIBytesLike data, long wbits, Object bufsize,
500-
@Cached("create()") DecompressNode recursiveNode) {
497+
@Cached("create()") DecompressNode recursiveNode) {
501498
Object bufferLen = getCastToIntNode().execute(bufsize);
502-
return (PBytes)recursiveNode.execute(data, wbits, bufferLen);
499+
return (PBytes) recursiveNode.execute(data, wbits, bufferLen);
503500
}
504-
501+
505502
protected static DecompressNode create() {
506503
return ZLibModuleBuiltinsFactory.DecompressNodeFactory.create();
507504
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/util/CastToIntegerFromIntNode.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,22 @@
5858
@TypeSystemReference(PythonArithmeticTypes.class)
5959
@ImportStatic(MathGuards.class)
6060
public abstract class CastToIntegerFromIntNode extends PNodeWithContext {
61-
61+
6262
@Child private LookupAndCallUnaryNode callIndexNode;
63-
63+
6464
private final Function<Object, Byte> typeErrorHandler;
6565

6666
public abstract Object execute(Object x);
6767

68-
public CastToIntegerFromIntNode (Function<Object, Byte> typeErrorHandler) {
69-
super ();
68+
public CastToIntegerFromIntNode(Function<Object, Byte> typeErrorHandler) {
69+
super();
7070
this.typeErrorHandler = typeErrorHandler;
7171
}
72-
72+
7373
public static CastToIntegerFromIntNode create() {
7474
return CastToIntegerFromIntNodeGen.create(null);
7575
}
76-
76+
7777
public static CastToIntegerFromIntNode create(Function<Object, Byte> typeErrorHandler) {
7878
return CastToIntegerFromIntNodeGen.create(typeErrorHandler);
7979
}

0 commit comments

Comments
 (0)