Skip to content

Commit

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

updates:
- [github.com/pre-commit/mirrors-prettier: v3.0.0 → v3.0.2](pre-commit/mirrors-prettier@v3.0.0...v3.0.2)
- [github.com/astral-sh/ruff-pre-commit: v0.0.278 → v0.0.285](astral-sh/ruff-pre-commit@v0.0.278...v0.0.285)
- [github.com/streetsidesoftware/cspell-cli: v6.31.0 → v7.0.0](streetsidesoftware/cspell-cli@v6.31.0...v7.0.0)
- [github.com/Lucas-C/pre-commit-hooks.git: v1.5.1 → v1.5.4](https://github.com/Lucas-C/pre-commit-hooks.git/compare/v1.5.1...v1.5.4)
- [github.com/PyCQA/flake8.git: 6.0.0 → 6.1.0](https://github.com/PyCQA/flake8.git/compare/6.0.0...6.1.0)
- [github.com/asottile/pyupgrade: v3.9.0 → v3.10.1](asottile/pyupgrade@v3.9.0...v3.10.1)
- [github.com/pre-commit/mirrors-mypy.git: v1.4.1 → v1.5.1](https://github.com/pre-commit/mirrors-mypy.git/compare/v1.4.1...v1.5.1)
- [github.com/pycqa/pylint.git: v3.0.0a6 → v3.0.0a7](https://github.com/pycqa/pylint.git/compare/v3.0.0a6...v3.0.0a7)

* CI Fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: shatakshiiii <shatakshimishra01@gmail.com>
  • Loading branch information
pre-commit-ci[bot] and shatakshiiii authored Aug 28, 2023
1 parent c5a8056 commit 9405c06
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 23 deletions.
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exclude: >
)$
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0"
rev: "v3.0.2"
hooks:
- id: prettier
# Original hook implementation is flaky due to *several* bugs described
Expand Down Expand Up @@ -40,20 +40,20 @@ repos:
language_version: python3

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.278"
rev: "v0.0.285"
hooks:
- id: ruff
args:
- "--exit-non-zero-on-fix"

- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v6.31.0
rev: v7.0.0
hooks:
- id: cspell
name: Spell check with cspell

- repo: https://github.com/Lucas-C/pre-commit-hooks.git
rev: v1.5.1
rev: v1.5.4
hooks:
- id: remove-tabs

Expand Down Expand Up @@ -130,7 +130,7 @@ repos:
types: [file, yaml]

- repo: https://github.com/PyCQA/flake8.git
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
language_version: python3
Expand All @@ -140,12 +140,12 @@ repos:

- repo: https://github.com/asottile/pyupgrade
# keep it after flake8
rev: v3.9.0
rev: v3.10.1
hooks:
- id: pyupgrade
args: ["--py39-plus"]
- repo: https://github.com/pre-commit/mirrors-mypy.git
rev: v1.4.1
rev: v1.5.1
hooks:
- id: mypy
additional_dependencies:
Expand All @@ -161,7 +161,7 @@ repos:
- types-typed-ast

- repo: https://github.com/pycqa/pylint.git
rev: v3.0.0a6
rev: v3.0.0a7
hooks:
- id: pylint
args:
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ disable = [
"E0604", # invalid-all-object / ruff PLE0604
"E0605", # invalid-all-format / ruff PLE0605
"E0711", # notimplemented-raised / ruff F901
"E1133", # not-an-iterable
"E1142", # await-outside-async / ruff PLE1142
"E1205", # logging-too-many-args / ruff PLE1205
"E1206", # logging-too-few-args / ruff PLE1206
Expand Down Expand Up @@ -320,7 +321,13 @@ ignore = [
'PTH120', # `os.path.dirname()` should be replaced by `Path.parent`
'PTH122', # `os.path.splitext()` should be replaced by `Path.suffix`
'PTH123', # `open()` should be replaced by `Path.open()`
'PTH204', # `os.path.getmtime` should be replaced by `Path.stat().st_mtime`
'PTH207', # Replace `glob` with `Path.glob` or `Path.rglob`
'PYI021', # Docstrings should not be included in stubs
'PYI024', # Use `typing.NamedTuple` instead of `collections.namedtuple`
'PYI034', # `__enter__` methods in classes like `TmuxSession` usually return `self` at runtime
'PYI036', # The first argument in `__exit__` should be annotated with `object` or `type[BaseException] | None`
'PYI041', # Use `float` instead of `int | float`
'RET501', # [*] Do not explicitly `return None` in function if it is the only possible return value
'RET503', # [*] Missing explicit `return` at the end of function able to return non-`None` value
'RET504', # Unnecessary variable assignment before `return` statement
Expand Down
4 changes: 2 additions & 2 deletions src/ansible_navigator/actions/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ def _parse_and_merge(self, list_output, dump_output) -> None:
current = extracted.groupdict()["current"]
try:
if isinstance(source, dict):
parsed[variable]["source"] = list(source.keys())[0]
parsed[variable]["via"] = list(source.values())[0]
parsed[variable]["source"] = next(iter(source.keys()))
parsed[variable]["via"] = next(iter(source.values()))
else:
parsed[variable]["source"] = source
parsed[variable]["via"] = source
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/actions/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ def write_artifact(self, filename: str | None = None) -> None:
status, status_color = self._get_status()
playbook = self._args.playbook
if self._playbook_type == "fqcn" and len(self._plays.value) > 0:
playbook = [k["playbook"] for k in self._plays.value][0]
playbook = next(k["playbook"] for k in self._plays.value)
filename = filename or self._args.playbook_artifact_save_as
filename = filename.format(
playbook_dir=os.path.dirname(playbook),
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def log_dependencies() -> list[LogMessage]:
pkgs = []
found = []
messages: list[LogMessage] = []
for _python_name, pkg_names in importlib_metadata.packages_distributions().items():
for pkg_names in importlib_metadata.packages_distributions().values():
for pkg_name in pkg_names:
if pkg_name not in found:
found.append(pkg_name)
Expand Down
8 changes: 4 additions & 4 deletions src/ansible_navigator/configuration_subsystem/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,14 @@ def _apply_previous_cli_to_current(self) -> None:
):
return

current_subcommand = [
current_subcommand = next(
entry.value.current for entry in self._config.entries if entry.subcommand_value is True
][0]
previous_subcommand = [
)
previous_subcommand = next(
entry.value.current
for entry in self._config.initial.entries
if entry.subcommand_value is True
][0]
)

for current_entry in self._config.entries:
# retrieve the corresponding previous entry
Expand Down
6 changes: 3 additions & 3 deletions src/ansible_navigator/data/catalog_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def process_directories(self) -> tuple[dict, list]:
if collection_directory.exists():
self._one_path(collection_directory)
self.add_pseudo_builtin()
for _collection_path, collection in self._collections.items():
for collection in self._collections.values():
self._catalog_plugins(collection)
self._catalog_roles(collection)
self._find_shadows()
Expand Down Expand Up @@ -411,7 +411,7 @@ def identify_missing(collections: dict, collection_cache: KeyValueStore) -> tupl
handled = set()
missing = []
plugin_count = 0
for _collection_path, collection in collections.items():
for collection in collections.values():
for checksum, details in collection["plugin_checksums"].items():
plugin_count += 1
if checksum not in handled:
Expand Down Expand Up @@ -575,7 +575,7 @@ def main() -> dict:
cached_checksums = collection_cache.keys()
stats["cache_length"] = len(collection_cache.keys())

for _collection_path, collection in collections.items():
for collection in collections.values():
for no_doc in set(collection["plugin_checksums"].keys()) - set(cached_checksums):
del collection["plugin_checksums"][no_doc]

Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def _python_packages(self) -> dict[str, JSONTypes]:
"""
pkgs = importlib_metadata.packages_distributions()
meta: dict[str, Any] = {}
for _python_name, pkg_names in pkgs.items():
for pkg_names in pkgs.values():
for pkg_name in pkg_names:
if pkg_name not in meta:
meta[pkg_name] = importlib_metadata.metadata(pkg_name).json
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/utils/dot_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def place_at_path(
behaviors: tuple[MergeBehaviors, ...],
content: dict,
path: str,
value: bool | int | list | float | str | list | dict,
value: bool | int | list | float | str | dict,
) -> dict:
"""Place a value at a path in a dictionary.
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/diagnostics/test_from_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test(
assert diagnostics["settings_file"]["contents"] == settings_file
local_env_vars = diagnostics["local_system"]["details"]["environment_variables"]
assert local_env_vars["details"]["ANSIBLE_NAVIGATOR_CONFIG"] == str(settings_path)
for _section_name, section in diagnostics.items():
for section in diagnostics.values():
assert not section.get("errors")

# Test the file permissions as well since diagnostics takes time to run
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/utils/test_dot_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Scenario(BaseScenario): # pylint: disable=too-many-instance-attributes
comment: str
path: str
expected: MutableMapping | None
value: bool | int | list | float | str | list | dict = ""
value: bool | int | list | float | str | dict = ""
content: dict = field(default_factory=lambda: base_dict)
new_path: str = ""

Expand Down

0 comments on commit 9405c06

Please sign in to comment.