[Jython-checkins] jython: Trivial reformatting to PySystemState (whitespace and comments).

jeff.allen jython-checkins at python.org
Sat May 5 08:34:13 EDT 2018


https://hg.python.org/jython/rev/6b912cfd485a
changeset:   8159:6b912cfd485a
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Fri May 04 09:02:01 2018 +0100
summary:
  Trivial reformatting to PySystemState (whitespace and comments).

Some coding standard conformance ahead of substantive changes. Also, beefed up
the Javadoc to getNativePlatform, partly because it's more portable than
defending the comments against the formatter.

files:
  src/org/python/core/PySystemState.java |  325 +++++++-----
  1 files changed, 182 insertions(+), 143 deletions(-)


diff --git a/src/org/python/core/PySystemState.java b/src/org/python/core/PySystemState.java
--- a/src/org/python/core/PySystemState.java
+++ b/src/org/python/core/PySystemState.java
@@ -32,8 +32,6 @@
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
-import jnr.posix.util.Platform;
-import com.carrotsearch.sizeof.RamUsageEstimator;
 
 import org.python.Version;
 import org.python.core.adapter.ClassicPyObjectAdapter;
@@ -45,13 +43,17 @@
 import org.python.modules.Setup;
 import org.python.util.Generic;
 
+import com.carrotsearch.sizeof.RamUsageEstimator;
+
+import jnr.posix.util.Platform;
+
 /**
  * The "sys" module.
  */
 // xxx Many have lamented, this should really be a module!
 // but it will require some refactoring to see this wish come true.
