Skip to content

Commit 5f889c4

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

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

git/objects/blob.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
from mimetypes import guess_type
77
from . import base
88

9-
from git.types import Literal
9+
10+
try:
11+
from typing import Literal
12+
except ImportError:
13+
from typing_extensions import Literal
1014

1115
__all__ = ("Blob",)
1216

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
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@
3131
TYPE_CHECKING,
3232
)
3333

34-
from git.types import PathLike, Literal
34+
from git.types import PathLike
35+
36+
try:
37+
from typing import Literal
38+
except ImportError:
39+
from typing_extensions import Literal
3540

3641
if TYPE_CHECKING:
3742
from git.repo import Repo

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy