mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
python: Reformat with Black, except quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
5028c081cb
commit
11741543da
@@ -19,6 +19,7 @@ def expand_reqs_helper(fpath: str) -> List[str]:
|
||||
result.append(dep)
|
||||
return result
|
||||
|
||||
|
||||
def expand_reqs(fpath: str) -> List[str]:
|
||||
"""
|
||||
Returns a sorted list of unique dependencies specified by the requirements file `fpath`.
|
||||
@@ -29,24 +30,29 @@ def expand_reqs(fpath: str) -> List[str]:
|
||||
output = expand_reqs_helper(absfpath)
|
||||
return sorted(set(output))
|
||||
|
||||
|
||||
def python_version() -> str:
|
||||
"""
|
||||
Returns the Python version as string 'Python major.minor.patchlevel'
|
||||
"""
|
||||
return subprocess.check_output(["/usr/bin/python3", "-VV"], universal_newlines=True)
|
||||
|
||||
|
||||
def hash_deps(deps: Iterable[str]) -> str:
|
||||
deps_str = "\n".join(deps) + "\n" + python_version()
|
||||
return hashlib.sha1(deps_str.encode('utf-8')).hexdigest()
|
||||
|
||||
|
||||
def main() -> int:
|
||||
description = ("Finds the SHA1 hash of list of dependencies in a requirements file"
|
||||
" after recursively visiting all files specified in it.")
|
||||
description = (
|
||||
"Finds the SHA1 hash of list of dependencies in a requirements file"
|
||||
" after recursively visiting all files specified in it."
|
||||
)
|
||||
parser = argparse.ArgumentParser(description=description)
|
||||
parser.add_argument("fpath", metavar="FILE",
|
||||
help="Path to requirements file")
|
||||
parser.add_argument("--print", dest="print_reqs", action='store_true',
|
||||
help="Print all dependencies")
|
||||
parser.add_argument("fpath", metavar="FILE", help="Path to requirements file")
|
||||
parser.add_argument(
|
||||
"--print", dest="print_reqs", action='store_true', help="Print all dependencies"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
deps = expand_reqs(args.fpath)
|
||||
@@ -57,5 +63,6 @@ def main() -> int:
|
||||
print(dep)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
||||
Reference in New Issue
Block a user