Skip to content

Commit 8509de0

Browse files
committed
Revert "Drop support for Python 3.9"
This reverts commit 6e7e486.
1 parent 1b31ccc commit 8509de0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+860
-765
lines changed

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
py-ver-major: [3]
23-
py-ver-minor: [10, 11, 12, 13, 14]
23+
py-ver-minor: [9, 10, 11, 12, 13, 14]
2424
fail-fast: false
2525

2626
env:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Style guide:
2-
- Python 3.10+ compatible code
2+
- Python 3.9+ compatible code
33
- PEP-484 type hints
44
- Prefer new style format strings https://pyformat.info/
55
- Use ``make format`` to format your code

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ bandit:
205205
bandit --recursive --exclude schema_salad/tests/ schema_salad
206206

207207
pyupgrade: $(filter-out schema_salad/metaschema.py,$(PYSOURCES))
208-
pyupgrade --exit-zero-even-if-changed --py310-plus $^
208+
pyupgrade --exit-zero-even-if-changed --py39-plus $^
209209
auto-walrus $^
210210

211211
release-test: FORCE

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ generation, and transformation to RDF_. Salad provides a bridge
2323
between document and record oriented data modeling and the Semantic
2424
Web.
2525

26-
The Schema Salad library is Python 3.10+ only.
26+
The Schema Salad library is Python 3.9+ only.
2727

2828
Installation
2929
------------

mypy-stubs/mistune/__init__.pyi

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from collections.abc import Iterable
2-
from typing import Any, Literal, TypeAlias
1+
from typing import Any, Dict, Iterable, List, Optional, Union
2+
3+
from typing_extensions import Literal
34

45
from .block_parser import BlockParser as BlockParser
56
from .core import BaseRenderer as BaseRenderer
@@ -31,20 +32,20 @@ __all__ = [
3132
"markdown",
3233
]
3334

34-
RendererRef: TypeAlias = Literal["html", "ast"] | BaseRenderer
35+
RendererRef = Union[Literal["html", "ast"], BaseRenderer]
3536

3637
def create_markdown(
3738
escape: bool = True,
3839
hard_wrap: bool = False,
39-
renderer: RendererRef | None = "html",
40-
plugins: Iterable[PluginRef] | None = None,
40+
renderer: Optional[RendererRef] = "html",
41+
plugins: Optional[Iterable[PluginRef]] = None,
4142
) -> Markdown: ...
4243

4344
html: Markdown
4445

4546
def markdown(
4647
text: str,
4748
escape: bool = True,
48-
renderer: RendererRef | None = "html",
49-
plugins: Iterable[Any] | None = None,
50-
) -> str | list[dict[str, Any]]: ...
49+
renderer: Optional[RendererRef] = "html",
50+
plugins: Optional[Iterable[Any]] = None,
51+
) -> Union[str, List[Dict[str, Any]]]: ...

mypy-stubs/mistune/block_parser.pyi

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from collections.abc import Iterable
2-
from re import Match, Pattern
3-
from typing import ClassVar
1+
from typing import ClassVar, Dict, Iterable, List, Match, Optional, Pattern, Tuple
42

