ProjectFlask/Project.py

changeset 61
fe1e8783a95f
parent 60
02243723ac17
child 64
0ee58185b8df
diff -r 02243723ac17 -r fe1e8783a95f ProjectFlask/Project.py
--- a/ProjectFlask/Project.py	Wed Dec 30 11:02:08 2020 +0100
+++ b/ProjectFlask/Project.py	Sat Apr 24 11:30:11 2021 +0200
@@ -42,7 +42,7 @@
         @param parent parent
         @type QObject
         """
-        super(Project, self).__init__(parent)
+        super().__init__(parent)
         
         self.__plugin = plugin
         self.__iconSuffix = iconSuffix
@@ -393,11 +393,11 @@
                     "VirtualEnvironmentNamePy3")
         else:
             venvName = ""
-        if venvName:
-            virtEnv = self.__virtualEnvManager.getVirtualenvDirectory(
-                venvName)
-        else:
-            virtEnv = ""
+        virtEnv = (
+            self.__virtualEnvManager.getVirtualenvDirectory(venvName)
+            if venvName else
+            ""
+        )
         
         if virtEnv and not os.path.exists(virtEnv):
             virtEnv = ""
@@ -426,19 +426,16 @@
         @rtype str
         """
         virtualEnv = virtualEnvPath or self.getVirtualEnvironment()
-        if isWindowsPlatform():
-            fullCmds = [
-                os.path.join(virtualEnv, "Scripts", command + '.exe'),
-                os.path.join(virtualEnv, "bin", command + '.exe'),
-                command     # fall back to just cmd
-            ]
-        else:
-            fullCmds = [
-                os.path.join(virtualEnv, "bin", command),
-                os.path.join(virtualEnv, "local", "bin", command),
-                Utilities.getExecutablePath(command),
-                command     # fall back to just cmd
-            ]
+        fullCmds = (
+            [os.path.join(virtualEnv, "Scripts", command + '.exe'),
+             os.path.join(virtualEnv, "bin", command + '.exe'),
+             command]     # fall back to just cmd
+            if isWindowsPlatform() else
+            [os.path.join(virtualEnv, "bin", command),
+             os.path.join(virtualEnv, "local", "bin", command),
+             Utilities.getExecutablePath(command),
+             command]     # fall back to just cmd
+        )
         for command in fullCmds:
             if os.path.exists(command):
                 break

eric ide

mercurial