Fixed some code style issues. eric7

Tue, 03 Sep 2024 17:42:44 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 03 Sep 2024 17:42:44 +0200
branch
eric7
changeset 10908
ef1b3cd9a6ca
parent 10907
c424150d2ac8
child 10910
13c8626c5024

Fixed some code style issues.

src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircupFunctions.py file | annotate | diff | comparison | revisions
src/eric7/Plugins/VcsPlugins/vcsGit/GitFetchDialog.py file | annotate | diff | comparison | revisions
src/eric7/Plugins/VcsPlugins/vcsGit/GitPullDialog.py file | annotate | diff | comparison | revisions
src/eric7/Plugins/VcsPlugins/vcsGit/GitPushDialog.py file | annotate | diff | comparison | revisions
src/eric7/QScintilla/APIsManager.py file | annotate | diff | comparison | revisions
src/eric7/QScintilla/Editor.py file | annotate | diff | comparison | revisions
src/eric7/QScintilla/Lexers/SubstyledLexer.py file | annotate | diff | comparison | revisions
src/eric7/Utilities/crypto/py3AES.py file | annotate | diff | comparison | revisions
--- a/src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircupFunctions.py	Tue Sep 03 17:28:40 2024 +0200
+++ b/src/eric7/MicroPython/Devices/CircuitPythonUpdater/CircupFunctions.py	Tue Sep 03 17:42:44 2024 +0200
@@ -37,10 +37,11 @@
         modules on the connected device
     @rtype list of circup.Module
     """
-    if isinstance(device_path, str):
-        backend = circup.DiskBackend(device_path, circup.logger)
-    else:
-        backend = device_path
+    backend = (
+        circup.DiskBackend(device_path, circup.logger)
+        if isinstance(device_path, str)
+        else device_path
+    )
     result = []
     try:
         device_modules = backend.get_device_versions()
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitFetchDialog.py	Tue Sep 03 17:28:40 2024 +0200
+++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitFetchDialog.py	Tue Sep 03 17:42:44 2024 +0200
@@ -39,7 +39,7 @@
         self.__custom = self.tr("<Custom>")
 
         remoteUrlsList = self.__vcs.gitGetRemoteUrlsList(self.__repodir)
-        self.__repos = {name: url for name, url in remoteUrlsList}
+        self.__repos = dict(remoteUrlsList)
 
         self.__okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
 
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitPullDialog.py	Tue Sep 03 17:28:40 2024 +0200
+++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitPullDialog.py	Tue Sep 03 17:42:44 2024 +0200
@@ -39,7 +39,7 @@
         self.__custom = self.tr("<Custom>")
 
         remoteUrlsList = self.__vcs.gitGetRemoteUrlsList(self.__repodir)
-        self.__repos = {name: url for name, url in remoteUrlsList}
+        self.__repos = dict(remoteUrlsList)
 
         self.__okButton = self.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
 
--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitPushDialog.py	Tue Sep 03 17:28:40 2024 +0200
+++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitPushDialog.py	Tue Sep 03 17:42:44 2024 +0200
@@ -41,7 +41,7 @@
         self.__repodir = repodir
 
         remoteUrlsList = self.__vcs.gitGetRemoteUrlsList(self.__repodir)
-        self.__repos = {name: url for name, url in remoteUrlsList}
+        self.__repos = dict(remoteUrlsList)
 
         remoteBranches = self.__vcs.gitGetBranchesList(self.__repodir, remotes=True)
         self.__remotes = {}
--- a/src/eric7/QScintilla/APIsManager.py	Tue Sep 03 17:28:40 2024 +0200
+++ b/src/eric7/QScintilla/APIsManager.py	Tue Sep 03 17:42:44 2024 +0200
@@ -207,14 +207,11 @@
                 if not os.path.exists(apiDir):
                     # use lower case language
                     apiDir = os.path.join(apisDir, self.__lexer.language().lower())
-                fnames = {f for f in glob.glob(os.path.join(apiDir, "*.api"))}
+                fnames = set(glob.glob(os.path.join(apiDir, "*.api")))
                 # combine with the QScintilla standard behavior
-                fnames |= {
-                    f
-                    for f in glob.glob(
-                        os.path.join(apisDir, self.__lexer.lexer(), "*.api")
-                    )
-                }
+                fnames |= set(
+                    glob.glob(os.path.join(apisDir, self.__lexer.lexer(), "*.api"))
+                )
                 return sorted(fnames)
 
         return []
--- a/src/eric7/QScintilla/Editor.py	Tue Sep 03 17:28:40 2024 +0200
+++ b/src/eric7/QScintilla/Editor.py	Tue Sep 03 17:42:44 2024 +0200
@@ -7399,7 +7399,7 @@
         regExp = re.compile(
             "|".join(Editor.VcsConflictMarkerLineRegExpList), re.MULTILINE
         )
-        matches = [m for m in regExp.finditer(self.text())]
+        matches = list(regExp.finditer(self.text()))
         for match in matches:
             line, _ = self.lineIndexFromPosition(match.start())
             conflictMarkerLines.append(line)
@@ -9635,7 +9635,7 @@
         regExp = re.compile(r"\b{0}\b".format(word))
         startPos = wordEndPos if forward else wordStartPos
 
-        matches = [m for m in regExp.finditer(self.text())]
+        matches = list(regExp.finditer(self.text()))
         if matches:
             if forward:
                 matchesAfter = [m for m in matches if m.start() >= startPos]
--- a/src/eric7/QScintilla/Lexers/SubstyledLexer.py	Tue Sep 03 17:28:40 2024 +0200
+++ b/src/eric7/QScintilla/Lexers/SubstyledLexer.py	Tue Sep 03 17:42:44 2024 +0200
@@ -173,7 +173,7 @@
         editor.SendScintilla(editor.SCI_GETSUBSTYLEBASES, 0, subStyleBases)
         distanceToSecondary = editor.SendScintilla(editor.SCI_DISTANCETOSECONDARYSTYLES)
 
-        subStyleBases = [b for b in bytearray(subStyleBases[:-1])]
+        subStyleBases = list(bytearray(subStyleBases[:-1]))
         if distanceToSecondary:
             subStyleBases.extend(b + distanceToSecondary for b in subStyleBases[:])
         for baseStyleNo in subStyleBases:
--- a/src/eric7/Utilities/crypto/py3AES.py	Tue Sep 03 17:28:40 2024 +0200
+++ b/src/eric7/Utilities/crypto/py3AES.py	Tue Sep 03 17:42:44 2024 +0200
@@ -1625,7 +1625,7 @@
     if keysize not in AES.KeySize.values():
         raise ValueError("invalid key size: {0}".format(keysize))
     # create a new iv using random data
-    iv = bytearray([i for i in os.urandom(16)])
+    iv = bytearray(list(os.urandom(16)))
     moo = AESModeOfOperation()
     _mode, _length, ciph = moo.encrypt(data, mode, key, keysize, iv)
     # With padding, the original length does not need to be known. It's a bad

eric ide

mercurial