Fixed some code style issues. eric7

Fri, 03 Sep 2021 19:56:21 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 03 Sep 2021 19:56:21 +0200
branch
eric7
changeset 8573
77845f40ebfe
parent 8572
718f80d8bcde
child 8574
e5d88ab9d84d

Fixed some code style issues.

eric7/DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
eric7/DebugClients/Python/DebugVariables.py file | annotate | diff | comparison | revisions
eric7/Debugger/Config.py file | annotate | diff | comparison | revisions
eric7/WebBrowser/WebBrowserView.py file | annotate | diff | comparison | revisions
--- a/eric7/DebugClients/Python/DebugClientBase.py	Fri Sep 03 19:14:36 2021 +0200
+++ b/eric7/DebugClients/Python/DebugClientBase.py	Fri Sep 03 19:56:21 2021 +0200
@@ -1627,8 +1627,8 @@
         expressions. The formated variables list (a list of tuples of 3
         values) is returned.
         
-        @param dict_ the dictionary to be scanned
-        @type dict
+        @param variables variables list to be processed
+        @type list of tuple of (str, Any) or (str, str, Any)
         @param scope 1 to filter using the globals filter, 0 using the locals
             filter.
             Variables are only added to the list, if their name do not match
@@ -1757,7 +1757,7 @@
                         elif valtype == "numpy.ndarray" and length > -1:
                             length = "x".join(str(x) for x in value.shape)
                         elif valtype.endswith(".MultiValueDict"):
-                            indicator = "{:}"
+                            indicator = "{:}"   # __IGNORE_WARNING__
                             valtype = "django.MultiValueDict"  # shortened type
                         break
                 else:
@@ -1784,10 +1784,8 @@
         patternFilterObjects = None
         if filterString.strip():
             pattern = filterString.replace(';', '|')
-            try:
+            with contextlib.suppress(re.error):
                 patternFilterObjects = re.compile(pattern)
-            except re.error:
-                pass
         
         if scope:
             self.globalsFilterObjects = patternFilterObjects
--- a/eric7/DebugClients/Python/DebugVariables.py	Fri Sep 03 19:14:36 2021 +0200
+++ b/eric7/DebugClients/Python/DebugVariables.py	Fri Sep 03 19:56:21 2021 +0200
@@ -269,7 +269,7 @@
             containing the variable attributes
         @ytype tuple of (int, list)
         """
-        return super().getVariableList(list(var))
+        yield from super().getVariableList(list(var))
 
 
 ############################################################
@@ -430,12 +430,18 @@
         d = super().getVariableList(var)
         
         if var.size > 1024 * 1024:
-            d.append(('min',
-                'ndarray too big, calculating min would slow down debugging'))
-            d.append(('max',
-                'ndarray too big, calculating max would slow down debugging'))
-            d.append(('mean',
-                'ndarray too big, calculating mean would slow down debugging'))
+            d.append(
+                ('min',
+                 'ndarray too big, calculating min would slow down debugging')
+            )
+            d.append(
+                ('max',
+                 'ndarray too big, calculating max would slow down debugging')
+            )
+            d.append(
+                ('mean',
+                 'ndarray too big, calculating mean would slow down debugging')
+            )
         elif self.__isNumeric(var):
             if var.size == 0:
                 d.append(('min', 'empty array'))
@@ -650,7 +656,7 @@
         attributes = ()
         # Gently handle exception which could occure as special
         # cases, e.g. already deleted C++ objects, str conversion..
-        try:
+        with contextlib.suppress(Exception):
             qttype = type(var).__name__
             
             if qttype in ('QLabel', 'QPushButton'):
@@ -658,10 +664,14 @@
             elif qttype == 'QByteArray':
                 d.append(('bytes', bytes(var)))
                 d.append(('hex', "QByteArray", "{0}".format(var.toHex())))
-                d.append(('base64', "QByteArray",
-                    "{0}".format(var.toBase64())))
-                d.append(('percent encoding', "QByteArray",
-                    "{0}".format(var.toPercentEncoding())))
+                d.append(
+                    ('base64', "QByteArray",
+                     "{0}".format(var.toBase64()))
+                )
+                d.append(
+                    ('percent encoding', "QByteArray",
+                     "{0}".format(var.toPercentEncoding()))
+                )
             elif qttype in ('QPoint', 'QPointF'):
                 attributes = ('x', 'y')
             elif qttype in ('QRect', 'QRectF'):
@@ -681,7 +691,7 @@
                 c, m, y, k, a = var.getCmyk()
                 d.append(
                     ('cmyka',
-                    "{0:d}, {1:d}, {2:d}, {3:d}, {4:d}".format(c, m, y, k, a))
+                     "{0:d}, {1:d}, {2:d}, {3:d}, {4:d}".format(c, m, y, k, a))
                 )
             elif qttype in ('QDate', 'QTime', 'QDateTime'):
                 d.append((qttype[1:].lower(), var.toString()))
@@ -733,8 +743,6 @@
             elif qttype == 'EnumType':  # Not in PyQt possible
                 for key, value in var.values.items():
                     d.append((key, int(value)))
-        except Exception:
-            pass
         
         for attribute in attributes:
             d.append((attribute, getattr(var, attribute)()))
--- a/eric7/Debugger/Config.py	Fri Sep 03 19:14:36 2021 +0200
+++ b/eric7/Debugger/Config.py	Fri Sep 03 19:56:21 2021 +0200
@@ -48,7 +48,7 @@
     'dict_keys': QT_TRANSLATE_NOOP('Variable Types', 'Dict. Keys View'),
     'dict_values': QT_TRANSLATE_NOOP('Variable Types', 'Dict. Values View'),
     'async_generator': QT_TRANSLATE_NOOP('Variable Types',
-        'Asynchronous Generator'),
+                                         'Asynchronous Generator'),
     'coroutine': QT_TRANSLATE_NOOP('Variable Types', 'Coroutine'),
     'mappingproxy': QT_TRANSLATE_NOOP('Variable Types', 'Mapping Proxy'),
 }
--- a/eric7/WebBrowser/WebBrowserView.py	Fri Sep 03 19:14:36 2021 +0200
+++ b/eric7/WebBrowser/WebBrowserView.py	Fri Sep 03 19:56:21 2021 +0200
@@ -1944,7 +1944,9 @@
                 defaultFileName += ".mhtml"
 
         fileName = ""
-        saveFormat = QWebEngineDownloadRequest.SavePageFormat.MimeHtmlSaveFormat
+        saveFormat = (
+            QWebEngineDownloadRequest.SavePageFormat.MimeHtmlSaveFormat
+        )
         
         fileName, selectedFilter = EricFileDialog.getSaveFileNameAndFilter(
             None,
@@ -1960,7 +1962,8 @@
                 )
             elif index == 1:
                 saveFormat = (
-                    QWebEngineDownloadRequest.SavePageFormat.SingleHtmlSaveFormat
+                    QWebEngineDownloadRequest.SavePageFormat
+                    .SingleHtmlSaveFormat
                 )
             else:
                 saveFormat = (

eric ide

mercurial