Skip to content

Commit

Permalink
Remove unused args in render_lockfile_for_platform
Browse files Browse the repository at this point in the history
  • Loading branch information
srilman committed Nov 24, 2023
1 parent 9b37d5a commit 1aa1f52
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,7 @@ def render_lockfile_for_platform( # noqa: C901
if not p.name.startswith("__"):
conda_deps.append(p)

def format_pip_requirement(
spec: LockedDependency, platform: str, direct: bool = False
) -> str:
def format_pip_requirement(spec: LockedDependency, direct: bool = False) -> str:
if spec.source and spec.source.type == "url":
return f"{spec.name} @ {spec.source.url}"
elif direct:
Expand All @@ -635,9 +633,7 @@ def format_pip_requirement(
s += f" --hash=sha256:{spec.hash.sha256}"
return s

def format_conda_requirement(
spec: LockedDependency, platform: str, direct: bool = False
) -> str:
def format_conda_requirement(spec: LockedDependency, direct: bool = False) -> str:
if direct:
# inject the environment variables in here
return posixpath.expandvars(f"{spec.url}#{spec.hash.md5}")
Expand All @@ -658,7 +654,7 @@ def format_conda_requirement(
),
"dependencies:",
*(
f" - {format_conda_requirement(dep, platform, direct=False)}"
f" - {format_conda_requirement(dep, direct=False)}"
for dep in conda_deps
),
]
Expand All @@ -667,7 +663,7 @@ def format_conda_requirement(
[
" - pip:",
*(
f" - {format_pip_requirement(dep, platform, direct=False)}"
f" - {format_pip_requirement(dep, direct=False)}"
for dep in pip_deps
),
]
Expand All @@ -678,7 +674,7 @@ def format_conda_requirement(
lockfile_contents.append("@EXPLICIT\n")

lockfile_contents.extend(
[format_conda_requirement(dep, platform, direct=True) for dep in conda_deps]
[format_conda_requirement(dep, direct=True) for dep in conda_deps]
)

def sanitize_lockfile_line(line: str) -> str:
Expand All @@ -692,10 +688,7 @@ def sanitize_lockfile_line(line: str) -> str:

# emit an explicit requirements.txt, prefixed with '# pip '
lockfile_contents.extend(
[
f"# pip {format_pip_requirement(dep, platform, direct=True)}"
for dep in pip_deps
]
[f"# pip {format_pip_requirement(dep, direct=True)}" for dep in pip_deps]
)

if len(pip_deps) > 0 and not suppress_warning_for_pip_and_explicit:
Expand Down

0 comments on commit 1aa1f52

Please sign in to comment.