53
from .core import BlockState as BlockState
64
from .core import Parser as Parser
@@ -24,27 +22,29 @@ class BlockParser(Parser[BlockState]):
2422
BLANK_LINE: Pattern[str]
2523
RAW_HTML: str
2624
BLOCK_HTML: str
27-
SPECIFICATION: ClassVar[dict[str, str]]
25+
SPECIFICATION: ClassVar[Dict[str, str]]
2826
DEFAULT_RULES: ClassVar[Iterable[str]]
29-
block_quote_rules: list[str]
30-
list_rules: list[str]
27+
block_quote_rules: List[str]
28+
list_rules: List[str]
3129
max_nested_level: int
3230
def __init__(
3331
self,
34-
block_quote_rules: list[str] | None = None,
35-
list_rules: list[str] | None = None,
32+
block_quote_rules: Optional[List[str]] = None,
33+
list_rules: Optional[List[str]] = None,
3634
max_nested_level: int = 6,
3735
) -> None: ...
3836
def parse_blank_line(self, m: Match[str], state: BlockState) -> int: ...
3937
def parse_thematic_break(self, m: Match[str], state: BlockState) -> int: ...
4038
def parse_indent_code(self, m: Match[str], state: BlockState) -> int: ...
41-
def parse_fenced_code(self, m: Match[str], state: BlockState) -> int | None: ...
39+
def parse_fenced_code(self, m: Match[str], state: BlockState) -> Optional[int]: ...
4240
def parse_atx_heading(self, m: Match[str], state: BlockState) -> int: ...
43-
def parse_setex_heading(self, m: Match[str], state: BlockState) -> int | None: ...
44-
def parse_ref_link(self, m: Match[str], state: BlockState) -> int | None: ...
45-
def extract_block_quote(self, m: Match[str], state: BlockState) -> tuple[str, int | None]: ...
41+
def parse_setex_heading(self, m: Match[str], state: BlockState) -> Optional[int]: ...
42+
def parse_ref_link(self, m: Match[str], state: BlockState) -> Optional[int]: ...
43+
def extract_block_quote(
44+
self, m: Match[str], state: BlockState
45+
) -> Tuple[str, Optional[int]]: ...
4646
def parse_block_quote(self, m: Match[str], state: BlockState) -> int: ...
4747
def parse_list(self, m: Match[str], state: BlockState) -> int: ...
48-
def parse_block_html(self, m: Match[str], state: BlockState) -> int | None: ...
49-
def parse_raw_html(self, m: Match[str], state: BlockState) -> int | None: ...
50-
def parse(self, state: BlockState, rules: list[str] | None = None) -> None: ...
48+
def parse_block_html(self, m: Match[str], state: BlockState) -> Optional[int]: ...
49+
def parse_raw_html(self, m: Match[str], state: BlockState) -> Optional[int]: ...
50+
def parse(self, state: BlockState, rules: Optional[List[str]] = None) -> None: ...

mypy-stubs/mistune/core.pyi

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,85 @@
11
import re
2-
from collections.abc import Callable, Iterable, MutableMapping
3-
from re import Match, Pattern
4-
from typing import Any, ClassVar, Generic, TypeVar
2+
from collections.abc import Generator as Generator
3+
from typing import (
4+
Any,
5+
Callable,
6+
ClassVar,
7+
Dict,
8+
Generic,
9+
Iterable,
10+
List,
11+
Match,
12+
MutableMapping,
13+
Optional,
14+
Pattern,
15+
Type,
16+
TypeVar,
17+
Union,
18+
)
519

620
from typing_extensions import Self
721

822
class BlockState:
923
src: str
10-
tokens: list[dict[str, Any]]
24+
tokens: List[Dict[str, Any]]
1125
cursor: int
1226
cursor_max: int
1327
list_tight: bool
1428
parent: Any
1529
env: MutableMapping[str, Any]
16-
def __init__(self, parent: Any | None = None) -> None: ...
30+
def __init__(self, parent: Optional[Any] = None) -> None: ...
1731
def child_state(self, src: str) -> BlockState: ...
1832
def process(self, src: str) -> None: ...
1933
def find_line_end(self) -> int: ...
2034
def get_text(self, end_pos: int) -> str: ...
2135
def last_token(self) -> Any: ...
22-
def prepend_token(self, token: dict[str, Any]) -> None: ...
23-
def append_token(self, token: dict[str, Any]) -> None: ...
36+
def prepend_token(self, token: Dict[str, Any]) -> None: ...
37+
def append_token(self, token: Dict[str, Any]) -> None: ...
2438
def add_paragraph(self, text: str) -> None: ...
25-
def append_paragraph(self) -> int | None: ...
39+
def append_paragraph(self) -> Optional[int]: ...
2640
def depth(self) -> int: ...
2741

