Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (conda#14488)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.1](astral-sh/ruff-pre-commit@v0.8.6...v0.9.1)
- [github.com/python-jsonschema/check-jsonschema: 0.30.0 → 0.31.0](python-jsonschema/check-jsonschema@0.30.0...0.31.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jan 14, 2025
1 parent 205d397 commit c999123
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ repos:
# auto format Python codes within docstrings
- id: blacken-docs
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.1
hooks:
# lint & attempt to correct failures (e.g. pyupgrade)
- id: ruff
Expand All @@ -90,7 +90,7 @@ repos:
tests/
)
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
rev: 0.31.0
hooks:
# verify github syntaxes
- id: check-github-workflows
Expand Down
3 changes: 1 addition & 2 deletions conda/base/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,7 @@ def post_build_validation(self):
"client_ssl_cert",
self.client_ssl_cert,
"<<merged>>",
"'client_ssl_cert' is required when 'client_ssl_cert_key' "
"is defined",
"'client_ssl_cert' is required when 'client_ssl_cert_key' is defined",
)
errors.append(error)
if self.always_copy and self.always_softlink:
Expand Down
6 changes: 3 additions & 3 deletions conda/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ def spec_from_line(line):
return name + cc.replace("=", " ")
elif pc:
if pc.startswith("~= "):
assert (
pc.count("~=") == 1
), f"Overly complex 'Compatible release' spec not handled {line}"
assert pc.count("~=") == 1, (
f"Overly complex 'Compatible release' spec not handled {line}"
)
assert pc.count("."), f"No '.' in 'Compatible release' version {line}"
ver = pc.replace("~= ", "")
ver2 = ".".join(ver.split(".")[:-1]) + ".*"
Expand Down
3 changes: 1 addition & 2 deletions conda/cli/main_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ def execute(args: Namespace, parser: ArgumentParser) -> int:

if not (args.all or args.package_names):
raise CondaValueError(
"no package names supplied,\n"
' try "conda remove -h" for more details'
'no package names supplied,\n try "conda remove -h" for more details'
)

prefix = context.target_prefix
Expand Down
17 changes: 7 additions & 10 deletions conda/core/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,7 @@ def solve_final_state(
force_remove = context.force_remove if force_remove is NULL else force_remove

log.debug(
"solving prefix %s\n"
" specs_to_remove: %s\n"
" specs_to_add: %s\n"
" prune: %s",
"solving prefix %s\n specs_to_remove: %s\n specs_to_add: %s\n prune: %s",
self.prefix,
self.specs_to_remove,
self.specs_to_add,
Expand Down Expand Up @@ -1415,12 +1412,12 @@ def diff_for_unlink_link_precs(
) -> tuple[tuple[PackageRecord, ...], tuple[PackageRecord, ...]]:
# Ensure final_precs supports the IndexedSet interface
if not isinstance(final_precs, IndexedSet):
assert hasattr(
final_precs, "__getitem__"
), "final_precs must support list indexing"
assert hasattr(
final_precs, "__sub__"
), "final_precs must support set difference"
assert hasattr(final_precs, "__getitem__"), (
"final_precs must support list indexing"
)
assert hasattr(final_precs, "__sub__"), (
"final_precs must support set difference"
)

previous_records = IndexedSet(PrefixGraph(PrefixData(prefix).iter_records()).graph)
force_reinstall = (
Expand Down
2 changes: 1 addition & 1 deletion conda/core/subdir_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def _process_raw_repodata(self, repodata: dict, state: RepodataState | None = No
):
for fn, info in group:
if copy_legacy_md5:
counterpart = f"{fn[:-len('.conda')]}.tar.bz2"
counterpart = f"{fn[: -len('.conda')]}.tar.bz2"
if counterpart in legacy_packages:
info["legacy_bz2_md5"] = legacy_packages[counterpart].get("md5")
info["legacy_bz2_size"] = legacy_packages[counterpart].get(
Expand Down
4 changes: 2 additions & 2 deletions conda/plugins/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def get_hook_results(self, name, **kwargs):
f"""
Invalid plugin names found:
{', '.join([str(plugin) for plugin in invalid])}
{", ".join([str(plugin) for plugin in invalid])}
Please report this issue to the plugin author(s).
"""
Expand All @@ -262,7 +262,7 @@ def get_hook_results(self, name, **kwargs):
f"""
Conflicting `{name}` plugins found:
{', '.join([str(conflict) for conflict in conflicts])}
{", ".join([str(conflict) for conflict in conflicts])}
Multiple conda plugins are registered via the `{specname}` hook.
Please make sure that you don't have any incompatible plugins installed.
Expand Down
12 changes: 6 additions & 6 deletions conda/testing/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ def assert_equals(a, b, output=""):


def assert_not_in(a, b, output=""):
assert (
a.lower() not in b.lower()
), f"{output} {a.lower()!r} should not be found in {b.lower()!r}"
assert a.lower() not in b.lower(), (
f"{output} {a.lower()!r} should not be found in {b.lower()!r}"
)


def assert_in(a, b, output=""):
assert (
a.lower() in b.lower()
), f"{output} {a.lower()!r} cannot be found in {b.lower()!r}"
assert a.lower() in b.lower(), (
f"{output} {a.lower()!r} cannot be found in {b.lower()!r}"
)


def add_subdir(dist_string):
Expand Down
12 changes: 6 additions & 6 deletions conda/testing/solver_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,13 +1229,13 @@ def test_get_reduced_index_broadening_preferred_solution(self, env):
]
for record in env.install("top", as_specs=True):
if record.name == "top":
assert (
record.version == "2.0"
), f"top version should be 2.0, but is {record.version}"
assert record.version == "2.0", (
f"top version should be 2.0, but is {record.version}"
)
elif record.name == "bottom":
assert (
record.version == "2.5"
), f"bottom version should be 2.5, but is {record.version}"
assert record.version == "2.5", (
f"bottom version should be 2.5, but is {record.version}"
)

def test_arch_preferred_over_noarch_when_otherwise_equal(self, env):
env.repo_packages += [
Expand Down
6 changes: 3 additions & 3 deletions conda/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ def massage_arguments(arguments, errors="assert"):
if not isiterable(arguments):
arguments = (arguments,)

assert not any(
[isiterable(arg) for arg in arguments]
), "Individual arguments must not be iterable"
assert not any([isiterable(arg) for arg in arguments]), (
"Individual arguments must not be iterable"
)
arguments = list(arguments)

return arguments
Expand Down
5 changes: 1 addition & 4 deletions tests/http_test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ def start_server(queue):
host, port = httpd.socket.getsockname()[:2]
queue.put(httpd)
url_host = f"[{host}]" if ":" in host else host
print(
f"Serving HTTP on {host} port {port} "
f"(http://{url_host}:{port}/) ..."
)
print(f"Serving HTTP on {host} port {port} (http://{url_host}:{port}/) ...")
try:
httpd.serve_forever()
except KeyboardInterrupt:
Expand Down

0 comments on commit c999123

Please sign in to comment.