Dealt with the M801 code style checker messages.

Sun, 15 Nov 2015 14:29:20 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 15 Nov 2015 14:29:20 +0100
changeset 4566
a2e8f3c420ec
parent 4564
a6480863adfb
child 4568
5a5666ab6e89

Dealt with the M801 code style checker messages.

DataViews/CodeMetrics.py file | annotate | diff | comparison | revisions
DebugClients/Python/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugBase.py file | annotate | diff | comparison | revisions
DebugClients/Python3/DebugClientBase.py file | annotate | diff | comparison | revisions
E5Gui/E5ErrorMessage.py file | annotate | diff | comparison | revisions
Globals/__init__.py file | annotate | diff | comparison | revisions
Globals/compatibility_fixes.py file | annotate | diff | comparison | revisions
PluginManager/PluginManager.py file | annotate | diff | comparison | revisions
Toolbox/Startup.py file | annotate | diff | comparison | revisions
Utilities/BackgroundClient.py file | annotate | diff | comparison | revisions
Utilities/BackgroundService.py file | annotate | diff | comparison | revisions
Utilities/ModuleParser.py file | annotate | diff | comparison | revisions
Utilities/PasswordChecker.py file | annotate | diff | comparison | revisions
Utilities/crypto/__init__.py file | annotate | diff | comparison | revisions
Utilities/crypto/py3PBKDF2.py file | annotate | diff | comparison | revisions
cleanupSource.py file | annotate | diff | comparison | revisions
compileUiFiles.py file | annotate | diff | comparison | revisions
eric6.e4p file | annotate | diff | comparison | revisions
eric6.py file | annotate | diff | comparison | revisions
eric6_api.py file | annotate | diff | comparison | revisions
eric6_doc.py file | annotate | diff | comparison | revisions
eric6_iconeditor.py file | annotate | diff | comparison | revisions
eric6_trpreviewer.py file | annotate | diff | comparison | revisions
install-i18n.py file | annotate | diff | comparison | revisions
install.py file | annotate | diff | comparison | revisions
patch_modpython.py file | annotate | diff | comparison | revisions
uninstall.py file | annotate | diff | comparison | revisions
--- a/DataViews/CodeMetrics.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/DataViews/CodeMetrics.py	Sun Nov 15 14:29:20 2015 +0100
@@ -85,7 +85,7 @@
                 else:
                     self.__addToken(toktype, toktext, srow, scol, line)
         except tokenize.TokenError as msg:
-            print("Token Error: {0}".format(str(msg)))
+            print("Token Error: {0}".format(str(msg)))  # __IGNORE_WARNING__
             return
         
         return
@@ -174,26 +174,6 @@
             counters = self.counters.setdefault(id, {})
             counters[key] = counters.setdefault(key, 0) + value
 
