Skip to content

Commit

Permalink
Remove Python 3.7 support remains
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatal1ty committed Aug 30, 2023
1 parent 6be2f59 commit 3d54969
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
10 changes: 2 additions & 8 deletions mashumaro/config.py
@@ -1,15 +1,9 @@
from typing import Any, Callable, Dict, List, Optional, Type, Union
from typing import Any, Callable, Dict, List, Literal, Optional, Type, Union

from mashumaro.core.const import PEP_586_COMPATIBLE, Sentinel
from mashumaro.core.const import Sentinel
from mashumaro.dialect import Dialect
from mashumaro.types import Discriminator, SerializationStrategy

if PEP_586_COMPATIBLE:
from typing import Literal # type: ignore
else:
from typing_extensions import Literal # type: ignore


__all__ = [
"BaseConfig",
"TO_DICT_ADD_BY_ALIAS_FLAG",
Expand Down
2 changes: 0 additions & 2 deletions mashumaro/core/const.py
Expand Up @@ -10,7 +10,6 @@
"PY_310_MIN",
"PY_311_MIN",
"PEP_585_COMPATIBLE",
"PEP_586_COMPATIBLE",
"Sentinel",
]

Expand All @@ -27,7 +26,6 @@
PY_38_MIN = PY_38 or PY_39_MIN

PEP_585_COMPATIBLE = PY_39_MIN # Type Hinting Generics In Standard Collections
PEP_586_COMPATIBLE = PY_38_MIN # Literal Types


class Sentinel(enum.Enum):
Expand Down
15 changes: 3 additions & 12 deletions tests/test_meta.py
Expand Up @@ -8,12 +8,7 @@
import typing_extensions

from mashumaro import DataClassDictMixin
from mashumaro.core.const import (
PEP_585_COMPATIBLE,
PY_38,
PY_38_MIN,
PY_310_MIN,
)
from mashumaro.core.const import PEP_585_COMPATIBLE, PY_38, PY_310_MIN
from mashumaro.core.meta.code.builder import CodeBuilder

# noinspection PyProtectedMember
Expand Down Expand Up @@ -542,12 +537,8 @@ def test_get_literal_values():


def test_type_name_literal():
if PY_38_MIN:
module = typing
else:
module = typing_extensions
assert type_name(
getattr(module, "Literal")[
getattr(typing, "Literal")[
1,
"a",
b"\x00",
Expand All @@ -564,7 +555,7 @@ def test_type_name_literal():
typing_extensions.Literal[typing_extensions.Literal["b", "c"]],
]
) == (
f"{module.__name__}.Literal[1, 'a', b'\\x00', True, False, None, "
f"typing.Literal[1, 'a', b'\\x00', True, False, None, "
"tests.entities.MyEnum.a, tests.entities.MyStrEnum.a, "
"tests.entities.MyNativeStrEnum.a, tests.entities.MyIntEnum.a, "
"tests.entities.MyFlag.a, tests.entities.MyIntFlag.a, 2, 3, 'b', 'c']"
Expand Down

0 comments on commit 3d54969

Please sign in to comment.