Clean if statement block and globs

This commit is contained in:
Eric Torres 2019-02-20 15:49:18 -08:00
parent 6c49217b0b
commit c789f779ef

View File

@ -16,7 +16,7 @@ def get_pkgfiles(query=None, directory=None, signatures_only=False):
:param query: names of package files to search for
:type query: str
:param directory: a directory to search in
:type directory: str, bytes, or path-like object
:type directory: str
:param signatures_only: include only signature files
:type signatures_only: bool
:returns: paths of package files
@ -27,13 +27,11 @@ def get_pkgfiles(query=None, directory=None, signatures_only=False):
else:
path = os.getcwd()
if signatures_only:
if query is not None:
return glob.glob(f"{path}/{query}*.{SIGEXT}")
else:
return glob.glob(f"{path}/*.{SIGEXT}")
else:
if query is not None:
return glob.glob(f"{path}/{query}*.{PKGEXT}")
else:
return glob.glob(f"{path}/*.{PKGEXT}")
if signatures_only and query is not None:
return glob.glob(f"{path}/*{query}*.{SIGEXT}")
elif signatures_only and query is None:
return glob.glob(f"{path}/*.{SIGEXT}")
elif not signatures_only and query is not None:
return glob.glob(f"{path}/*{query}*.{PKGEXT}")
elif not signatures_only and query is None:
return glob.glob(f"{path}/*.{PKGEXT}")