[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/main] Improve fname_is_c func in pratracker/includes.py



commit e5b234e3582aef3476efb6bfc3d47981b3fb038f
Author: skaluzka <skaluzka@xxxxxxxxxxxxxx>
Date:   Sun Aug 29 22:10:44 2021 +0200

    Improve fname_is_c func in pratracker/includes.py
    
    Use tuples for bname.startswith and fname.endswith in "fname_is_c"
    function.
---
 scripts/maint/practracker/includes.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/maint/practracker/includes.py b/scripts/maint/practracker/includes.py
index a5ee728824..46630d987f 100755
--- a/scripts/maint/practracker/includes.py
+++ b/scripts/maint/practracker/includes.py
@@ -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
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits