eric6/Project/Project.py

changeset 8205
4a0f1f896341
parent 8164
c8b88e73b56f
child 8218
7c09585bd960
diff -r fd477cded1c1 -r 4a0f1f896341 eric6/Project/Project.py
--- a/eric6/Project/Project.py	Thu Apr 08 17:27:12 2021 +0200
+++ b/eric6/Project/Project.py	Thu Apr 08 18:27:47 2021 +0200
@@ -2312,17 +2312,14 @@
         @return flag indicating, if the project contains the file (boolean)
         """
         fn = self.getRelativePath(fn)
-        if (
+        return (
             fn in self.pdata["SOURCES"] or
             fn in self.pdata["FORMS"] or
             fn in self.pdata["INTERFACES"] or
             fn in self.pdata["PROTOCOLS"] or
             fn in self.pdata["RESOURCES"] or
             fn in self.pdata["OTHERS"]
-        ):
-            return True
-        else:
-            return False
+        )
         
     def createNewProject(self):
         """
@@ -3562,24 +3559,20 @@
         """
         Public method to check, if a path starts with the project path.
         
-        @param path path to be checked (string)
+        @param path path to be checked
+        @type str
         @return flag indicating that the path starts with the project path
-            (boolean)
-        """
-        if self.ppath:
-            if path == self.ppath:
-                return True
-            elif (
-                Utilities.normcasepath(Utilities.toNativeSeparators(path))
-                .startswith(Utilities.normcasepath(
-                    Utilities.toNativeSeparators(self.ppath + "/")))
-            ):
-                return True
-            else:
-                return False
-        else:
-            return False
-        
+        @rtype bool
+        """
+        return (
+            bool(self.ppath) and
+            (path == self.ppath or
+             Utilities.normcasepath(Utilities.toNativeSeparators(path))
+             .startswith(Utilities.normcasepath(
+                         Utilities.toNativeSeparators(self.ppath + "/")))
+             )
+        )
+    
     def getProjectFile(self):
         """
         Public method to get the path of the project file.
@@ -5559,7 +5552,7 @@
         @param path name of the directory entry to create (string)
         @param zipFile open ZipFile object (zipfile.ZipFile)
         """
-        if path == "" or path == "/" or path == "\\":
+        if path in ("", "/", "\\"):
             return
         
         if not path.endswith("/") and not path.endswith("\\"):

eric ide

mercurial