From 0772c78bc0a62771768278263ef740345f58c0f0 Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Thu, 24 Oct 2024 18:15:00 +0900 Subject: [PATCH] fix: importing Self from typing_extensions --- pyproject.toml | 2 +- src/mistune/__init__.py | 4 ---- src/mistune/core.py | 5 ++++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5e0883c..2d95f9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ dependencies = [ ] license = {text = "BSD-3-Clause"} dynamic = ["version"] -requires-python = ">=3.7" +requires-python = ">=3.8" readme = "README.rst" classifiers = [ "Development Status :: 4 - Beta", diff --git a/src/mistune/__init__.py b/src/mistune/__init__.py index bf27c84..3573a5f 100644 --- a/src/mistune/__init__.py +++ b/src/mistune/__init__.py @@ -8,10 +8,6 @@ Documentation: https://mistune.lepture.com/ """ -try: - import typing_extensions -except ImportError: - pass from typing import Any, Dict, Iterable, List, Optional, Tuple, Union, Literal from .block_parser import BlockParser from .core import BaseRenderer, BlockState, InlineState diff --git a/src/mistune/core.py b/src/mistune/core.py index 7c23cd1..07d79bd 100644 --- a/src/mistune/core.py +++ b/src/mistune/core.py @@ -14,9 +14,12 @@ Type, TypeVar, Union, - Self, cast, ) +try: + from typing import Self +except ImportError: + from typing_extensions import Self _LINE_END = re.compile(r'\n|$')