2842
class InlineState:
2943
env: MutableMapping[str, Any]
3044
src: str
31-
tokens: list[dict[str, Any]]
45+
tokens: List[Dict[str, Any]]
3246
in_image: bool
3347
in_link: bool
3448
in_emphasis: bool
3549
in_strong: bool
3650
def __init__(self, env: MutableMapping[str, Any]) -> None: ...
37-
def prepend_token(self, token: dict[str, Any]) -> None: ...
38-
def append_token(self, token: dict[str, Any]) -> None: ...
51+
def prepend_token(self, token: Dict[str, Any]) -> None: ...
52+
def append_token(self, token: Dict[str, Any]) -> None: ...
3953
def copy(self) -> InlineState: ...
4054

4155
ST = TypeVar("ST", InlineState, BlockState)
4256

4357
class Parser(Generic[ST]):
4458
sc_flag: re._FlagsType
45-
state_cls: type[ST]
46-
SPECIFICATION: ClassVar[dict[str, str]]
59+
state_cls: Type[ST]
60+
SPECIFICATION: ClassVar[Dict[str, str]]
4761
DEFAULT_RULES: ClassVar[Iterable[str]]
48-
specification: dict[str, str]
62+
specification: Dict[str, str]
4963
rules: Iterable[str]
5064
def __init__(self) -> None: ...
51-
def compile_sc(self, rules: list[str] | None = None) -> Pattern[str]: ...
65+
def compile_sc(self, rules: Optional[List[str]] = None) -> Pattern[str]: ...
5266
def register(
5367
self,
5468
name: str,
55-
pattern: str | None,
56-
func: Callable[[Self, Match[str], ST], int | None],
57-
before: str | None = None,
69+
pattern: Union[str, None],
70+
func: Callable[[Self, Match[str], ST], Optional[int]],
71+
before: Optional[str] = None,
5872
) -> None: ...
5973
def register_rule(self, name: str, pattern: str, func: Any) -> None: ...
6074
@staticmethod
61-
def insert_rule(rules: list[str], name: str, before: str | None = None) -> None: ...
62-
def parse_method(self, m: Match[str], state: ST) -> int | None: ...
75+
def insert_rule(rules: List[str], name: str, before: Optional[str] = None) -> None: ...
76+
def parse_method(self, m: Match[str], state: ST) -> Optional[int]: ...
6377

6478
class BaseRenderer:
6579
NAME: ClassVar[str]
6680
def __init__(self) -> None: ...
6781
def register(self, name: str, method: Callable[..., str]) -> None: ...
68-
def render_token(self, token: dict[str, Any], state: BlockState) -> str: ...
69-
def iter_tokens(self, tokens: Iterable[dict[str, Any]], state: BlockState) -> Iterable[str]: ...
70-
def render_tokens(self, tokens: Iterable[dict[str, Any]], state: BlockState) -> str: ...
71-
def __call__(self, tokens: Iterable[dict[str, Any]], state: BlockState) -> str: ...
82+
def render_token(self, token: Dict[str, Any], state: BlockState) -> str: ...
83+
def iter_tokens(self, tokens: Iterable[Dict[str, Any]], state: BlockState) -> Iterable[str]: ...
84+
def render_tokens(self, tokens: Iterable[Dict[str, Any]], state: BlockState) -> str: ...
85+
def __call__(self, tokens: Iterable[Dict[str, Any]], state: BlockState) -> str: ...

mypy-stubs/mistune/directives/__init__.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import List
2+
13
from ._base import BaseDirective as BaseDirective
24
from ._base import DirectiveParser as DirectiveParser
35
from ._base import DirectivePlugin as DirectivePlugin
@@ -23,4 +25,4 @@ __all__ = [
2325
]
2426

2527
class RstDirective(RSTDirective):
26-
def __init__(self, plugins: list[DirectivePlugin]) -> None: ...
28+
def __init__(self, plugins: List[DirectivePlugin]) -> None: ...
Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import abc
22
from abc import ABCMeta, abstractmethod
3-
from collections.abc import Callable, Iterable
4-
from re import Match
5-
from typing import Any
3+
from typing import (
4+
Any,
5+
Callable,
6+
Dict,
7+
Iterable,
8+
List,
9+
Match,
10+
Optional,
11+
Tuple,
12+
Type,
13+
Union,
14+
)
615

716
from ..block_parser import BlockParser as BlockParser
817
from ..core import BlockState as BlockState
@@ -22,40 +31,42 @@ class DirectiveParser(ABCMeta, metaclass=abc.ABCMeta):
2231
@classmethod
2332
def parse_tokens(
2433
cls, block: BlockParser, text: str, state: BlockState
25-
) -> Iterable[dict[str, Any]]: ...
34+
) -> Iterable[Dict[str, Any]]: ...
2635
@staticmethod
27-
def parse_options(m: Match[str]) -> list[tuple[str, str]]: ...
36+
def parse_options(m: Match[str]) -> List[Tuple[str, str]]: ...
2837

2938
class BaseDirective(metaclass=ABCMeta):
30-
parser: type[DirectiveParser]
31-
directive_pattern: str | None
32-
def __init__(self, plugins: list["DirectivePlugin"]) -> None: ...
39+
parser: Type[DirectiveParser]
40+
directive_pattern: Optional[str]
41+
def __init__(self, plugins: List["DirectivePlugin"]) -> None: ...
3342
def register(
3443
self,
3544
name: str,
36-
fn: Callable[[BlockParser, Match[str], BlockState], dict[str, Any] | list[dict[str, Any]]],
45+
fn: Callable[
46+
[BlockParser, Match[str], BlockState], Union[Dict[str, Any], List[Dict[str, Any]]]
47+
],
3748
) -> None: ...
3849
def parse_method(
3950
self, block: BlockParser, m: Match[str], state: BlockState
40-
) -> dict[str, Any] | list[dict[str, Any]]: ...
51+
) -> Union[Dict[str, Any], List[Dict[str, Any]]]: ...
4152
@abstractmethod
4253
def parse_directive(
4354
self, block: BlockParser, m: Match[str], state: BlockState
44-
) -> int | None: ...
45-
def register_block_parser(self, md: Markdown, before: str | None = None) -> None: ...
55+
) -> Optional[int]: ...
56+
def register_block_parser(self, md: Markdown, before: Optional[str] = None) -> None: ...
4657
def __call__(self, markdown: Markdown) -> None: ...
4758

4859
class DirectivePlugin:
49-
parser: type[DirectiveParser]
60+
parser: Type[DirectiveParser]
5061
def __init__(self) -> None: ...
51-
def parse_options(self, m: Match[str]) -> list[tuple[str, str]]: ...
62+
def parse_options(self, m: Match[str]) -> List[Tuple[str, str]]: ...
5263
def parse_type(self, m: Match[str]) -> str: ...
5364
def parse_title(self, m: Match[str]) -> str: ...
5465
def parse_content(self, m: Match[str]) -> str: ...
5566
def parse_tokens(
5667
self, block: BlockParser, text: str, state: BlockState
57-
) -> Iterable[dict[str, Any]]: ...
68+
) -> Iterable[Dict[str, Any]]: ...
5869
def parse(
5970
self, block: BlockParser, m: Match[str], state: BlockState
60-
) -> dict[str, Any] | list[dict[str, Any]]: ...
71+
) -> Union[Dict[str, Any], List[Dict[str, Any]]]: ...
6172
def __call__(self, directive: BaseDirective, md: Markdown) -> None: ...

mypy-stubs/mistune/directives/_fenced.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from re import Match
1+
from typing import List, Match, Optional
22

33
from _typeshed import Incomplete
44

@@ -22,11 +22,11 @@ class FencedDirective(BaseDirective):
2222
parser = FencedParser
2323
markers: Incomplete
2424
directive_pattern: Incomplete
25-
def __init__(self, plugins: list[DirectivePlugin], markers: str = "`~") -> None: ...
25+
def __init__(self, plugins: List[DirectivePlugin], markers: str = "`~") -> None: ...
2626
def parse_directive(
2727
self, block: BlockParser, m: Match[str], state: BlockState
28-
) -> int | None: ...
28+
) -> Optional[int]: ...
2929
def parse_fenced_code(
3030
self, block: BlockParser, m: Match[str], state: BlockState
31-
) -> int | None: ...
31+
) -> Optional[int]: ...
3232
def __call__(self, md: Markdown) -> None: ...

0 commit comments

Comments
 (0)