|
8 | 8 | import json |
9 | 9 | from hashlib import md5 |
10 | 10 | from pathlib import Path |
| 11 | +from typing import Optional |
11 | 12 |
|
12 | 13 | # 3rd party |
13 | 14 | from mkdocs.config.defaults import MkDocsConfig |
@@ -41,7 +42,7 @@ class IntegrationMaterialSocialCards: |
41 | 42 | IS_SOCIAL_PLUGIN_CARDS_ENABLED: bool = True |
42 | 43 | IS_THEME_MATERIAL: bool = False |
43 | 44 | IS_INSIDERS: bool = False |
44 | | - CARDS_MANIFEST: dict | None = None |
| 45 | + CARDS_MANIFEST: Optional[dict] = None |
45 | 46 |
|
46 | 47 | def __init__(self, mkdocs_config: MkDocsConfig, switch_force: bool = True) -> None: |
47 | 48 | """Integration instantiation. |
@@ -103,7 +104,7 @@ def is_mkdocs_theme_material(self, mkdocs_config: MkDocsConfig) -> bool: |
103 | 104 | self.IS_THEME_MATERIAL = mkdocs_config.theme.name == "material" |
104 | 105 | return self.IS_THEME_MATERIAL |
105 | 106 |
|
106 | | - def is_mkdocs_theme_material_insiders(self) -> bool | None: |
| 107 | + def is_mkdocs_theme_material_insiders(self) -> Optional[bool]: |
107 | 108 | """Check if the material theme is community or insiders edition. |
108 | 109 |
|
109 | 110 | Returns: |
@@ -195,7 +196,7 @@ def is_social_plugin_enabled_page( |
195 | 196 | "cards", fallback_value |
196 | 197 | ) |
197 | 198 |
|
198 | | - def load_cache_cards_manifest(self) -> dict | None: |
| 199 | + def load_cache_cards_manifest(self) -> Optional[dict]: |
199 | 200 | """Load social cards manifest if the file exists. |
200 | 201 |
|
201 | 202 | Returns: |
@@ -258,8 +259,8 @@ def get_social_cards_cache_dir(self, mkdocs_config: MkDocsConfig) -> Path: |
258 | 259 | return self.social_cards_cache_dir |
259 | 260 |
|
260 | 261 | def get_social_card_build_path_for_page( |
261 | | - self, mkdocs_page: Page, mkdocs_site_dir: str | None = None |
262 | | - ) -> Path | None: |
| 262 | + self, mkdocs_page: Page, mkdocs_site_dir: Optional[str] = None |
| 263 | + ) -> Optional[Path]: |
263 | 264 | """Get social card path in Mkdocs build dir for a specific page. |
264 | 265 |
|
265 | 266 | Args: |
@@ -287,7 +288,7 @@ def get_social_card_build_path_for_page( |
287 | 288 | logger.debug(f"Not found: {expected_built_card_path}") |
288 | 289 | return None |
289 | 290 |
|
290 | | - def get_social_card_cache_path_for_page(self, mkdocs_page: Page) -> Path | None: |
| 291 | + def get_social_card_cache_path_for_page(self, mkdocs_page: Page) -> Optional[Path]: |
291 | 292 | """Get social card path in social plugin cache folder for a specific page. |
292 | 293 |
|
293 | 294 | Note: |
@@ -346,7 +347,7 @@ def get_social_card_cache_path_for_page(self, mkdocs_page: Page) -> Path | None: |
346 | 347 | def get_social_card_url_for_page( |
347 | 348 | self, |
348 | 349 | mkdocs_page: Page, |
349 | | - mkdocs_site_url: str | None = None, |
| 350 | + mkdocs_site_url: Optional[str] = None, |
350 | 351 | ) -> str: |
351 | 352 | """Get social card URL for a specific page in documentation. |
352 | 353 |
|
|
0 commit comments