-    def dump(self):
-        """
-        Public method used to format and print the collected statistics.
-        """
-        label_len = 79 - len(spacer) - 6 * 6
-        print(spacer + "FUNCTION / CLASS".ljust(label_len) +
-              " START   END LINES  NLOC  COMM EMPTY")
-        for id in self.identifiers + ['TOTAL ']:
-            label = id
-            counters = self.counters.get(id, {})
-            msg = spacer + label.ljust(label_len)
-
-            for key in ('start', 'end', 'lines', 'nloc', 'comments', 'empty'):
-                if counters.get(key, 0):
-                    msg += " {0:d}".format(counters[key])
-                else:
-                    msg += " " * 6
-
-            print(msg)
-
     def getCounter(self, id, key):
         """
         Public method used to get a specific counter value.
@@ -272,36 +252,3 @@
               stats.getCounter('TOTAL ', 'nloc'))
 
     return stats
-    
-
-def main():
-    """
-    Module main function used when called as a script.
-    
-    Loop over all files given on the command line and collect the individual
-    and overall source code statistics.
-    """
-    import sys
-    
-    files = sys.argv[1:]
-    
-    if not files:
-        sys.exit(1)
-        
-    total = {}
-    
-    summarize(total, 'files', len(files))
-    for file in files:
-        print(file)
-        stats = analyze(file, total)
-        stats.dump()
-        
-    print("\nSummary")
-    for key in ['files', 'lines', 'bytes', 'comments',
-                'empty lines', 'non-commentary lines']:
-        print(key.ljust(20) + "{0:d}".format(total[key]))
-    
-    sys.exit(0)
-
-if __name__ == "__main__":
-    main()
--- a/DebugClients/Python/DebugBase.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/DebugClients/Python/DebugBase.py	Sun Nov 15 14:29:20 2015 +0100
@@ -235,7 +235,7 @@
             return self.trace_dispatch
         if event == 'c_return':
             return self.trace_dispatch
-        print 'DebugBase.trace_dispatch: unknown debugging event:', repr(event)
+        print 'DebugBase.trace_dispatch: unknown debugging event:', repr(event) # __IGNORE_WARNING__
         return self.trace_dispatch
 
     def dispatch_line(self, frame):
--- a/DebugClients/Python/DebugClientBase.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/DebugClients/Python/DebugClientBase.py	Sun Nov 15 14:29:20 2015 +0100
@@ -2117,7 +2117,7 @@
                 else:   # unknown option
                     del args[0]
             if not args:
-                print "No program given. Aborting!"
+                print "No program given. Aborting!"     # __IGNORE_WARNING__
             else:
                 if not self.noencoding:
                     self.__coding = self.defaultCoding
@@ -2158,7 +2158,7 @@
                 self.connectDebugger(port, remoteAddress, redirect)
                 self.__interact()
             else:
-                print "No network port given. Aborting..."
+                print "No network port given. Aborting..."  # __IGNORE_WARNING__
         
     def fork(self):
         """
--- a/DebugClients/Python3/DebugBase.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/DebugClients/Python3/DebugBase.py	Sun Nov 15 14:29:20 2015 +0100
@@ -236,7 +236,7 @@
             return self.trace_dispatch
         if event == 'c_return':
             return self.trace_dispatch
-        print('bdb.Bdb.dispatch: unknown debugging event: ', repr(event))
+        print('bdb.Bdb.dispatch: unknown debugging event: ', repr(event))   # __IGNORE_WARNING__
         return self.trace_dispatch
 
     def dispatch_line(self, frame):
--- a/DebugClients/Python3/DebugClientBase.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/DebugClients/Python3/DebugClientBase.py	Sun Nov 15 14:29:20 2015 +0100
@@ -2169,7 +2169,7 @@
                 else:   # unknown option
                     del args[0]
             if not args:
-                print("No program given. Aborting!")
+                print("No program given. Aborting!")    # __IGNORE_WARNING__
             else:
                 if not self.noencoding:
                     self.__coding = self.defaultCoding
@@ -2210,7 +2210,7 @@
                 self.connectDebugger(port, remoteAddress, redirect)
                 self.__interact()
             else:
-                print("No network port given. Aborting...")
+                print("No network port given. Aborting...")     # __IGNORE_WARNING__
         
     def fork(self):
         """
--- a/E5Gui/E5ErrorMessage.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/E5Gui/E5ErrorMessage.py	Sun Nov 15 14:29:20 2015 +0100
@@ -200,3 +200,6 @@
     @return flag indicating an installed message handler (boolean)
     """
     return __msgHandlerDialog is not None
+
+#
+# eflag: noqa = M801
--- a/Globals/__init__.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Globals/__init__.py	Sun Nov 15 14:29:20 2015 +0100
@@ -306,3 +306,6 @@
         return {}
     else:
         return value
+
+#
+# eflag: noqa = M801
--- a/Globals/compatibility_fixes.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Globals/compatibility_fixes.py	Sun Nov 15 14:29:20 2015 +0100
@@ -284,15 +284,6 @@
 # Inject into the __builtin__ dictionary
 __builtin__.open = open
 
-if __name__ == '__main__':
-    fp = open('compatibility_fixes.py', encoding='latin1')
-    print(fp.read())
-    fp.close()
-
-    with open('compatibility_fixes.py', encoding='UTF-8') as fp:
-        rlines = fp.readlines()
-        print(rlines[-1])
-
 #
 # eflag: FileType = Python2
 # eflag: noqa = M702
--- a/PluginManager/PluginManager.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/PluginManager/PluginManager.py	Sun Nov 15 14:29:20 2015 +0100
@@ -1253,3 +1253,6 @@
         ignored = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0]
         if ignored == E5SslErrorHandler.NotIgnored:
             self.__downloadCancelled = True
