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

Use typing-extensions only on Python < 3.8 #1218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Byron merged 2 commits into gitpython-developers:main from mgorny:typing-ext
Apr 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use typing-extensions only on Python < 3.8
All necessary attributes are available in the built-in typing module
since Python 3.8. Use typing-extensions only for older versions
of Python, and avoid the unnecessary dep in 3.8+.
  • Loading branch information
mgorny committed Apr 23, 2021
commit f8e223263c73a7516e2b216a546079e9a144b3a5
File renamed without changes.
13 changes: 13 additions & 0 deletions git/compat/typing.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
# config.py
# Copyright (C) 2021 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php

import sys

if sys.version_info[:2] >= (3, 8):
from typing import Final, Literal
else:
from typing_extensions import Final, Literal
3 changes: 1 addition & 2 deletions git/config.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@
import fnmatch
from collections import OrderedDict

from typing_extensions import Literal

from git.compat import (
defenc,
force_text,
with_metaclass,
is_win,
)
from git.compat.typing import Literal
from git.util import LockFile

import os.path as osp
Expand Down
2 changes: 1 addition & 1 deletion git/diff.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# typing ------------------------------------------------------------------

from typing import Any, Iterator, List, Match, Optional, Tuple, Type, Union, TYPE_CHECKING
from typing_extensions import Final, Literal
from git.compat.typing import Final, Literal
from git.types import TBD

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion git/repo/base.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

# typing ------------------------------------------------------

from git.compat.typing import Literal
from git.types import TBD, PathLike
from typing_extensions import Literal
from typing import (Any, BinaryIO, Callable, Dict,
Iterator, List, Mapping, Optional,
TextIO, Tuple, Type, Union,
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
gitdb>=4.0.1,<5
typing-extensions>=3.7.4.0
typing-extensions>=3.7.4.0;python_version<"3.8"
2 changes: 1 addition & 1 deletion test-requirements.txt
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ tox
virtualenv
nose
gitdb>=4.0.1,<5
typing-extensions>=3.7.4.0
typing-extensions>=3.7.4.0;python_version<"3.8"

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