]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Improve fname_is_c func in pratracker/includes.py
authorskaluzka <skaluzka@protonmail.com>
Sun, 29 Aug 2021 20:10:44 +0000 (22:10 +0200)
committerskaluzka <skaluzka@protonmail.com>
Sun, 29 Aug 2021 20:10:44 +0000 (22:10 +0200)
Use tuples for bname.startswith and fname.endswith in "fname_is_c"
function.

scripts/maint/practracker/includes.py

index a5ee728824bc05333e60c28b44c3f1d22f40e3c1..46630d987f42932be6c3901578707c2db5421c9b 100755 (executable)
@@ -40,11 +40,13 @@ def warn(msg):
     print(msg, file=sys.stderr)
 
 def fname_is_c(fname):
-    """ Return true iff 'fname' is the name of a file that we should
-        search for possibly disallowed #include directives. """
-    if fname.endswith(".h") or fname.endswith(".c"):
+    """
+    Return true if 'fname' is the name of a file that we should
+    search for possibly disallowed #include directives.
+    """
+    if fname.endswith((".c", ".h")):
         bname = os.path.basename(fname)
-        return not (bname.startswith(".") or bname.startswith("#"))
+        return not bname.startswith((".", "#"))
     else:
         return False