+
+#
+# eflag: noqa = M801
--- a/Toolbox/Startup.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Toolbox/Startup.py	Sun Nov 15 14:29:20 2015 +0100
@@ -252,3 +252,6 @@
         eMsg.setMinimumSize(600, 400)
     
     return app.exec_()
+
+#
+# eflag: noqa = M801
--- a/Utilities/BackgroundClient.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Utilities/BackgroundClient.py	Sun Nov 15 14:29:20 2015 +0100
@@ -191,3 +191,6 @@
     backgroundClient = BackgroundClient(host, int(port))
     # Start the main loop
     backgroundClient.run()
+
+#
+# eflag: noqa = M801
--- a/Utilities/BackgroundService.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Utilities/BackgroundService.py	Sun Nov 15 14:29:20 2015 +0100
@@ -60,7 +60,7 @@
         
         port = self.serverPort()
         ## Note: Need the port if started external in debugger:
-        print('BackgroundService listening on: {0:d}'.format(port))
+        print('BackgroundService listening on: {0:d}'.format(port))     # __IGNORE_WARNING__
         for pyName in ['Python', 'Python3']:
             interpreter = Preferences.getDebugger(
                 pyName + "Interpreter")
--- a/Utilities/ModuleParser.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Utilities/ModuleParser.py	Sun Nov 15 14:29:20 2015 +0100
@@ -1635,13 +1635,3 @@
     
     if modname in _modules:
         del _modules[modname]
-    
-if __name__ == "__main__":
-    # Main program for testing.
-    mod = sys.argv[1]
-    module = readModule(mod)
-    for cls in list(module.classes.values()):
-        print("--------------")
-        print(cls.name)
-        for meth in list(cls.methods.values()):
-            print(meth.name, meth.pyqtSignature)
--- a/Utilities/PasswordChecker.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Utilities/PasswordChecker.py	Sun Nov 15 14:29:20 2015 +0100
@@ -635,11 +635,3 @@
                 break
         
         return self.complexity["value"]
-
-if __name__ == "__main__":
-    while True:
-        try:
-            pwd = input("Enter password: ")
-            print(pwd, PasswordChecker().checkPassword(pwd))
-        except KeyboardInterrupt:
-            break
--- a/Utilities/crypto/__init__.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Utilities/crypto/__init__.py	Sun Nov 15 14:29:20 2015 +0100
@@ -314,24 +314,3 @@
     except ValueError:
         return "", False
     return plaintext, True
-    
-if __name__ == "__main__":
-    import sys
-    from PyQt5.QtWidgets import QApplication
-    
-    app = QApplication([])
-    
-    mpw = "blahblah"
-    cpw = "SomeSecret"
-    
-    cipher, ok = pwEncrypt(cpw)
-    print(ok, cipher)
-    plain, ok = pwDecrypt(cipher)
-    print(ok, plain)
-    
-    cipher, ok = pwEncrypt(cpw, mpw)
-    print(ok, cipher)
-    plain, ok = pwDecrypt(cipher, mpw)
-    print(ok, plain)
-    
-    sys.exit(0)
--- a/Utilities/crypto/py3PBKDF2.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/Utilities/crypto/py3PBKDF2.py	Sun Nov 15 14:29:20 2015 +0100
@@ -141,13 +141,3 @@
     salt = base64.b64decode(salt.encode("ascii"))
     password = password.encode("utf-8")
     return pbkdf2(password, salt, iterations, Hashes[digestname])
-
-
-if __name__ == "__main__":
-    import sys
-    pw = "secret_password"
-    print(len(hashPasswordTuple(pw)[-1]))
-    pwHash = hashPassword(pw)
-    print(pwHash)
-    print(verifyPassword(pw, pwHash))
-    sys.exit(0)
--- a/cleanupSource.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/cleanupSource.py	Sun Nov 15 14:29:20 2015 +0100
@@ -72,3 +72,6 @@
             " program, \nincluding the following traceback, to"
             " eric-bugs@eric-ide.python-projects.org.\n")
         raise
