Skip to content
Snippets Groups Projects
Verified Commit e5b234e3 authored by skaluzka's avatar skaluzka :zzz:
Browse files

Improve fname_is_c func in pratracker/includes.py

Use tuples for bname.startswith and fname.endswith in "fname_is_c"
function.
parent 8ead5333
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment