Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7301771

Browse files
authored
Merge pull request #1218 from mgorny/typing-ext
Use typing-extensions only on Python < 3.8
2 parents 4119a57 + 9448c08 commit 7301771

File tree

7 files changed

+18
-6
lines changed

7 files changed

+18
-6
lines changed
File renamed without changes.

‎git/compat/typing.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# -*- coding: utf-8 -*-
2+
# config.py
3+
# Copyright (C) 2021 Michael Trier (mtrier@gmail.com) and contributors
4+
#
5+
# This module is part of GitPython and is released under
6+
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
7+
8+
import sys
9+
10+
if sys.version_info[:2] >= (3, 8):
11+
from typing import Final, Literal # noqa: F401
12+
else:
13+
from typing_extensions import Final, Literal # noqa: F401

‎git/config.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
import fnmatch
1717
from collections import OrderedDict
1818

19-
from typing_extensions import Literal
20-
2119
from git.compat import (
2220
defenc,
2321
force_text,
2422
with_metaclass,
2523
is_win,
2624
)
25+
from git.compat.typing import Literal
2726
from git.util import LockFile
2827

2928
import os.path as osp

‎git/diff.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# typing ------------------------------------------------------------------
1717

1818
from typing import Any, Iterator, List, Match, Optional, Tuple, Type, Union, TYPE_CHECKING
19-
from typing_extensions import Final, Literal
19+
from git.compat.typing import Final, Literal
2020
from git.types import TBD
2121

2222
if TYPE_CHECKING:

‎git/repo/base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
# typing ------------------------------------------------------
3636

37+
from git.compat.typing import Literal
3738
from git.types import TBD, PathLike
38-
from typing_extensions import Literal
3939
from typing import (Any, BinaryIO, Callable, Dict,
4040
Iterator, List, Mapping, Optional,
4141
TextIO, Tuple, Type, Union,

‎requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
gitdb>=4.0.1,<5
2-
typing-extensions>=3.7.4.0
2+
typing-extensions>=3.7.4.0;python_version<"3.8"

‎test-requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ tox
55
virtualenv
66
nose
77
gitdb>=4.0.1,<5
8-
typing-extensions>=3.7.4.0
8+
typing-extensions>=3.7.4.0;python_version<"3.8"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /