|
8 | 8 | import json |
9 | 9 | from hashlib import md5 |
10 | 10 | from pathlib import Path |
11 | | -from typing import Optional |
12 | 11 |
|
13 | 12 | # 3rd party |
14 | 13 | from mkdocs.config.defaults import MkDocsConfig |
@@ -48,7 +47,7 @@ class IntegrationMaterialSocialCards(IntegrationMaterialThemeBase): |
48 | 47 | IS_ENABLED: bool = True |
49 | 48 | IS_SOCIAL_PLUGIN_ENABLED: bool = True |
50 | 49 | IS_SOCIAL_PLUGIN_CARDS_ENABLED: bool = True |
51 | | - CARDS_MANIFEST: Optional[dict] = None |
| 50 | + CARDS_MANIFEST: dict | None = None |
52 | 51 |
|
53 | 52 | def __init__(self, mkdocs_config: MkDocsConfig, switch_force: bool = True) -> None: |
54 | 53 | """Integration instantiation. |
@@ -107,7 +106,7 @@ def __init__(self, mkdocs_config: MkDocsConfig, switch_force: bool = True) -> No |
107 | 106 | self.site_description = mkdocs_config.site_description or "" |
108 | 107 |
|
109 | 108 | def is_social_plugin_enabled_mkdocs( |
110 | | - self, mkdocs_config: Optional[MkDocsConfig] = None |
| 109 | + self, mkdocs_config: MkDocsConfig | None = None |
111 | 110 | ) -> bool: |
112 | 111 | """Check if social plugin is installed and enabled. |
113 | 112 |
|
@@ -184,7 +183,7 @@ def is_social_plugin_enabled_page( |
184 | 183 | "cards", fallback_value |
185 | 184 | ) |
186 | 185 |
|
187 | | - def load_cache_cards_manifest(self) -> Optional[dict]: |
| 186 | + def load_cache_cards_manifest(self) -> dict | None: |
188 | 187 | """Load social cards manifest if the file exists. |
189 | 188 |
|
190 | 189 | Returns: |
@@ -262,8 +261,8 @@ def get_social_cards_cache_dir(self, mkdocs_config: MkDocsConfig) -> Path: |
262 | 261 | return self.social_cards_cache_dir |
263 | 262 |
|
264 | 263 | def get_social_card_build_path_for_page( |
265 | | - self, mkdocs_page: MkdocsPageSubset, mkdocs_site_dir: Optional[str] = None |
266 | | - ) -> Optional[Path]: |
| 264 | + self, mkdocs_page: MkdocsPageSubset, mkdocs_site_dir: str | None = None |
| 265 | + ) -> Path | None: |
267 | 266 | """Get social card path in Mkdocs build dir for a specific page. |
268 | 267 |
|
269 | 268 | Args: |
@@ -305,7 +304,7 @@ def get_social_card_build_path_for_page( |
305 | 304 |
|
306 | 305 | def get_social_card_cache_path_for_page( |
307 | 306 | self, mkdocs_page: MkdocsPageSubset |
308 | | - ) -> Optional[Path]: |
| 307 | + ) -> Path | None: |
309 | 308 | """Get social card path in social plugin cache folder for a specific page. |
310 | 309 |
|
311 | 310 | Note: |
@@ -377,7 +376,7 @@ def get_social_card_cache_path_for_page( |
377 | 376 | def get_social_card_url_for_page( |
378 | 377 | self, |
379 | 378 | mkdocs_page: MkdocsPageSubset, |
380 | | - mkdocs_site_url: Optional[str] = None, |
| 379 | + mkdocs_site_url: str | None = None, |
381 | 380 | ) -> str: |
382 | 381 | """Get social card URL for a specific page in documentation. |
383 | 382 |
|
|
0 commit comments