-public class PySystemState extends PyObject implements AutoCloseable,
-        ClassDictInit, Closeable, Traverseproc {
+public class PySystemState extends PyObject
+        implements AutoCloseable, ClassDictInit, Closeable, Traverseproc {
 
     public static final String PYTHON_CACHEDIR = "python.cachedir";
     public static final String PYTHON_CACHEDIR_SKIP = "python.cachedir.skip";
@@ -65,8 +67,8 @@
 
     public static final PyString version = new PyString(Version.getVersion());
 
-    public static final PyTuple subversion = new PyTuple(new PyString("Jython"), Py.newString(""),
-            Py.newString(""));
+    public static final PyTuple subversion =
+            new PyTuple(new PyString("Jython"), Py.newString(""), Py.newString(""));
 
     public static final int hexversion = ((Version.PY_MAJOR_VERSION << 24)
             | (Version.PY_MINOR_VERSION << 16) | (Version.PY_MICRO_VERSION << 8)
@@ -89,22 +91,21 @@
 
     public final static Class flags = Options.class;
 
-    public final static PyTuple _mercurial = new PyTuple(
-            Py.newString("Jython"),
-            Py.newString(Version.getHGIdentifier()),
-            Py.newString(Version.getHGVersion()));
+    public final static PyTuple _mercurial = new PyTuple(Py.newString("Jython"),
+            Py.newString(Version.getHGIdentifier()), Py.newString(Version.getHGVersion()));
     /**
      * The copyright notice for this release.
      */
 
-    public static final PyObject copyright = Py.newString(
-            "Copyright (c) 2000-2017 Jython Developers.\n" + "All rights reserved.\n\n" +
-            "Copyright (c) 2000 BeOpen.com.\n" + "All Rights Reserved.\n\n" +
-            "Copyright (c) 2000 The Apache Software Foundation.\n" + "All rights reserved.\n\n" +
-            "Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n"
-                + "All Rights Reserved.\n\n" +
-            "Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\n"
-                + "All Rights Reserved.");
+    public static final PyObject copyright =
+            Py.newString("Copyright (c) 2000-2017 Jython Developers.\n" + "All rights reserved.\n\n"
+                    + "Copyright (c) 2000 BeOpen.com.\n" + "All Rights Reserved.\n\n"
+                    + "Copyright (c) 2000 The Apache Software Foundation.\n"
+                    + "All rights reserved.\n\n"
+                    + "Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n"
+                    + "All Rights Reserved.\n\n"
+                    + "Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\n"
+                    + "All Rights Reserved.");
 
     private static Map<String, String> builtinNames;
     public static PyTuple builtin_module_names = null;
@@ -213,8 +214,8 @@
         importLock = new ReentrantLock();
         syspathJavaLoader = new SyspathJavaLoader(imp.getParentClassLoader());
 
-        argv = (PyList)defaultArgv.repeat(1);
-        path = (PyList)defaultPath.repeat(1);
+        argv = (PyList) defaultArgv.repeat(1);
+        path = (PyList) defaultPath.repeat(1);
         path.append(Py.newString(JavaImporter.JAVA_IMPORT_PATH_ENTRY));
         path.append(Py.newString(ClasspathPyImporter.PYCLASSPATH_PREFIX));
         executable = defaultExecutable;
@@ -269,39 +270,39 @@
     }
 
     private static void checkReadOnly(String name) {
-        if (name == "__dict__" || name == "__class__" || name == "registry"
-                || name == "exec_prefix" || name == "packageManager") {
+        if (name == "__dict__" || name == "__class__" || name == "registry" || name == "exec_prefix"
+                || name == "packageManager") {
             throw Py.TypeError("readonly attribute");
         }
     }
 
     private static void checkMustExist(String name) {
-        if (name == "__dict__" || name == "__class__" || name == "registry"
-                || name == "exec_prefix" || name == "platform" || name == "packageManager"
-                || name == "builtins" || name == "warnoptions") {
+        if (name == "__dict__" || name == "__class__" || name == "registry" || name == "exec_prefix"
+                || name == "platform" || name == "packageManager" || name == "builtins"
+                || name == "warnoptions") {
             throw Py.TypeError("readonly attribute");
         }
     }
 
     /**
      * Initialise the encoding of <code>sys.stdin</code>, <code>sys.stdout</code>, and
-     * <code>sys.stderr</code>, and their error handling policy, from registry variables.
-     * Under the console app util.jython, values reflect PYTHONIOENCODING if not overridden.
-     * Note that the encoding must name a Python codec, as in <code>codecs.encode()</code>.
+     * <code>sys.stderr</code>, and their error handling policy, from registry variables. Under the
+     * console app util.jython, values reflect PYTHONIOENCODING if not overridden. Note that the
+     * encoding must name a Python codec, as in <code>codecs.encode()</code>.
      */
     private void initEncoding() {
         // Two registry variables, counterparts to PYTHONIOENCODING = [encoding][:errors]
         String encoding = registry.getProperty(PYTHON_IO_ENCODING);
         String errors = registry.getProperty(PYTHON_IO_ERRORS);
 
-        if (encoding==null) {
+        if (encoding == null) {
             // We still don't have an explicit selection for this: match the console.
             encoding = Py.getConsole().getEncoding();
         }
 
-        ((PyFile)stdin).setEncoding(encoding, errors);
-        ((PyFile)stdout).setEncoding(encoding, errors);
-        ((PyFile)stderr).setEncoding(encoding, "backslashreplace");
+        ((PyFile) stdin).setEncoding(encoding, errors);
+        ((PyFile) stdout).setEncoding(encoding, errors);
+        ((PyFile) stderr).setEncoding(encoding, "backslashreplace");
     }
 
     @Deprecated
@@ -480,7 +481,7 @@
         if (ts.tracefunc == null) {
             return Py.None;
         } else {
-            return ((PythonTraceFunction)ts.tracefunc).tracefunc;
+            return ((PythonTraceFunction) ts.tracefunc).tracefunc;
         }
     }
 
@@ -498,7 +499,7 @@
         if (ts.profilefunc == null) {
             return Py.None;
         } else {
-            return ((PythonTraceFunction)ts.profilefunc).tracefunc;
+            return ((PythonTraceFunction) ts.profilefunc).tracefunc;
         }
     }
 
@@ -523,11 +524,14 @@
         return FILE_SYSTEM_ENCODING;
     }
 
+    /* get and setcheckinterval really do nothing, but it helps when some code tries to use these */
+    public PyInteger getcheckinterval() {
+        return new PyInteger(checkinterval);
+    }
 
-    /* get and setcheckinterval really do nothing, but it helps when some code tries to use these */
-    public PyInteger getcheckinterval() { return new PyInteger(checkinterval); }
-
-    public void setcheckinterval(int interval) { checkinterval = interval; }
+    public void setcheckinterval(int interval) {
+        checkinterval = interval;
+    }
 
     /**
      * Change the current working directory to the specified path.
@@ -671,8 +675,8 @@
     }
 
     /**
-     * Return the Windows drive letter from the start of the path, upper case, or 0 if
-     * the path does not start X: where X is a letter.
+     * Return the Windows drive letter from the start of the path, upper case, or 0 if the path does
+     * not start X: where X is a letter.
      *
      * @param path to examine
      * @return drive letter or char 0 if no drive letter
@@ -685,13 +689,13 @@
                 return Character.toUpperCase(pathDrive);
             }
         }
-        return (char)0;
+        return (char) 0;
     }
 
     /**
      * Return the Windows UNC share name from the start of the path, or <code>null</code> if the
-     * path is not of Windows UNC type. The path has to be formed with Windows-backslashes:
-     * slashes '/' are not accepted as a substitute here.
+     * path is not of Windows UNC type. The path has to be formed with Windows-backslashes: slashes
+     * '/' are not accepted as a substitute here.
      *
      * @param path to examine
      * @return share name or null
@@ -807,27 +811,61 @@
     }
 
     /**
-     * Emulates CPython's way to name sys.platform.
+     * Emulates CPython's way to name sys.platform. Works according to this table:
+     *
+     * <table>
+     * <tr>
+     * <th style="text-align:left">System</th>
+     * <th style="text-align:left">Value</th>
+     * </tr>
+     * <tr>
+     * <td>Linux (2.x and 3.x)</td>
+     * <td>linux2</td>
+     * </tr>
+     * <tr>
+     * <td>Windows</td>
+     * <td>win32</td>
+     * </tr>
+     * <tr>
+     * <td>Windows/Cygwin</td>
+     * <td>cygwin</td>
+     * </tr>
+     * <tr>
+     * <td>Mac OS X</td>
+     * <td>darwin</td>
+     * </tr>
+     * <tr>
+     * <td>OS/2</td>
+     * <td>os2</td>
+     * </tr>
+     * <tr>
+     * <td>OS/2 EMX</td>
+     * <td>os2emx</td>
+     * </tr>
+     * <tr>
+     * <td>RiscOS</td>
+     * <td>riscos</td>
+     * </tr>
+     * <tr>
+     * <td>AtheOS</td>
+     * <td>atheos</td>
+     * </tr>
+     * </table>
+     *
      */
     public static String getNativePlatform() {
-        /* Works according to this table:
-            System              Value
-            --------------------------
-            Linux (2.x and 3.x) linux2
-            Windows             win32
-            Windows/Cygwin      cygwin
-            Mac OS X            darwin
-            OS/2                os2
-            OS/2 EMX            os2emx
-            RiscOS              riscos
-            AtheOS              atheos
-        */
         String osname = System.getProperty("os.name");
-        if (osname.equals("Linux")) return "linux2";
-        if (osname.equals("Mac OS X")) return "darwin";
-        if (osname.toLowerCase().contains("cygwin")) return "cygwin";
-        if (osname.startsWith("Windows")) return "win32";
-        return osname.replaceAll("[\\s/]", "").toLowerCase();
+        if (osname.equals("Linux")) {
+            return "linux2";
+        } else if (osname.equals("Mac OS X")) {
+            return "darwin";
+        } else if (osname.toLowerCase().contains("cygwin")) {
+            return "cygwin";
+        } else if (osname.startsWith("Windows")) {
+            return "win32";
+        } else {
+            return osname.replaceAll("[\\s/]", "").toLowerCase();
+        }
     }
 
     private static void initRegistry(Properties preProperties, Properties postProperties,
@@ -880,9 +918,9 @@
         }
 
         /*
-         *  The console encoding is the one used by line-editing consoles to decode on the OS side and
-         *  encode on the Python side. It must be a Java codec name, so any relationship to
-         *  python.io.encoding is dubious.
+         * The console encoding is the one used by line-editing consoles to decode on the OS side
+         * and encode on the Python side. It must be a Java codec name, so any relationship to
+         * python.io.encoding is dubious.
          */
         if (!registry.containsKey(PYTHON_CONSOLE_ENCODING)) {
             String encoding = getPlatformEncoding();
@@ -922,7 +960,7 @@
         try {
             Method encodingMethod = java.io.Console.class.getDeclaredMethod("encoding");
             encodingMethod.setAccessible(true); // private static method
-            encoding = (String)encodingMethod.invoke(Console.class);
+            encoding = (String) encodingMethod.invoke(Console.class);
         } catch (Exception e) {
             // ignore any exception
         }
@@ -975,7 +1013,8 @@
         initialize(null, null);
     }
 
-    public static synchronized void initialize(Properties preProperties, Properties postProperties) {
+    public static synchronized void initialize(Properties preProperties,
+            Properties postProperties) {
         initialize(preProperties, postProperties, new String[] {""});
     }
 
@@ -1003,7 +1042,8 @@
         try {
             ClassLoader context = Thread.currentThread().getContextClassLoader();
             if (context != null) {
-                if (initialize(preProperties, postProperties, argv, classLoader, adapter, context)) {
+                if (initialize(preProperties, postProperties, argv, classLoader, adapter,
+                        context)) {
                     return;
                 }
             } else {
@@ -1048,8 +1088,8 @@
             ClassLoader initializerClassLoader) {
         InputStream in = initializerClassLoader.getResourceAsStream(INITIALIZER_SERVICE);
         if (in == null) {
-            Py.writeDebug("initializer", "'" + INITIALIZER_SERVICE + "' not found on "
-                    + initializerClassLoader);
+            Py.writeDebug("initializer",
+                    "'" + INITIALIZER_SERVICE + "' not found on " + initializerClassLoader);
             return false;
         }
         BufferedReader r = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
@@ -1057,8 +1097,8 @@
         try {
             className = r.readLine();
         } catch (IOException e) {
-            Py.writeWarning("initializer", "Failed reading '" + INITIALIZER_SERVICE + "' from "
-                    + initializerClassLoader);
+            Py.writeWarning("initializer",
+                    "Failed reading '" + INITIALIZER_SERVICE + "' from " + initializerClassLoader);
             e.printStackTrace(System.err);
             return false;
         }
@@ -1066,16 +1106,16 @@
         try {
             initializer = initializerClassLoader.loadClass(className);
         } catch (ClassNotFoundException e) {
-            Py.writeWarning("initializer", "Specified initializer class '" + className
-                    + "' not found, continuing");
+            Py.writeWarning("initializer",
+                    "Specified initializer class '" + className + "' not found, continuing");
             return false;
         }
         try {
-            ((JythonInitializer)initializer.newInstance()).initialize(pre, post, argv,
+            ((JythonInitializer) initializer.newInstance()).initialize(pre, post, argv,
                     sysClassLoader, adapter);
         } catch (Exception e) {
-            Py.writeWarning("initializer", "Failed initializing with class '" + className
-                    + "', continuing");
+            Py.writeWarning("initializer",
+                    "Failed initializing with class '" + className + "', continuing");
             e.printStackTrace(System.err);
             return false;
         }
@@ -1105,7 +1145,7 @@
 
         // other initializations
         initBuiltins(registry);
-//        initStaticFields();
+        // initStaticFields();
 
         // Initialize the path (and add system defaults)
         defaultPath = initPath(registry, standalone, jarFileName);
@@ -1148,14 +1188,14 @@
         } else if (Version.PY_RELEASE_LEVEL == 0xAA) {
             s = "snapshot";
         } else {
-            throw new RuntimeException("Illegal value for PY_RELEASE_LEVEL: "
-                    + Version.PY_RELEASE_LEVEL);
+            throw new RuntimeException(
+                    "Illegal value for PY_RELEASE_LEVEL: " + Version.PY_RELEASE_LEVEL);
         }
-        return new PyVersionInfo(
-                Py.newInteger(Version.PY_MAJOR_VERSION),
-                Py.newInteger(Version.PY_MINOR_VERSION),
-                Py.newInteger(Version.PY_MICRO_VERSION),
-                Py.newString(s),
+        return new PyVersionInfo(//
+                Py.newInteger(Version.PY_MAJOR_VERSION), //
+                Py.newInteger(Version.PY_MINOR_VERSION), //
+                Py.newInteger(Version.PY_MICRO_VERSION), //
+                Py.newString(s), //
                 Py.newInteger(Version.PY_RELEASE_SERIAL));
     }
 
@@ -1299,10 +1339,9 @@
 
     /**
      * Convenience method wrapping {@link Py#writeWarning(String, String)} to issue a warning
-     * message something like:
-     * "console: Failed to load 'org.python.util.ReadlineConsole': <b>msg</b>.". It's only a warning
-     * because the interpreter will fall back to a plain console, but it is useful to know exactly
-     * why it didn't work.
+     * message something like: "console: Failed to load 'org.python.util.ReadlineConsole':
+     * <b>msg</b>.". It's only a warning because the interpreter will fall back to a plain console,
+     * but it is useful to know exactly why it didn't work.
      *
      * @param consoleName console class name we're trying to initialise
      * @param msg specific cause of the failure
@@ -1560,11 +1599,14 @@
     }
 
     @Override
-    public void close() { cleanup(); }
+    public void close() {
+        cleanup();
+    }
 
     public static class PySystemStateCloser {
 
-        private final Set<Callable<Void>> resourceClosers = Collections.synchronizedSet(new LinkedHashSet<Callable<Void>>());
+        private final Set<Callable<Void>> resourceClosers =
+                Collections.synchronizedSet(new LinkedHashSet<Callable<Void>>());
         private volatile boolean isCleanup = false;
         private final Thread shutdownHook;
 
@@ -1619,13 +1661,14 @@
             // Re-enable the management of resource closers
             isCleanup = false;
         }
+
         private synchronized void runClosers() {
             // resourceClosers can be null in some strange cases
             if (resourceClosers != null) {
                 /*
-                    * Although a Set, the container iterates in the order closers were added. Make a Deque
-                    * of it and deal from the top.
-                    */
+                 * Although a Set, the container iterates in the order closers were added. Make a
+                 * Deque of it and deal from the top.
+                 */
                 LinkedList<Callable<Void>> rc = new LinkedList<Callable<Void>>(resourceClosers);
                 Iterator<Callable<Void>> iter = rc.descendingIterator();
 
@@ -1643,7 +1686,8 @@
         // Python scripts expect that files are closed upon an orderly cleanup of the VM.
         private Thread initShutdownCloser() {
             try {
-                Thread shutdownHook = new Thread(new ShutdownCloser(this), "Jython Shutdown Closer");
+                Thread shutdownHook =
+                        new Thread(new ShutdownCloser(this), "Jython Shutdown Closer");
                 Runtime.getRuntime().addShutdownHook(shutdownHook);
                 return shutdownHook;
             } catch (SecurityException se) {
@@ -1653,6 +1697,7 @@
         }
 
         private class ShutdownCloser implements Runnable {
+
             PySystemStateCloser closer = null;
 
             public ShutdownCloser(PySystemStateCloser closer) {
@@ -1672,18 +1717,17 @@
     }
 
     /**
-     * Backed as follows:
-     * Windows: cmd.exe /C ver (part after "Windows")
-     * Other:   uname -v
+     * Attempt to find the OS version. The mechanism on Windows is to extract it from
+     * the result of <code>cmd.exe /C ver</code>, and otherwise (assumed Unix-like OS)
+     * to use <code>uname -v</code>.
      */
     public static String getSystemVersionString() {
         try {
             String uname_sysver;
             boolean win = System.getProperty("os.name").startsWith("Windows");
-            Process p = Runtime.getRuntime().exec(
-                    win ? "cmd.exe /C ver" : "uname -v");
-            java.io.BufferedReader br = new java.io.BufferedReader(
-                    new java.io.InputStreamReader(p.getInputStream()));
+            Process p = Runtime.getRuntime().exec(win ? "cmd.exe /C ver" : "uname -v");
+            java.io.BufferedReader br =
+                    new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream()));
             uname_sysver = br.readLine();
             while (uname_sysver != null && uname_sysver.length() == 0) {
                 uname_sysver = br.readLine();
@@ -1715,7 +1759,6 @@
         }
     }
 
-
     /* Traverseproc implementation */
     @Override
     public int traverse(Visitproc visit, Object arg) {
@@ -1869,17 +1912,15 @@
 
     @Override
     public boolean refersDirectlyTo(PyObject ob) {
-        return ob != null && (ob == argv || ob ==  modules || ob == path
-            || ob == warnoptions || ob == builtins || ob == platform
-            || ob == meta_path || ob == path_hooks || ob == path_importer_cache
-            || ob == ps1 || ob == ps2 || ob == executable || ob == stdout
-            || ob == stderr || ob == stdin || ob == __stdout__ || ob == __stderr__
-            || ob == __stdin__ || ob == __displayhook__ || ob == __excepthook__
-            || ob ==  last_value || ob == last_type || ob == last_traceback
-            || ob ==__name__ || ob == __dict__);
+        return ob != null && (ob == argv || ob == modules || ob == path || ob == warnoptions
+                || ob == builtins || ob == platform || ob == meta_path || ob == path_hooks
+                || ob == path_importer_cache || ob == ps1 || ob == ps2 || ob == executable
+                || ob == stdout || ob == stderr || ob == stdin || ob == __stdout__
+                || ob == __stderr__ || ob == __stdin__ || ob == __displayhook__
+                || ob == __excepthook__ || ob == last_value || ob == last_type
+                || ob == last_traceback || ob == __name__ || ob == __dict__);
     }
 
-
     /**
      * Helper abstracting common code from {@link ShutdownCloser#run()} and
      * {@link PySystemStateCloser#cleanup()} to close resources (such as still-open files). The
@@ -1998,16 +2039,15 @@
 
     @Override
     public PyString __repr__() {
-        return (PyString) Py.newString(
-                TYPE.fastGetName() + "(" +
-                "max=%r, max_exp=%r, max_10_exp=%r, min=%r, min_exp=%r, min_10_exp=%r, "+
-                "dig=%r, mant_dig=%r, epsilon=%r, radix=%r, rounds=%r)").__mod__(this);
+        return (PyString) Py.newString(TYPE.fastGetName() + "("
+                + "max=%r, max_exp=%r, max_10_exp=%r, min=%r, min_exp=%r, min_10_exp=%r, "
+                + "dig=%r, mant_dig=%r, epsilon=%r, radix=%r, rounds=%r)").__mod__(this);
     }
 
-
-    /* Note for Traverseproc implementation:
-     * We needn't visit the fields, because they are also represented as tuple elements
-     * in the parent class. So deferring to super-implementation is sufficient.
+    /*
+     * Note for Traverseproc implementation: We needn't visit the fields, because they are also
+     * represented as tuple elements in the parent class. So deferring to super-implementation is
+     * sufficient.
      */
 }
 
@@ -2035,15 +2075,15 @@
 
     @Override
     public PyString __repr__() {
-        return (PyString) Py.newString(
-                TYPE.fastGetName() + "(" +
-                "bits_per_digit=%r, sizeof_digit=%r)").__mod__(this);
+        return (PyString) Py
+                .newString(TYPE.fastGetName() + "(" + "bits_per_digit=%r, sizeof_digit=%r)")
+                .__mod__(this);
     }
 
-
-    /* Note for Traverseproc implementation:
-     * We needn't visit the fields, because they are also represented as tuple elements
-     * in the parent class. So deferring to super-implementation is sufficient.
+    /*
+     * Note for Traverseproc implementation: We needn't visit the fields, because they are also
+     * represented as tuple elements in the parent class. So deferring to super-implementation is
+     * sufficient.
      */
 }
 
@@ -2074,38 +2114,37 @@
             int minor = Integer.parseInt(sys_ver[1]);
             int build = Integer.parseInt(sys_ver[2]);
             if (major > 6) {
-                major = 6; minor = 2; build = 9200;
+                major = 6;
+                minor = 2;
+                build = 9200;
             } else if (major == 6 && minor > 2) {
-                minor = 2; build = 9200;
+                minor = 2;
+                build = 9200;
             }
             // emulate deprecation behavior of GetVersionEx:
-            return new WinVersion(
-                    Py.newInteger(major), // major
+            return new WinVersion(Py.newInteger(major), // major
                     Py.newInteger(minor), // minor
                     Py.newInteger(build), // build
                     Py.newInteger(2), // platform
                     Py.EmptyString); // service_pack
         } catch (Exception e) {
-            return new WinVersion(Py.EmptyString, Py.EmptyString,
-                    Py.EmptyString, Py.EmptyString, Py.EmptyString);
+            return new WinVersion(Py.EmptyString, Py.EmptyString, Py.EmptyString, Py.EmptyString,
+                    Py.EmptyString);
         }
     }
 
     @Override
     public PyString __repr__() {
-        return (PyString) Py.newString(
-                TYPE.fastGetName() + "(major=%r, minor=%r, build=%r, " +
-                "platform=%r, service_pack=%r)").__mod__(this);
+        return (PyString) Py.newString(TYPE.fastGetName() + "(major=%r, minor=%r, build=%r, "
+                + "platform=%r, service_pack=%r)").__mod__(this);
     }
 
-
-    /* Note for traverseproc implementation:
-     * We needn't visit the fields, because they are also represented as tuple elements
-     * in the parent class. So deferring to super-implementation is sufficient.
+    /*
+     * Note for traverseproc implementation: We needn't visit the fields, because they are also
+     * represented as tuple elements in the parent class. So deferring to super-implementation is
+     * sufficient.
      *
-     * (In CPython sys.getwindowsversion can have some keyword-only elements. So far
-     * we don't support these here. If that changes, an actual traverseproc implementation
-     * might be required.
+     * (In CPython sys.getwindowsversion can have some keyword-only elements. So far we don't
+     * support these here. If that changes, an actual traverseproc implementation might be required.
      */
 }
-

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list