Skip to content

Commit 0704046

Browse files
committed
Fixed compatibility with Python < 3.10
1 parent 9f3efb8 commit 0704046

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

material/plugins/blog/structure/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1919
# IN THE SOFTWARE.
2020

21+
from __future__ import annotations
22+
2123
import logging
2224
import os
2325
import yaml
@@ -33,7 +35,6 @@
3335
from mkdocs.structure.toc import get_toc
3436
from mkdocs.utils.meta import YAML_RE
3537
from re import Match
36-
from typing import Union
3738
from yaml import SafeLoader
3839

3940
from .config import PostConfig
@@ -205,7 +206,7 @@ class View(Page):
205206
# Initialize view
206207
def __init__(self, title: str | None, file: File, config: MkDocsConfig):
207208
super().__init__(title, file, config)
208-
self.parent: Union[View, Section]
209+
self.parent: View | Section
209210

210211
# Initialize posts and views
211212
self.posts: list[Post] = []

material/plugins/blog/templates/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# Filter for normalizing URLs with support for paginated views
3131
@pass_context
32-
def url_filter(context: Context, url: str | None):
32+
def url_filter(context: Context, url: str):
3333
page = context["page"]
3434

3535
# If the current page is a view, check if the URL links to the page

src/plugins/blog/structure/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1919
# IN THE SOFTWARE.
2020

21+
from __future__ import annotations
22+
2123
import logging
2224
import os
2325
import yaml
@@ -33,7 +35,6 @@
3335
from mkdocs.structure.toc import get_toc
3436
from mkdocs.utils.meta import YAML_RE
3537
from re import Match
36-
from typing import Union
3738
from yaml import SafeLoader
3839

3940
from .config import PostConfig
@@ -205,7 +206,7 @@ class View(Page):
205206
# Initialize view
206207
def __init__(self, title: str | None, file: File, config: MkDocsConfig):
207208
super().__init__(title, file, config)
208-
self.parent: Union[View, Section]
209+
self.parent: View | Section
209210

210211
# Initialize posts and views
211212
self.posts: list[Post] = []

src/plugins/blog/templates/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# Filter for normalizing URLs with support for paginated views
3131
@pass_context
32-
def url_filter(context: Context, url: str | None):
32+
def url_filter(context: Context, url: str):
3333
page = context["page"]
3434

3535
# If the current page is a view, check if the URL links to the page

0 commit comments

Comments
 (0)