def requests_cache_filename(subname: str) -> str: cache_dir = platformdirs.user_cache_path(appname=__package__) / 'requests_cache' cache_dir.mkdir(parents=True, exist_ok=True) return str(cache_dir / subname)
from __future__ import annotations import logging import os import sys from pathlib import Path from platformdirs import user_cache_path from platformdirs import user_config_path from platformdirs import user_data_path logger = logging.getLogger(__name__) CACHE_DIR = user_cache_path("pypoetry", appauthor=False) CONFIG_DIR = user_config_path("pypoetry", appauthor=False, roaming=True) REPOSITORY_CACHE_DIR = CACHE_DIR / "cache" / "repositories" # platformdirs 2.0.0 corrected the OSX/macOS config directory from # /Users/<user>/Library/Application Support/<appname> to # /Users/<user>/Library/Preferences/<appname>. # # For now we only deprecate use of the old directory. if sys.platform == "darwin": _LEGACY_CONFIG_DIR = CONFIG_DIR.parent.parent / "Application Support" / "pypoetry" config_toml = _LEGACY_CONFIG_DIR / "config.toml" auth_toml = _LEGACY_CONFIG_DIR / "auth.toml" if any(file.exists() for file in (auth_toml, config_toml)): logger.warn(
import logging import os import sys from pathlib import Path from platformdirs import user_cache_path from platformdirs import user_config_path from platformdirs import user_data_path logger = logging.getLogger(__name__) _APP_NAME = "pypoetry" DEFAULT_CACHE_DIR = user_cache_path(_APP_NAME, appauthor=False) CONFIG_DIR = Path( os.getenv("POETRY_CONFIG_DIR") or user_config_path(_APP_NAME, appauthor=False, roaming=True)) # platformdirs 2.0.0 corrected the OSX/macOS config directory from # /Users/<user>/Library/Application Support/<appname> to # /Users/<user>/Library/Preferences/<appname>. # # For now we only deprecate use of the old directory. if sys.platform == "darwin": _LEGACY_CONFIG_DIR = CONFIG_DIR.parent.parent / "Application Support" / _APP_NAME config_toml = _LEGACY_CONFIG_DIR / "config.toml" auth_toml = _LEGACY_CONFIG_DIR / "auth.toml" if any(file.exists() for file in (auth_toml, config_toml)):
"aarch64", "ppc64le", "s390x", "pypy_aarch64", "pypy_i686", ) MUSLLINUX_ARCHS: Final = ( "x86_64", "i686", "aarch64", "ppc64le", "s390x", ) DEFAULT_CIBW_CACHE_PATH: Final = user_cache_path(appname="cibuildwheel", appauthor="pypa") CIBW_CACHE_PATH: Final = Path( os.environ.get("CIBW_CACHE_PATH", DEFAULT_CIBW_CACHE_PATH)).resolve() IS_WIN: Final = sys.platform.startswith("win") @overload def call( *args: PathOrStr, env: Optional[Dict[str, str]] = None, cwd: Optional[PathOrStr] = None, capture_stdout: Literal[False] = ..., ) -> None: ...
def __init__(self, context): self.cache_dir = user_cache_path("docstrfmt", version=__version__) self.context = context self.cache = self.read_cache()