diff --git a/pyproject.toml b/pyproject.toml index fb05d1d1c..2fd2f8910 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -302,7 +302,6 @@ ignore = [ 'PTH109', # `os.getcwd()` should be replaced by `Path.cwd()` 'PTH118', # `os.path.join()` should be replaced by `Path` with `/` operator 'PTH120', # `os.path.dirname()` should be replaced by `Path.parent` - 'PTH122', # `os.path.splitext()` should be replaced by `Path.suffix` 'RET505', # Unnecessary `else` after `return` statement 'RUF005', # [*] Consider `[self._name, *shlex.split(self._interaction.action.match.groupdict()["params"] or "")]` instead of concatenation 'RUF012', # Mutable class attributes should be annotated with `typing.ClassVar` diff --git a/src/ansible_navigator/actions/run.py b/src/ansible_navigator/actions/run.py index ad2fc2e9d..c200e012f 100644 --- a/src/ansible_navigator/actions/run.py +++ b/src/ansible_navigator/actions/run.py @@ -887,7 +887,7 @@ def write_artifact(self, filename: str | None = None) -> None: filename = filename or self._args.playbook_artifact_save_as filename = filename.format( playbook_dir=os.path.dirname(playbook), - playbook_name=os.path.splitext(Path(playbook).name)[0], + playbook_name=Path(playbook).stem, playbook_status=status, time_stamp=now_iso(self._args.time_zone), ) diff --git a/src/ansible_navigator/tm_tokenize/grammars.py b/src/ansible_navigator/tm_tokenize/grammars.py index c5ee9ba2f..3d8058797 100644 --- a/src/ansible_navigator/tm_tokenize/grammars.py +++ b/src/ansible_navigator/tm_tokenize/grammars.py @@ -49,7 +49,7 @@ def __init__(self, *directories: str) -> None: :param directories: A tuple of strings, each a directory in which grammar files can be found """ self._scope_to_files = { - os.path.splitext(filename)[0]: os.path.join(directory, filename) + Path(filename).stem: os.path.join(directory, filename) for directory in directories if Path(directory).exists() for filename in sorted(os.listdir(directory))