diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5e5a5fe..c3856aa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,15 +4,23 @@ repos: hooks: - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: [ "tomli>=2.0.1" ] + - repo: https://github.com/PyCQA/docformatter + rev: v1.7.5 + hooks: + - id: docformatter + additional_dependencies: [ "tomli>=2.0.1" ] + args: [ "--in-place", "--config", "./pyproject.toml" ] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.1.14" + rev: "v0.1.15" hooks: + - id: ruff-format - id: ruff - args: [--fix, --exit-non-zero-on-fix] - - repo: https://github.com/psf/black - rev: 24.1.1 - hooks: - - id: black + args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix" ] - repo: https://github.com/tox-dev/tox-ini-fmt rev: "1.3.1" hooks: @@ -22,7 +30,7 @@ repos: rev: "1.7.0" hooks: - id: pyproject-fmt - additional_dependencies: ["tox>=4.11.4"] + additional_dependencies: ["tox>=4.12.1"] - repo: meta hooks: - id: check-hooks-apply diff --git a/CHANGES.rst b/CHANGES.rst index 3fa20cc..4377e2f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -182,7 +182,7 @@ appdirs 1.4.0 (2017-08-17) - [PR #42] AppAuthor is now optional on Windows - [issue 41] Support Jython on Windows, Mac, and Unix-like platforms. Windows support requires `JNA `_. -- [PR #44] Fix incorrect behaviour of the site_config_dir method +- [PR #44] Fix incorrect behavior of the site_config_dir method appdirs 1.3.0 (2014-04-22) -------------------------- @@ -190,7 +190,7 @@ appdirs 1.3.0 (2014-04-22) everybody - [Unix] Removes gratuitous case mangling of the case, since \*nix-es are usually case sensitive, so mangling is not wise -- [Unix] Fixes the utterly wrong behaviour in ``site_data_dir``, return result +- [Unix] Fixes the utterly wrong behavior in ``site_data_dir``, return result based on XDG_DATA_DIRS and make room for respecting the standard which specifies XDG_DATA_DIRS is a multiple-value variable - [Issue 6] Add ``*_config_dir`` which are distinct on nix-es, according to @@ -210,7 +210,7 @@ appdirs 1.1.0 (2010-09-02) - [Unix, issue 2, issue 7] appdirs now conforms to `XDG base directory spec `_. - [Mac, issue 5] Fix ``site_data_dir()`` on Mac. -- [Mac] Drop use of 'Carbon' module in favour of hardcoded paths; supports +- [Mac] Drop use of 'Carbon' module in favor of hardcoded paths; supports Python3 now. - [Windows] Append "Cache" to ``user_cache_dir`` on Windows by default. Use ``opinion=False`` option to disable this. @@ -225,10 +225,10 @@ appdirs 1.1.0 (2010-09-02) - [Linux] Change default ``user_cache_dir()`` on Linux to be singular, e.g. "~/.superapp/cache". - [Windows] Add ``roaming`` option to ``user_data_dir()`` (for use on Windows only) - and change the default ``user_data_dir`` behaviour to use a *non*-roaming + and change the default ``user_data_dir`` behavior to use a *non*-roaming profile dir (``CSIDL_LOCAL_APPDATA`` instead of ``CSIDL_APPDATA``). Why? Because a large roaming profile can cause login speed issues. The "only syncs on - logout" behaviour can cause surprises in appdata info. + logout" behavior can cause surprises in appdata info. appdirs 1.0.1 (never released) @@ -236,8 +236,5 @@ appdirs 1.0.1 (never released) Started this changelog 27 July 2010. Before that this module originated in the `Komodo `_ product as ``applib.py`` and then -as `applib/location.py -`_ (used by -`PyPM `_ in `ActivePython -`_). This is basically a fork of -applib.py 1.0.1 and applib/location.py 1.0.1. +as ``applib/location.py`` (used by `PyPM `_ in `ActivePython +`_). This is basically a fork of applib.py 1.0.1 and applib/location.py 1.0.1. diff --git a/docs/conf.py b/docs/conf.py index 2317c21..eb9b10e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,6 @@ # noqa: INP001 """Configuration for Sphinx.""" + from __future__ import annotations from datetime import datetime, timezone diff --git a/pyproject.toml b/pyproject.toml index b35c39e..3e051c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,33 +67,47 @@ build.hooks.vcs.version-file = "src/platformdirs/version.py" build.targets.sdist.include = ["/src", "/tests", "/tox.ini"] version.source = "vcs" -[tool.black] -line-length = 120 - [tool.ruff] select = ["ALL"] line-length = 120 target-version = "py38" -isort = {known-first-party = ["platformdirs", "tests"], required-imports = ["from __future__ import annotations"]} +isort = { known-first-party = ["platformdirs", "tests"], required-imports = ["from __future__ import annotations"] } ignore = [ - "ANN101", # Missing type annotation for `self` in method - "D301", # Use `r"""` if any backslashes in a docstring - "D205", # 1 blank line required between summary line and description - "D401", # First line of docstring should be in imperative mood - "D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible - "D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible - "S104", # Possible binding to all interface + "ANN101", # Missing type annotation for `self` in method + "D301", # Use `r"""` if any backslashes in a docstring + "D205", # 1 blank line required between summary line and description + "D401", # The first line of docstring should be in imperative mood + "D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible + "D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible + "S104", # Possible binding to all interfaces + "CPY", # no copyright notices ] +format.preview = true +lint.preview = true [tool.ruff.per-file-ignores] "tests/**/*.py" = [ - "S101", # asserts allowed in tests... - "FBT", # don"t care about booleans as positional arguments in tests - "INP001", # no implicit namespace - "D", # don"t care about documentation in tests - "S603", # `subprocess` call: check for execution of untrusted input - "PLR2004", # Magic value used in comparison, consider replacing with a constant variable + "S101", # asserts allowed in tests... + "FBT", # don"t care about booleans as positional arguments in tests + "INP001", # no implicit namespace + "D", # don't care about documentation in tests + "S603", # `subprocess` call: check for execution of untrusted input + "PLR2004", # Magic value used in comparison, consider replacing with a constant variable + "PLC2701", # Private name import + "PLR0917", # Too many positional arguments ] +[tool.codespell] +builtin = "clear,usage,en-GB_to_en-US" +count = true +quiet-level = 3 + +[tool.docformatter] +blank = true +recursive = true +pre-summary-newline = true +wrap-descriptions = 120 +wrap-summaries = 120 + [tool.coverage] html.show_contexts = true html.skip_covered = false diff --git a/src/platformdirs/__init__.py b/src/platformdirs/__init__.py index 75c8bff..3f7d949 100644 --- a/src/platformdirs/__init__.py +++ b/src/platformdirs/__init__.py @@ -1,6 +1,8 @@ """ -Utilities for determining application-specific dirs. See for details and -usage. +Utilities for determining application-specific dirs. + +See for details and usage. + """ from __future__ import annotations @@ -20,22 +22,22 @@ def _set_platform_dir_class() -> type[PlatformDirsABC]: if sys.platform == "win32": - from platformdirs.windows import Windows as Result + from platformdirs.windows import Windows as Result # noqa: PLC0415 elif sys.platform == "darwin": - from platformdirs.macos import MacOS as Result + from platformdirs.macos import MacOS as Result # noqa: PLC0415 else: - from platformdirs.unix import Unix as Result + from platformdirs.unix import Unix as Result # noqa: PLC0415 if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system": if os.getenv("SHELL") or os.getenv("PREFIX"): return Result - from platformdirs.android import _android_folder + from platformdirs.android import _android_folder # noqa: PLC0415 if _android_folder() is not None: - from platformdirs.android import Android + from platformdirs.android import Android # noqa: PLC0415 - return Android # return to avoid redefinition of result + return Android # return to avoid redefinition of a result return Result @@ -507,7 +509,7 @@ def user_log_path( def user_documents_path() -> Path: - """:returns: documents path tied to the user""" + """:returns: documents a path tied to the user""" return PlatformDirs().user_documents_path @@ -585,41 +587,41 @@ def site_runtime_path( __all__ = [ - "__version__", - "__version_info__", - "PlatformDirs", "AppDirs", + "PlatformDirs", "PlatformDirsABC", - "user_data_dir", - "user_config_dir", - "user_cache_dir", - "user_state_dir", - "user_log_dir", - "user_documents_dir", - "user_downloads_dir", - "user_pictures_dir", - "user_videos_dir", - "user_music_dir", - "user_desktop_dir", - "user_runtime_dir", - "site_data_dir", - "site_config_dir", + "__version__", + "__version_info__", "site_cache_dir", + "site_cache_path", + "site_config_dir", + "site_config_path", + "site_data_dir", + "site_data_path", "site_runtime_dir", - "user_data_path", - "user_config_path", + "site_runtime_path", + "user_cache_dir", "user_cache_path", - "user_state_path", - "user_log_path", + "user_config_dir", + "user_config_path", + "user_data_dir", + "user_data_path", + "user_desktop_dir", + "user_desktop_path", + "user_documents_dir", "user_documents_path", + "user_downloads_dir", "user_downloads_path", - "user_pictures_path", - "user_videos_path", + "user_log_dir", + "user_log_path", + "user_music_dir", "user_music_path", - "user_desktop_path", + "user_pictures_dir", + "user_pictures_path", + "user_runtime_dir", "user_runtime_path", - "site_data_path", - "site_config_path", - "site_cache_path", - "site_runtime_path", + "user_state_dir", + "user_state_path", + "user_videos_dir", + "user_videos_path", ] diff --git a/src/platformdirs/__main__.py b/src/platformdirs/__main__.py index 4bf27c9..922c521 100644 --- a/src/platformdirs/__main__.py +++ b/src/platformdirs/__main__.py @@ -24,7 +24,7 @@ def main() -> None: - """Run main entry point.""" + """Run the main entry point.""" app_name = "MyApp" app_author = "MyCompany" diff --git a/src/platformdirs/android.py b/src/platformdirs/android.py index 4acdb63..fefafd3 100644 --- a/src/platformdirs/android.py +++ b/src/platformdirs/android.py @@ -13,10 +13,11 @@ class Android(PlatformDirsABC): """ - Follows the guidance `from here `_. Makes use of the - `appname `, - `version `, - `ensure_exists `. + Follows the guidance `from here `_. + + Makes use of the `appname `, `version + `, `ensure_exists `. + """ @property @@ -44,7 +45,7 @@ def site_config_dir(self) -> str: @property def user_cache_dir(self) -> str: - """:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``""" + """:return: cache directory tied to the user, e.g.,``/data/user///cache/``""" return self._append_app_name_and_version(cast(str, _android_folder()), "cache") @property @@ -119,13 +120,13 @@ def site_runtime_dir(self) -> str: def _android_folder() -> str | None: """:return: base folder for the Android OS or None if it cannot be found""" try: - # First try to get path to android app via pyjnius - from jnius import autoclass + # First try to get a path to android app via pyjnius + from jnius import autoclass # noqa: PLC0415 context = autoclass("android.content.Context") result: str | None = context.getFilesDir().getParentFile().getAbsolutePath() except Exception: # noqa: BLE001 - # if fails find an android folder looking path on the sys.path + # if fails find an android folder looking a path on the sys.path pattern = re.compile(r"/data/(data|user/\d+)/(.+)/files") for path in sys.path: if pattern.match(path): @@ -141,7 +142,7 @@ def _android_documents_folder() -> str: """:return: documents folder for the Android OS""" # Get directories with pyjnius try: - from jnius import autoclass + from jnius import autoclass # noqa: PLC0415 context = autoclass("android.content.Context") environment = autoclass("android.os.Environment") @@ -157,7 +158,7 @@ def _android_downloads_folder() -> str: """:return: downloads folder for the Android OS""" # Get directories with pyjnius try: - from jnius import autoclass + from jnius import autoclass # noqa: PLC0415 context = autoclass("android.content.Context") environment = autoclass("android.os.Environment") @@ -173,7 +174,7 @@ def _android_pictures_folder() -> str: """:return: pictures folder for the Android OS""" # Get directories with pyjnius try: - from jnius import autoclass + from jnius import autoclass # noqa: PLC0415 context = autoclass("android.content.Context") environment = autoclass("android.os.Environment") @@ -189,7 +190,7 @@ def _android_videos_folder() -> str: """:return: videos folder for the Android OS""" # Get directories with pyjnius try: - from jnius import autoclass + from jnius import autoclass # noqa: PLC0415 context = autoclass("android.content.Context") environment = autoclass("android.os.Environment") @@ -205,7 +206,7 @@ def _android_music_folder() -> str: """:return: music folder for the Android OS""" # Get directories with pyjnius try: - from jnius import autoclass + from jnius import autoclass # noqa: PLC0415 context = autoclass("android.content.Context") environment = autoclass("android.os.Environment") diff --git a/src/platformdirs/api.py b/src/platformdirs/api.py index 031a38a..ba0018e 100644 --- a/src/platformdirs/api.py +++ b/src/platformdirs/api.py @@ -11,10 +11,10 @@ from typing import Iterator, Literal -class PlatformDirsABC(ABC): +class PlatformDirsABC(ABC): # noqa: PLR0904 """Abstract base class for platform directories.""" - def __init__( # noqa: PLR0913 + def __init__( # noqa: PLR0913, PLR0917 self, appname: str | None = None, appauthor: str | None | Literal[False] = None, @@ -34,34 +34,47 @@ def __init__( # noqa: PLR0913 :param multipath: See `multipath`. :param opinion: See `opinion`. :param ensure_exists: See `ensure_exists`. + """ self.appname = appname #: The name of application. self.appauthor = appauthor """ - The name of the app author or distributing body for this application. Typically, it is the owning company name. - Defaults to `appname`. You may pass ``False`` to disable it. + The name of the app author or distributing body for this application. + + Typically, it is the owning company name. Defaults to `appname`. You may pass ``False`` to disable it. + """ self.version = version """ - An optional version path element to append to the path. You might want to use this if you want multiple versions - of your app to be able to run independently. If used, this would typically be ``.``. + An optional version path element to append to the path. + + You might want to use this if you want multiple versions of your app to be able to run independently. If used, + this would typically be ``.``. + """ self.roaming = roaming """ - Whether to use the roaming appdata directory on Windows. That means that for users on a Windows network setup - for roaming profiles, this user data will be synced on login (see + Whether to use the roaming appdata directory on Windows. + + That means that for users on a Windows network setup for roaming profiles, this user data will be synced on + login (see `here `_). + """ self.multipath = multipath """ An optional parameter which indicates that the entire list of data dirs should be returned. + By default, the first item would only be returned. + """ self.opinion = opinion #: A flag to indicating to use opinionated values. self.ensure_exists = ensure_exists """ Optionally create the directory (and any missing parents) upon access if it does not exist. + By default, no directories are created. + """ def _append_app_name_and_version(self, *base: str) -> str: @@ -200,7 +213,7 @@ def user_log_path(self) -> Path: @property def user_documents_path(self) -> Path: - """:return: documents path tied to the user""" + """:return: documents a path tied to the user""" return Path(self.user_documents_dir) @property diff --git a/src/platformdirs/macos.py b/src/platformdirs/macos.py index b7b4880..eb1ba5d 100644 --- a/src/platformdirs/macos.py +++ b/src/platformdirs/macos.py @@ -10,11 +10,14 @@ class MacOS(PlatformDirsABC): """ - Platform directories for the macOS operating system. Follows the guidance from `Apple documentation - `_. + Platform directories for the macOS operating system. + + Follows the guidance from + `Apple documentation `_. Makes use of the `appname `, `version `, `ensure_exists `. + """ @property @@ -28,7 +31,7 @@ def site_data_dir(self) -> str: :return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``. If we're using a Python binary managed by `Homebrew `_, the directory will be under the Homebrew prefix, e.g. ``/opt/homebrew/share/$appname/$version``. - If `multipath ` is enabled and we're in Homebrew, + If `multipath ` is enabled, and we're in Homebrew, the response is a multi-path string separated by ":", e.g. ``/opt/homebrew/share/$appname/$version:/Library/Application Support/$appname/$version`` """ @@ -60,7 +63,7 @@ def site_cache_dir(self) -> str: :return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``. If we're using a Python binary managed by `Homebrew `_, the directory will be under the Homebrew prefix, e.g. ``/opt/homebrew/var/cache/$appname/$version``. - If `multipath ` is enabled and we're in Homebrew, + If `multipath ` is enabled, and we're in Homebrew, the response is a multi-path string separated by ":", e.g. ``/opt/homebrew/var/cache/$appname/$version:/Library/Caches/$appname/$version`` """ diff --git a/src/platformdirs/unix.py b/src/platformdirs/unix.py index ca4728e..bee1b8b 100644 --- a/src/platformdirs/unix.py +++ b/src/platformdirs/unix.py @@ -20,17 +20,17 @@ def getuid() -> int: from os import getuid -class Unix(PlatformDirsABC): +class Unix(PlatformDirsABC): # noqa: PLR0904 """ - On Unix/Linux, we follow the - `XDG Basedir Spec `_. The spec allows - overriding directories with environment variables. The examples show are the default values, alongside the name of - the environment variable that overrides them. Makes use of the - `appname `, - `version `, - `multipath `, - `opinion `, - `ensure_exists `. + On Unix/Linux, we follow the `XDG Basedir Spec `_. + + The spec allows overriding directories with environment variables. The examples show are the default values, + alongside the name of the environment variable that overrides them. Makes use of the `appname + `, `version `, `multipath + `, `opinion `, `ensure_exists + `. + """ @property @@ -205,17 +205,17 @@ def site_runtime_dir(self) -> str: @property def site_data_path(self) -> Path: - """:return: data path shared by users. Only return first item, even if ``multipath`` is set to ``True``""" + """:return: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``""" return self._first_item_as_path_if_multipath(self.site_data_dir) @property def site_config_path(self) -> Path: - """:return: config path shared by the users. Only return first item, even if ``multipath`` is set to ``True``""" + """:return: config path shared by the users, returns the first item, even if ``multipath`` is set to ``True``""" return self._first_item_as_path_if_multipath(self.site_config_dir) @property def site_cache_path(self) -> Path: - """:return: cache path shared by users. Only return first item, even if ``multipath`` is set to ``True``""" + """:return: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``""" return self._first_item_as_path_if_multipath(self.site_cache_dir) def _first_item_as_path_if_multipath(self, directory: str) -> Path: @@ -246,7 +246,12 @@ def _get_user_media_dir(env_var: str, fallback_tilde_path: str) -> str: def _get_user_dirs_folder(key: str) -> str | None: - """Return directory from user-dirs.dirs config file. See https://freedesktop.org/wiki/Software/xdg-user-dirs/.""" + """ + Return directory from user-dirs.dirs config file. + + See https://freedesktop.org/wiki/Software/xdg-user-dirs/. + + """ user_dirs_config_path = Path(Unix().user_config_dir) / "user-dirs.dirs" if user_dirs_config_path.exists(): parser = ConfigParser() diff --git a/src/platformdirs/windows.py b/src/platformdirs/windows.py index c62d0c8..a4a13ea 100644 --- a/src/platformdirs/windows.py +++ b/src/platformdirs/windows.py @@ -16,15 +16,14 @@ class Windows(PlatformDirsABC): """ - `MSDN on where to store app data files - `_. - Makes use of the - `appname `, - `appauthor `, - `version `, - `roaming `, - `opinion `, - `ensure_exists `. + `MSDN on where to store app data files `_. + + Makes use of the `appname `, `appauthor + `, `version `, `roaming + `, `opinion `, `ensure_exists + `. + """ @property @@ -165,7 +164,7 @@ def get_win_folder_from_env_vars(csidl_name: str) -> str: def get_win_folder_if_csidl_name_not_env_var(csidl_name: str) -> str | None: - """Get folder for a CSIDL name that does not exist as an environment variable.""" + """Get a folder for a CSIDL name that does not exist as an environment variable.""" if csidl_name == "CSIDL_PERSONAL": return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Documents") # noqa: PTH118 @@ -189,6 +188,7 @@ def get_win_folder_from_registry(csidl_name: str) -> str: This is a fallback technique at best. I'm not sure if using the registry for these guarantees us the correct answer for all CSIDL_* names. + """ shell_folder_name = { "CSIDL_APPDATA": "AppData", @@ -205,7 +205,7 @@ def get_win_folder_from_registry(csidl_name: str) -> str: raise ValueError(msg) if sys.platform != "win32": # only needed for mypy type checker to know that this code runs only on Windows raise NotImplementedError - import winreg + import winreg # noqa: PLC0415 key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders") directory, _ = winreg.QueryValueEx(key, shell_folder_name) @@ -253,7 +253,7 @@ def _pick_get_win_folder() -> Callable[[str], str]: if hasattr(ctypes, "windll"): return get_win_folder_via_ctypes try: - import winreg # noqa: F401 + import winreg # noqa: PLC0415, F401 except ImportError: return get_win_folder_from_env_vars else: diff --git a/tests/test_android.py b/tests/test_android.py index 87fa98c..57ac1b5 100644 --- a/tests/test_android.py +++ b/tests/test_android.py @@ -68,13 +68,13 @@ def test_android(mocker: MockerFixture, params: dict[str, Any], func: str) -> No def test_android_folder_from_jnius(mocker: MockerFixture) -> None: - from platformdirs import PlatformDirs - from platformdirs.android import _android_folder + from platformdirs import PlatformDirs # noqa: PLC0415 + from platformdirs.android import _android_folder # noqa: PLC0415 _android_folder.cache_clear() if PlatformDirs is Android: - import jnius # pragma: no cover + import jnius # pragma: no cover # noqa: PLC0415 autoclass = mocker.spy(jnius, "autoclass") # pragma: no cover else: @@ -103,7 +103,7 @@ def test_android_folder_from_jnius(mocker: MockerFixture) -> None: def test_android_folder_from_sys_path(mocker: MockerFixture, path: str, monkeypatch: pytest.MonkeyPatch) -> None: mocker.patch.dict(sys.modules, {"jnius": MagicMock(autoclass=MagicMock(side_effect=ModuleNotFoundError))}) - from platformdirs.android import _android_folder + from platformdirs.android import _android_folder # noqa: PLC0415 _android_folder.cache_clear() monkeypatch.setattr(sys, "path", ["/A", "/B", path]) @@ -115,7 +115,7 @@ def test_android_folder_from_sys_path(mocker: MockerFixture, path: str, monkeypa def test_android_folder_not_found(mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch) -> None: mocker.patch.dict(sys.modules, {"jnius": MagicMock(autoclass=MagicMock(side_effect=ModuleNotFoundError))}) - from platformdirs.android import _android_folder + from platformdirs.android import _android_folder # noqa: PLC0415 _android_folder.cache_clear() monkeypatch.setattr(sys, "path", []) diff --git a/tests/test_api.py b/tests/test_api.py index 5c5e7d6..8f3b455 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -68,7 +68,7 @@ def test_android_active( # noqa: PLR0913 else: monkeypatch.setenv(env_var, value) - from platformdirs.android import _android_folder + from platformdirs.android import _android_folder # noqa: PLC0415 _android_folder.cache_clear() monkeypatch.setattr(sys, "path", ["/A", "/B", path]) diff --git a/tests/test_comp_with_appdirs.py b/tests/test_comp_with_appdirs.py index 89775b4..58d7ae6 100644 --- a/tests/test_comp_with_appdirs.py +++ b/tests/test_comp_with_appdirs.py @@ -11,7 +11,7 @@ def test_has_backward_compatible_class() -> None: - from platformdirs import AppDirs + from platformdirs import AppDirs # noqa: PLC0415 assert AppDirs is platformdirs.PlatformDirs diff --git a/tests/test_macos.py b/tests/test_macos.py index 551ec0f..f49d446 100644 --- a/tests/test_macos.py +++ b/tests/test_macos.py @@ -15,9 +15,7 @@ @pytest.fixture(autouse=True) def _fix_os_pathsep(mocker: MockerFixture) -> None: - """ - If we're not actually running on macOS, set `os.pathsep` to what it should be on macOS. - """ + """If we're not running on macOS, set `os.pathsep` to what it should be on macOS.""" if sys.platform != "darwin": # pragma: darwin no cover mocker.patch("os.pathsep", ":") mocker.patch("os.path.pathsep", ":") diff --git a/tests/test_main.py b/tests/test_main.py index 2c1eb90..1fc3432 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,7 +1,7 @@ from __future__ import annotations import sys -from subprocess import check_output +from subprocess import check_output # noqa: S404 from platformdirs import __version__ from platformdirs.__main__ import PROPS diff --git a/whitelist.txt b/whitelist.txt deleted file mode 100644 index ac5ecbc..0000000 --- a/whitelist.txt +++ /dev/null @@ -1,30 +0,0 @@ -appauthor -appdirs -appname -autoclass -autodoc -autosectionlabel -buf -buf2 -csidl -dcim -delenv -getuid -highbit -hkey -intersphinx -isfunction -jnius -macos -multipath -platformdirs -py38 -pygments -pyjnius -setenv -shell32 -typehints -usefixtures -win32 -winreg -xdg