Skip to content

Commit 57a99b0

Browse files
committed
Drop support for Python 3.9
1 parent deac6ea commit 57a99b0

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

+760
-858
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: [9, 10, 11, 12, 13, 14]
23+
py-ver-minor: [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.9+ compatible code
2+
- Python 3.10+ 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 --py39-plus $^
208+
pyupgrade --exit-zero-even-if-changed --py310-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.9+ only.
26+
The Schema Salad library is Python 3.10+ only.
2727

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

mypy-stubs/mistune/__init__.pyi

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

54
from .block_parser import BlockParser as BlockParser
65
from .core import BaseRenderer as BaseRenderer
@@ -32,20 +31,20 @@ __all__ = [
3231
"markdown",
3332
]
3433

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

3736
def create_markdown(
3837
escape: bool = True,
3938
hard_wrap: bool = False,
40-
renderer: Optional[RendererRef] = "html",
41-
plugins: Optional[Iterable[PluginRef]] = None,
39+
renderer: RendererRef | None = "html",
40+
plugins: Iterable[PluginRef] | None = None,
4241
) -> Markdown: ...
4342

4443
html: Markdown
4544

4645
def markdown(
4746
text: str,
4847
escape: bool = True,
49-
renderer: Optional[RendererRef] = "html",
50-
plugins: Optional[Iterable[Any]] = None,
51-
) -> Union[str, List[Dict[str, Any]]]: ...
48+
renderer: RendererRef | None = "html",
49+
plugins: Iterable[Any] | None = None,
50+
) -> 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,4 +1,6 @@
1-
from typing import ClassVar, Dict, Iterable, List, Match, Optional, Pattern, Tuple
1+
from collections.abc import Iterable
2+
from re import Match, Pattern
3+
from typing import ClassVar
24

35
from .core import BlockState as BlockState
46
from .core import Parser as Parser
@@ -22,29 +24,27 @@ class BlockParser(Parser[BlockState]):
2224
BLANK_LINE: Pattern[str]
2325
RAW_HTML: str
2426
BLOCK_HTML: str
25-
SPECIFICATION: ClassVar[Dict[str, str]]
27+
SPECIFICATION: ClassVar[dict[str, str]]
2628
DEFAULT_RULES: ClassVar[Iterable[str]]
27-
block_quote_rules: List[str]
28-
list_rules: List[str]
29+
block_quote_rules: list[str]
30+
list_rules: list[str]
2931
max_nested_level: int
3032
def __init__(
3133
self,
32-
block_quote_rules: Optional[List[str]] = None,
33-
list_rules: Optional[List[str]] = None,
34+
block_quote_rules: list[str] | None = None,
35+
list_rules: list[str] | None = None,
3436
max_nested_level: int = 6,
3537
) -> None: ...
3638
def parse_blank_line(self, m: Match[str], state: BlockState) -> int: ...
3739
def parse_thematic_break(self, m: Match[str], state: BlockState) -> int: ...
3840
def parse_indent_code(self, m: Match[str], state: BlockState) -> int: ...
39-
def parse_fenced_code(self, m: Match[str], state: BlockState) -> Optional[int]: ...
41+
def parse_fenced_code(self, m: Match[str], state: BlockState) -> int | None: ...
4042
def parse_atx_heading(self, m: Match[str], state: BlockState) -> int: ...
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]]: ...
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]: ...
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) -> 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: ...
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: ...

mypy-stubs/mistune/core.pyi

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,71 @@
11
import re
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-
)
2+
from collections.abc import Callable, Iterable, MutableMapping
3+
from re import Match, Pattern
4+
from typing import Any, ClassVar, Generic, TypeVar
195

206
from typing_extensions import Self
217

228
class BlockState:
239
src: str
24-
tokens: List[Dict[str, Any]]
10+
tokens: list[dict[str, Any]]
2511
cursor: int
2612
cursor_max: int
2713
list_tight: bool
2814
parent: Any
2915
env: MutableMapping[str, Any]
30-
def __init__(self, parent: Optional[Any] = None) -> None: ...
16+
def __init__(self, parent: Any | None = None) -> None: ...
3117
def child_state(self, src: str) -> BlockState: ...
3218
def process(self, src: str) -> None: ...
3319
def find_line_end(self) -> int: ...
3420
def get_text(self, end_pos: int) -> str: ...
3521
def last_token(self) -> Any: ...
36-
def prepend_token(self, token: Dict[str, Any]) -> None: ...
37-
def append_token(self, token: Dict[str, Any]) -> None: ...
22+
def prepend_token(self, token: dict[str, Any]) -> None: ...
23+
def append_token(self, token: dict[str, Any]) -> None: ...
3824
def add_paragraph(self, text: str) -> None: ...
39-
def append_paragraph(self) -> Optional[int]: ...
25+
def append_paragraph(self) -> int | None: ...
4026
def depth(self) -> int: ...
4127

4228
class InlineState:
4329
env: MutableMapping[str, Any]
4430
src: str
45-
tokens: List[Dict[str, Any]]
31+
tokens: list[dict[str, Any]]
4632
in_image: bool
4733
in_link: bool
4834
in_emphasis: bool
4935
in_strong: bool
5036
def __init__(self, env: MutableMapping[str, Any]) -> None: ...
51-
def prepend_token(self, token: Dict[str, Any]) -> None: ...
52-
def append_token(self, token: Dict[str, Any]) -> None: ...
37+
def prepend_token(self, token: dict[str, Any]) -> None: ...
38+
def append_token(self, token: dict[str, Any]) -> None: ...
5339
def copy(self) -> InlineState: ...
5440

5541
ST = TypeVar("ST", InlineState, BlockState)
5642

5743
class Parser(Generic[ST]):
5844
sc_flag: re._FlagsType
59-
state_cls: Type[ST]
60-
SPECIFICATION: ClassVar[Dict[str, str]]
45+
state_cls: type[ST]
46+
SPECIFICATION: ClassVar[dict[str, str]]
6147
DEFAULT_RULES: ClassVar[Iterable[str]]
62-
specification: Dict[str, str]
48+
specification: dict[str, str]
6349
rules: Iterable[str]
6450
def __init__(self) -> None: ...
65-
def compile_sc(self, rules: Optional[List[str]] = None) -> Pattern[str]: ...
51+
def compile_sc(self, rules: list[str] | None = None) -> Pattern[str]: ...
6652
def register(
6753
self,
6854
name: str,
69-
pattern: Union[str, None],
70-
func: Callable[[Self, Match[str], ST], Optional[int]],
71-
before: Optional[str] = None,
55+
pattern: str | None,
56+
func: Callable[[Self, Match[str], ST], int | None],
57+
before: str | None = None,
7258
) -> None: ...
7359
def register_rule(self, name: str, pattern: str, func: Any) -> None: ...
7460
@staticmethod
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]: ...
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: ...
7763

7864
class BaseRenderer:
7965
NAME: ClassVar[str]
8066
def __init__(self) -> None: ...
8167
def register(self, name: str, method: Callable[..., str]) -> None: ...
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: ...
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: ...

mypy-stubs/mistune/directives/__init__.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import List
2-
31
from ._base import BaseDirective as BaseDirective
42
from ._base import DirectiveParser as DirectiveParser
53
from ._base import DirectivePlugin as DirectivePlugin
@@ -25,4 +23,4 @@ __all__ = [
2523
]
2624

2725
class RstDirective(RSTDirective):
28-
def __init__(self, plugins: List[DirectivePlugin]) -> None: ...
26+
def __init__(self, plugins: list[DirectivePlugin]) -> None: ...
Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
import abc
22
from abc import ABCMeta, abstractmethod
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-
)
3+
from collections.abc import Callable, Iterable
4+
from re import Match
5+
from typing import Any
156

167
from ..block_parser import BlockParser as BlockParser
178
from ..core import BlockState as BlockState
@@ -31,42 +22,40 @@ class DirectiveParser(ABCMeta, metaclass=abc.ABCMeta):
3122
@classmethod
3223
def parse_tokens(
3324
cls, block: BlockParser, text: str, state: BlockState
34-
) -> Iterable[Dict[str, Any]]: ...
25+
) -> Iterable[dict[str, Any]]: ...
3526
@staticmethod
36-
def parse_options(m: Match[str]) -> List[Tuple[str, str]]: ...
27+
def parse_options(m: Match[str]) -> list[tuple[str, str]]: ...
3728

3829
class BaseDirective(metaclass=ABCMeta):
39-
parser: Type[DirectiveParser]
40-
directive_pattern: Optional[str]
41-
def __init__(self, plugins: List["DirectivePlugin"]) -> None: ...
30+
parser: type[DirectiveParser]
31+
directive_pattern: str | None
32+
def __init__(self, plugins: list["DirectivePlugin"]) -> None: ...
4233
def register(
4334
self,
4435
name: str,
45-
fn: Callable[
46-
[BlockParser, Match[str], BlockState], Union[Dict[str, Any], List[Dict[str, Any]]]
47-
],
36+
fn: Callable[[BlockParser, Match[str], BlockState], dict[str, Any] | list[dict[str, Any]]],
4837
) -> None: ...
4938
def parse_method(
5039
self, block: BlockParser, m: Match[str], state: BlockState
51-
) -> Union[Dict[str, Any], List[Dict[str, Any]]]: ...
40+
) -> dict[str, Any] | list[dict[str, Any]]: ...
5241
@abstractmethod
5342
def parse_directive(
5443
self, block: BlockParser, m: Match[str], state: BlockState
55-
) -> Optional[int]: ...
56-
def register_block_parser(self, md: Markdown, before: Optional[str] = None) -> None: ...
44+
) -> int | None: ...
45+
def register_block_parser(self, md: Markdown, before: str | None = None) -> None: ...
5746
def __call__(self, markdown: Markdown) -> None: ...
5847

5948
class DirectivePlugin:
60-
parser: Type[DirectiveParser]
49+
parser: type[DirectiveParser]
6150
def __init__(self) -> None: ...
62-
def parse_options(self, m: Match[str]) -> List[Tuple[str, str]]: ...
51+
def parse_options(self, m: Match[str]) -> list[tuple[str, str]]: ...
6352
def parse_type(self, m: Match[str]) -> str: ...
6453
def parse_title(self, m: Match[str]) -> str: ...
6554
def parse_content(self, m: Match[str]) -> str: ...
6655
def parse_tokens(
6756
self, block: BlockParser, text: str, state: BlockState
68-
) -> Iterable[Dict[str, Any]]: ...
57+
) -> Iterable[dict[str, Any]]: ...
6958
def parse(
7059
self, block: BlockParser, m: Match[str], state: BlockState
71-
) -> Union[Dict[str, Any], List[Dict[str, Any]]]: ...
60+
) -> dict[str, Any] | list[dict[str, Any]]: ...
7261
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 typing import List, Match, Optional
1+
from re import Match
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-
) -> Optional[int]: ...
28+
) -> int | None: ...
2929
def parse_fenced_code(
3030
self, block: BlockParser, m: Match[str], state: BlockState
31-
) -> Optional[int]: ...
31+
) -> int | None: ...
3232
def __call__(self, md: Markdown) -> None: ...

0 commit comments

Comments
 (0)