diff --git a/pyproject.toml b/pyproject.toml index 10808af..365a487 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,7 @@ exclude = [ ".mypy_cache", ".ruff_cache", ] -target-version = "py311" +target-version = "py310" [tool.ruff.lint] select = [ @@ -43,11 +43,9 @@ select = [ ] [tool.pyright] -include = ["src"] -exclude = ["**/node_modules", - "**/__pycache__", - "src/experimental", - "src/typestubs" +include = ["sitemapr", "tests"] +exclude = [ + "**/__pycache__" ] -pythonVersion = "3.11" +pythonVersion = "3.10" typeCheckingMode = "strict" \ No newline at end of file diff --git a/sitemapr/core.py b/sitemapr/core.py index 7c5e1f5..e83a375 100644 --- a/sitemapr/core.py +++ b/sitemapr/core.py @@ -16,9 +16,7 @@ class SiteMapr: sitemap_base_url: The base URL for the sitemap. Defaults to None, which uses the base_url. """ - def __init__( - self, base_url: str, pages: list[Page], *, sitemap_base_url: str | None = None - ): + def __init__(self, base_url: str, pages: list[Page], *, sitemap_base_url: str | None = None): self._base_url = base_url self._sitemap_base_url = sitemap_base_url or base_url self._pages = pages @@ -63,9 +61,7 @@ def _write_index_file(self, dirname: str, idx: int) -> None: '' ) for i in range(idx + 1): - f.write( - f"{self._sitemap_base_url}/sitemap-{i}.xml" - ) + f.write(f"{self._sitemap_base_url}/sitemap-{i}.xml") f.write("") def _write_urls(self, f: TextIOWrapper, urls: list[SiteMapUrl]): @@ -98,9 +94,7 @@ def _iter_page(self, page: Page) -> Iterator[SiteMapUrl]: path_param_combinations: list[dict[str, str]] = self._get_param_combinations( page.path_params ) - for query_params, path_params in product( - query_param_combinations, path_param_combinations - ): + for query_params, path_params in product(query_param_combinations, path_param_combinations): path = page.path.format(**path_params) query_string = urlencode(query_params).replace("&", "&") loc = ( @@ -134,16 +128,12 @@ def _iter_page(self, page: Page) -> Iterator[SiteMapUrl]: priority=priority, ) - def _get_param_combinations( - self, params: list[Param] | None - ) -> list[dict[str, str]]: + def _get_param_combinations(self, params: list[Param] | None) -> list[dict[str, str]]: if not params: return [{}] combinations: list[dict[str, str]] = [] for values in product(*[param.values for param in params if param.values]): - combination = { - param.name: value for param, value in zip(params, values, strict=False) - } + combination = {param.name: value for param, value in zip(params, values, strict=False)} combinations.append(combination) return combinations diff --git a/sitemapr/models.py b/sitemapr/models.py index 1390739..7d704c9 100644 --- a/sitemapr/models.py +++ b/sitemapr/models.py @@ -5,9 +5,7 @@ T = TypeVar("T") -ChangeFreq = Literal[ - "always", "hourly", "daily", "weekly", "monthly", "yearly", "never" -] +ChangeFreq = Literal["always", "hourly", "daily", "weekly", "monthly", "yearly", "never"] CallbackFn = Callable[[str, dict[str, str], dict[str, str]], T | None]