Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.9.9"
rev: "v0.14.7"
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.15.0"
rev: "v1.19.0"
hooks:
- id: mypy
additional_dependencies: ["types-PyYAML", "types-setuptools"]
4 changes: 2 additions & 2 deletions unidep/_conda_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _conda_sel(sel: str) -> CondaPlatform:
"""Return the allowed `sel(platform)` string."""
_platform = sel.split("-", 1)[0]
assert _platform in get_args(CondaPlatform), f"Invalid platform: {_platform}"
return cast(CondaPlatform, _platform)
return cast("CondaPlatform", _platform)


def _extract_conda_pip_dependencies(
Expand Down Expand Up @@ -196,7 +196,7 @@ def create_conda_env_specification( # noqa: PLR0912
# other with [win].
for _platform in _platforms:
pip_deps.append(dep_str)
_add_comment(pip_deps, cast(Platform, _platform))
_add_comment(pip_deps, cast("Platform", _platform))
else:
pip_deps.append(dep_str)

Expand Down
2 changes: 1 addition & 1 deletion unidep/_conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ def _conda_lock_subpackage(
yaml.representer.ignore_aliases = lambda *_: True # Disable anchors
conda_lock_output = file.parent / "conda-lock.yml"
metadata = {
"content_hash": {p: "unidep-is-awesome" for p in platforms},
"content_hash": dict.fromkeys(platforms, "unidep-is-awesome"),
"channels": [{"url": c, "used_env_vars": []} for c in channels],
"platforms": platforms,
"sources": [str(file)],
Expand Down
2 changes: 1 addition & 1 deletion unidep/_dependencies_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def _normalize_local_dependency_use(use_value: str | None) -> LocalDependencyUse
options = ", ".join(sorted(valid))
msg = f"Invalid `use` value `{use_value}`. Supported values: {options}."
raise ValueError(msg)
return cast(LocalDependencyUse, normalized)
return cast("LocalDependencyUse", normalized)


def get_local_dependencies(data: dict[str, Any]) -> list[LocalDependency]:
Expand Down
2 changes: 1 addition & 1 deletion unidep/_setuptools_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class SetupVisitor(ast.NodeVisitor):
def __init__(self) -> None:
self.package_name = None

def visit_Call(self, node: ast.Call) -> None: # noqa: N802
def visit_Call(self, node: ast.Call) -> None:
if isinstance(node.func, ast.Name) and node.func.id == "setup":
for keyword in node.keywords:
if keyword.arg == "name":
Expand Down
2 changes: 1 addition & 1 deletion unidep/platform_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def platforms_from_selector(selector: str) -> list[Platform]:
# https://github.com/conda/conda-lock/blob/3d2bf356e2cf3f7284407423f7032189677ba9be/conda_lock/src_parser/selectors.py
platforms: set[Platform] = set()
for s in selector.split():
s = cast(Selector, s)
s = cast("Selector", s)
platforms |= set(PLATFORM_SELECTOR_MAP_REVERSE[s])
return sorted(platforms)

Expand Down
4 changes: 2 additions & 2 deletions unidep/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def parse_package_str(package_str: str) -> ParsedPackageStr:

if selector is not None:
for s in selector.split():
validate_selector(cast(Selector, s))
validate_selector(cast("Selector", s))

return ParsedPackageStr(
package_name,
Expand Down Expand Up @@ -222,7 +222,7 @@ def selector_from_comment(comment: str) -> str | None:
return None
selectors = m.group(1).strip().split()
for s in selectors:
validate_selector(cast(Selector, s))
validate_selector(cast("Selector", s))
return " ".join(selectors)


Expand Down
Loading