Skip to content

Commit

Permalink
Address ruff PTH111
Browse files Browse the repository at this point in the history
  • Loading branch information
shatakshiiii committed Jun 13, 2024
1 parent 418b94e commit 3ad6b14
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ ignore = [
'PT019', # Fixture `_mocked_func` without value is injected as parameter, use `@pytest.mark.usefixtures` instead
'PT022', # [*] No teardown in fixture `cmd_in_tty`, use `return` instead of `yield`
'PTH109', # `os.getcwd()` should be replaced by `Path.cwd()`
'PTH111', # `os.path.expanduser()` should be replaced by `Path.expanduser()`
'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`
Expand Down
2 changes: 1 addition & 1 deletion src/ansible_navigator/utils/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def generate_cache_path(app_name: str) -> Path:
:param app_name: Name of application - currently ansible_navigator
:returns: Path to the cache directory
"""
cache_home = os.environ.get("XDG_CACHE_HOME", f"{os.path.expanduser('~')}/.cache")
cache_home = os.environ.get("XDG_CACHE_HOME", f"{Path.home()}/.cache")
return Path(cache_home) / app_name


Expand Down
4 changes: 1 addition & 3 deletions tests/unit/utils/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ def test_find_many_settings_home(monkeypatch: pytest.MonkeyPatch) -> None:
:param monkeypatch: The monkeypatch fixture
"""
paths = [
os.path.join(os.path.expanduser("~"), ".ansible-navigator" + ext) for ext in EXTENSIONS
]
paths = [os.path.join(Path.home(), ".ansible-navigator" + ext) for ext in EXTENSIONS]

def check_path_exists(arg: Any) -> bool:
return str(arg) in paths
Expand Down

0 comments on commit 3ad6b14

Please sign in to comment.