Skip to content

Commit 36f4905

Browse files
committed
fix style
1 parent ded8f53 commit 36f4905

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyObjectLookupAttr.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383

8484
public abstract class PyObjectLookupAttr extends Node {
8585
private static final BuiltinMethodDescriptor OBJ_GET_ATTRIBUTE = BuiltinMethodDescriptor.get(ObjectBuiltinsFactory.GetAttributeNodeFactory.getInstance(), PythonBuiltinClassType.PythonObject);
86-
private static final BuiltinMethodDescriptor MODULE_GET_ATTRIBUTE = BuiltinMethodDescriptor.get(ModuleBuiltinsFactory.ModuleGetattritbuteNodeFactory.getInstance(), PythonBuiltinClassType.PythonModule);
86+
private static final BuiltinMethodDescriptor MODULE_GET_ATTRIBUTE = BuiltinMethodDescriptor.get(ModuleBuiltinsFactory.ModuleGetattritbuteNodeFactory.getInstance(),
87+
PythonBuiltinClassType.PythonModule);
8788
private static final BuiltinMethodDescriptor TYPE_GET_ATTRIBUTE = BuiltinMethodDescriptor.get(TypeBuiltinsFactory.GetattributeNodeFactory.getInstance(), PythonBuiltinClassType.PythonClass);
8889

8990
public abstract Object execute(Frame frame, Object receiver, Object name);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/statement/AbstractImportNode.java

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
import com.oracle.truffle.api.dsl.Bind;
8181
import com.oracle.truffle.api.dsl.Cached;
8282
import com.oracle.truffle.api.dsl.Specialization;
83-
import com.oracle.truffle.api.frame.MaterializedFrame;
8483
import com.oracle.truffle.api.frame.VirtualFrame;
8584
import com.oracle.truffle.api.instrumentation.StandardTags;
8685
import com.oracle.truffle.api.instrumentation.Tag;
@@ -118,7 +117,6 @@ protected final Object importModule(VirtualFrame frame, String name) {
118117
return importModule(frame, name, PNone.NONE, PythonUtils.EMPTY_STRING_ARRAY, 0);
119118
}
120119

121-
122120
public static final Object importModule(String name) {
123121
return importModule(name, PythonUtils.EMPTY_STRING_ARRAY);
124122
}
@@ -164,7 +162,8 @@ protected final Object importModule(VirtualFrame frame, String name, Object glob
164162
}
165163

166164
/**
167-
* Equivalent to CPython's import_name. We also pass the builtins module in, because we ignore what it's set to in the frame and globals.
165+
* Equivalent to CPython's import_name. We also pass the builtins module in, because we ignore
166+
* what it's set to in the frame and globals.
168167
*/
169168
abstract static class ImportName extends Node {
170169
protected abstract Object execute(VirtualFrame frame, PythonContext context, PythonModule builtins, String name, Object globals, String[] fromList, int level);
@@ -211,7 +210,8 @@ protected static final int indexOfDot(String name) {
211210
}
212211

213212
@Specialization(guards = {"level == 0", "fromList.length == 0", "dotIndex < 0"})
214-
static Object levelZeroNoFromlist(VirtualFrame frame, PythonContext context, String name, @SuppressWarnings("unused") Object globals, @SuppressWarnings("unused") String[] fromList, @SuppressWarnings("unused") int level,
213+
static Object levelZeroNoFromlist(VirtualFrame frame, PythonContext context, String name, @SuppressWarnings("unused") Object globals, @SuppressWarnings("unused") String[] fromList,
214+
@SuppressWarnings("unused") int level,
215215
@SuppressWarnings("unused") @Bind("indexOfDot(name)") int dotIndex,
216216
@Cached PRaiseNode raiseNode,
217217
@Cached PyDictGetItem getModuleNode,
@@ -281,13 +281,18 @@ static Object genericImport(VirtualFrame frame, PythonContext context, String na
281281
Object front = new ModuleFront(name.substring(0, dotIndex));
282282
// cpython recurses, we have transformed the recursion into a loop
283283
do {
284-
// we omit a few arguments in the recursion, because that makes things simpler.
284+
// we omit a few arguments in the recursion, because that makes things
285+
// simpler.
285286
// globals are null, fromlist is empty, level is 0
286-
front = genericImportRecursion(frame, context, (ModuleFront)front,
287-
raiseNode, // raiseNode only needed if front.length() == 0 at this point
288-
getModuleNode, // used multiple times to get the 'front' module
289-
ensureInitialized, // used multiple times on the 'front' module
290-
findAndLoad); // used multiple times, but always to call the exact same function
287+
front = genericImportRecursion(frame, context, (ModuleFront) front,
288+
raiseNode, // raiseNode only needed if front.length() ==
289+
// 0 at this point
290+
getModuleNode, // used multiple times to get the 'front'
291+
// module
292+
ensureInitialized, // used multiple times on the
293+
// 'front' module
294+
findAndLoad); // used multiple times, but always to call
295+
// the exact same function
291296
} while (recursiveCase.profile(front instanceof ModuleFront));
292297
return front;
293298
} else {
@@ -344,8 +349,8 @@ static final Object genericImportRecursion(VirtualFrame frame, PythonContext con
344349
}
345350

346351
/**
347-
* Equivalent of CPython's PyModuleSpec_IsInitializing, but for convenience it takes the
348-
* module, not the spec.
352+
* Equivalent of CPython's PyModuleSpec_IsInitializing, but for convenience it takes the module,
353+
* not the spec.
349354
*/
350355
static abstract class PyModuleIsInitializing extends Node {
351356
abstract boolean execute(VirtualFrame frame, Object mod);
@@ -361,7 +366,8 @@ static boolean isInitializing(VirtualFrame frame, Object mod,
361366
Object initializing = getInitNode.execute(frame, spec, "_initializing");
362367
return isTrue.execute(frame, initializing);
363368
} catch (PException e) {
364-
// _PyModuleSpec_IsInitializing clears any error that happens during getting the __spec__ or _initializing attributes
369+
// _PyModuleSpec_IsInitializing clears any error that happens during getting the
370+
// __spec__ or _initializing attributes
365371
return false;
366372
}
367373
}
@@ -378,7 +384,9 @@ static void ensureInitialized(VirtualFrame frame, PythonContext context, Object
378384
@Cached PyModuleIsInitializing isInitializing,
379385
@Cached PyObjectCallMethodObjArgs callLockUnlock) {
380386
if (isInitializing.execute(frame, mod)) {
381-
callLockUnlock.execute(frame, context.getImportlib(), "_lock_unlock_module", name); // blocks until done
387+
callLockUnlock.execute(frame, context.getImportlib(), "_lock_unlock_module", name); // blocks
388+
// until
389+
// done
382390
}
383391
}
384392
}
@@ -433,7 +441,8 @@ String resolveName(VirtualFrame frame, String name, Object globals, int level,
433441
// TODO: emit warning
434442
// Object parent = getParent.execute(frame, spec, "parent");
435443
// equal = PyObject_RichCompareBool(package, parent, Py_EQ);
436-
// if (equal == 0) { PyErr_WarnEx(PyExc_ImportWarning, "__package__ != __spec__.parent", 1) }
444+
// if (equal == 0) { PyErr_WarnEx(PyExc_ImportWarning, "__package__ !=
445+
// __spec__.parent", 1) }
437446
}
438447
} else if (spec != null && spec != PNone.NONE) {
439448
if ((branchStates & PKG_IS_NULL) == 0) {
@@ -535,11 +544,11 @@ static Object findAndLoad(VirtualFrame frame, PythonContext context, String absN
535544
// Object sysMetaPath = readPath.execute(sys, "meta_path");
536545
// Object sysPathHooks = readPath.execute(sys, "path_hooks");
537546
// audit.execute("import", new Object[] {
538-
// absName,
539-
// PNone.NONE,
540-
// sysPath == PNone.NO_VALUE ? PNone.NONE : sysPath,
541-
// sysMetaPath == PNone.NO_VALUE ? PNone.NONE : sysMetaPath,
542-
// sysPathHooks == PNone.NO_VALUE ? PNone.NONE : sysPathHooks);
547+
// absName,
548+
// PNone.NONE,
549+
// sysPath == PNone.NO_VALUE ? PNone.NONE : sysPath,
550+
// sysMetaPath == PNone.NO_VALUE ? PNone.NONE : sysMetaPath,
551+
// sysPathHooks == PNone.NO_VALUE ? PNone.NONE : sysPathHooks);
543552
return callFindAndLoad.execute(frame, context.getImportlib(), "_find_and_load", absName, context.importFunc());
544553
}
545554
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/statement/ImportFromNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,4 @@ private CastToJavaStringNode ensureCastToStringNode() {
177177
}
178178
return castToJavaStringNode;
179179
}
180-
}
180+
}

0 commit comments

Comments
 (0)