Skip to content

Commit

Permalink
Merge pull request #307 from cvzi/typing_extensions
Browse files Browse the repository at this point in the history
Remove `typing_extensions` dependency on Python 3.9 and higher
  • Loading branch information
TahirJalilov authored Sep 23, 2024
2 parents f154602 + 92e0d8c commit 824fed5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ emoji
v2.13.1 (2024-09-21)
-----
* Read JSON files in binary mode to avoid UnicodeDecodeError #305
* `typing_extensions` dependency not required on Python 3.9 and higher #303

v2.13.0 (2024-09-19)
-----
Expand Down
7 changes: 6 additions & 1 deletion emoji/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@

import re
import unicodedata
import sys
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
from typing_extensions import Literal, Match, TypedDict

if sys.version_info < (3, 9):
from typing_extensions import Literal, Match, TypedDict # type: ignore
else:
from typing import Literal, Match, TypedDict

from emoji import unicode_codes
from emoji.tokenizer import (
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
dependencies = ["typing_extensions >= 4.7.0"]
dependencies = ["typing_extensions >= 4.7.0; python_version < '3.9'"]
dynamic = ["version"]

[project.urls]
Expand Down
7 changes: 6 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

import random
import re
import sys

from typing import Any, Callable, Dict, List, Tuple, Union
from typing_extensions import Literal
if sys.version_info < (3, 9):
from typing_extensions import Literal # type: ignore
else:
from typing import Literal
import pytest
import emoji.unicode_codes
from testutils import (
Expand Down
9 changes: 6 additions & 3 deletions utils/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
import sys
import unicodedata

import emoji.unicode_codes

from typing_extensions import Literal
import pytest
if sys.version_info < (3, 9):
from typing_extensions import Literal # type: ignore
else:
from typing import Literal

import emoji.unicode_codes

_NormalizationForm = Literal['NFC', 'NFD', 'NFKC', 'NFKD']

Expand Down

0 comments on commit 824fed5

Please sign in to comment.