try: from typing import Literal · gitpython-developers/GitPython@5f889c4 · GitHub
Skip to content

Commit 5f889c4

Browse files
committed
try: from typing import Literal
1 parent aa9298a commit 5f889c4

5 files changed

Lines changed: 27 additions & 5 deletions

File tree

git/objects/blob.py

Lines changed: 5 additions & 1 deletion

git/objects/commit.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@
4444
Dict,
4545
)
4646

47-
from git.types import PathLike, Literal
47+
from git.types import PathLike
48+
49+
try:
50+
from typing import Literal
51+
except ImportError:
52+
from typing_extensions import Literal
4853

4954
if TYPE_CHECKING:
5055
from git.repo import Repo

git/objects/submodule/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@
4444
from typing import Callable, Dict, Mapping, Sequence, TYPE_CHECKING, cast
4545
from typing import Any, Iterator, Union
4646

47-
from git.types import Commit_ish, Literal, PathLike, TBD
47+
from git.types import Commit_ish, PathLike, TBD
48+
49+
try:
50+
from typing import Literal
51+
except ImportError:
52+
from typing_extensions import Literal
4853

4954
if TYPE_CHECKING:
5055
from git.index import IndexFile

git/objects/tag.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616

1717
from typing import List, TYPE_CHECKING, Union
1818

19-
from git.types import Literal
19+
try:
20+
from typing import Literal
21+
except ImportError:
22+
from typing_extensions import Literal
2023

2124
if TYPE_CHECKING:
2225
from git.repo import Repo

git/objects/tree.py

Lines changed: 6 additions & 1 deletion

0 commit comments

Comments
 (0)