+
+#
+# eflag: noqa = M801
--- a/compileUiFiles.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/compileUiFiles.py	Sun Nov 15 14:29:20 2015 +0100
@@ -69,3 +69,6 @@
             " program, \nincluding the following traceback, to"
             " eric-bugs@eric-ide.python-projects.org.\n")
         raise
+
+#
+# eflag: noqa = M801
--- a/eric6.e4p	Sun Nov 15 13:59:43 2015 +0100
+++ b/eric6.e4p	Sun Nov 15 14:29:20 2015 +0100
@@ -2160,7 +2160,7 @@
               <string>ExcludeMessages</string>
             </key>
             <value>
-              <string>C101, E265, M801, M811, N802, N803, N807, N808, N821, W293</string>
+              <string>C101, E265, M811, N802, N803, N807, N808, N821, W293</string>
             </value>
             <key>
               <string>FixCodes</string>
--- a/eric6.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/eric6.py	Sun Nov 15 14:29:20 2015 +0100
@@ -122,7 +122,7 @@
             client.processArgs(sys.argv[1:])
         sys.exit(0)
     elif res < 0:
-        print("eric6: {0}".format(client.errstr()))
+        print("eric6: {0}".format(client.errstr()))     # __IGNORE_WARNING__
         sys.exit(res)
 
 
@@ -183,7 +183,7 @@
             msg = msg.encode(sys.stdout.encoding, 'replace')
             versionInfo = versionInfo.encode(sys.stdout.encoding, 'replace')
         warning = notice + msg + versionInfo
-        print(warning)
+        print(warning)                          # __IGNORE_WARNING__
     else:
         warning = notice + msg + versionInfo
         # Escape &<> otherwise it's not visible in the error dialog
--- a/eric6_api.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/eric6_api.py	Sun Nov 15 14:29:20 2015 +0100
@@ -315,3 +315,6 @@
 
 if __name__ == '__main__':
     main()
+
+#
+# eflag: noqa = M801
--- a/eric6_doc.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/eric6_doc.py	Sun Nov 15 14:29:20 2015 +0100
@@ -430,3 +430,6 @@
 
 if __name__ == '__main__':
     main()
+
+#
+# eflag: noqa = M801
--- a/eric6_iconeditor.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/eric6_iconeditor.py	Sun Nov 15 14:29:20 2015 +0100
@@ -24,7 +24,6 @@
 import sys
 import os
 
-print(sys.argv)
 for arg in sys.argv[:]:
     if arg.startswith("--config="):
         import Globals
@@ -39,7 +38,6 @@
         QSettings.setPath(QSettings.IniFormat, QSettings.UserScope,
                           settingsDir)
         sys.argv.remove(arg)
-print(sys.argv)
 
 from Globals import AppInfo
 
--- a/eric6_trpreviewer.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/eric6_trpreviewer.py	Sun Nov 15 14:29:20 2015 +0100
@@ -103,3 +103,6 @@
 
 if __name__ == '__main__':
     main()
+
+#
+# eflag: noqa = M801
--- a/install-i18n.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/install-i18n.py	Sun Nov 15 14:29:20 2015 +0100
@@ -125,3 +125,6 @@
               """ the program,\nincluding the following traceback, to"""
               """ eric-bugs@eric-ide.python-projects.org.\n""")
         raise
+
+#
+# eflag: noqa = M801
--- a/install.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/install.py	Sun Nov 15 14:29:20 2015 +0100
@@ -1508,3 +1508,6 @@
               """ of the program,\nincluding the following traceback, to"""
               """ eric-bugs@eric-ide.python-projects.org.\n""")
         raise
+
+#
+# eflag: noqa = M801
--- a/patch_modpython.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/patch_modpython.py	Sun Nov 15 14:29:20 2015 +0100
@@ -163,3 +163,6 @@
               """ the program,\nincluding the following traceback, to"""
               """ eric-bugs@die-offenbachs.de.\n""")
         raise
+
+#
+# eflag: noqa = M801
--- a/uninstall.py	Sun Nov 15 13:59:43 2015 +0100
+++ b/uninstall.py	Sun Nov 15 14:29:20 2015 +0100
@@ -366,3 +366,6 @@
               """including the following traceback, to"""
               """ eric-bugs@eric-ide.python-projects.org.\n""")
         raise
+
+#
+# eflag: noqa = M801

eric ide

mercurial