E592 fmt black and fix flake8 issue · sec-js/st2@043d26d · GitHub
[go: up one dir, main page]

Skip to content

Commit 043d26d

Browse files
committed
fmt black and fix flake8 issue
1 parent f7efdc4 commit 043d26d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

scripts/lockfiles_to_reqs.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,20 @@ def strip_comments_from_pex_json_lockfile(lockfile_bytes: bytes) -> bytes:
3737
TODO: delete this once we getrid of the legacy fixate requirements files.
3838
"""
3939
return b"\n".join(
40-
line for line in lockfile_bytes.splitlines() if not line.lstrip().startswith(b"//")
40+
line
41+
for line in lockfile_bytes.splitlines()
42+
if not line.lstrip().startswith(b"//")
4143
)
4244

4345

4446
def _update(old_req, name, version):
4547
parsedreq = parse_req_from_line(old_req.requirement, old_req.line_source)
4648
assert parsedreq.requirement.name == name
47-
specs = tuple(parsedreq.requirement.specifier)
49+
specs = parsedreq.requirement.specifier
4850
if len(specs) != 1:
4951
return False
50-
spec = specs[0]
51-
if spec.operator == '==' and spec.version != version:
52+
spec = tuple(specs)[0]
53+
if spec.operator == "==" and spec.version != version:
5254
# only change pins; ignore any version range
5355
new_spec = spec.__class__(f"=={version}", spec.prereleases or None)
5456
new_specs = specs.__class__([new_spec], specs.prereleases or None)
@@ -94,8 +96,7 @@ def main():
9496
pex_lock = json.loads(lockfile_bytes.decode("utf-8"))
9597
locked_requirements = pex_lock["locked_resolves"][0]["locked_requirements"]
9698
locked_reqs_name_version_map = {
97-
req["project_name"]: req["version"]
98-
for req in locked_requirements
99+
req["project_name"]: req["version"] for req in locked_requirements
99100
}
100101
for name, version in locked_reqs_name_version_map.items():
101102
if name in handled:

0 commit comments

Comments
 (0)
0