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 2448ac4

Browse files
committed
Merge branch 'addtypes'
2 parents 96f8f17 + 37cef23 commit 2448ac4

File tree

8 files changed

+83
-74
lines changed

8 files changed

+83
-74
lines changed

‎git/compat/__init__.py‎ renamed to ‎git/compat.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Dict,
2525
IO,
2626
Optional,
27+
Tuple,
2728
Type,
2829
Union,
2930
overload,
@@ -92,16 +93,16 @@ def win_encode(s: Optional[AnyStr]) -> Optional[bytes]:
9293
return None
9394

9495

95-
def with_metaclass(meta: Type[Any], *bases: Any) -> 'metadiff-2f2b548c14a71e5bbf15502f6d7fd98a50842119152c451ae2ec5e1cc42f02d2-95-96-0" data-selected="false" role="gridcell" tabindex="-1">
96+
def with_metaclass(meta: Type[Any], *bases: Any) -> TBD: # type: ignore ## mypy cannot understand dynamic class creation
9697
"""copied from https://github.com/Byron/bcore/blob/master/src/python/butility/future.py#L15"""
9798

9899
class metaclass(meta): # type: ignore
99100
__call__ = type.__call__
100101
__init__ = type.__init__ # type: ignore
101102

102-
def __new__(cls, name: str, nbases: Optional[int], d: Dict[str, Any]) -> TBD:
103+
def __new__(cls, name: str, nbases: Optional[Tuple[int, ...]], d: Dict[str, Any]) -> TBD:
103104
if nbases is None:
104105
return type.__new__(cls, name, (), d)
105106
return meta(name, bases, d)
106107

107-
return metaclass(meta.__name__ + 'Helper', None, {})
108+
return metaclass(meta.__name__ + 'Helper', None, {})# type: ignore

‎git/compat/typing.py‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎git/config.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,23 @@
2222
with_metaclass,
2323
is_win,
2424
)
25-
fromgit.compat.typingimportLiteral
25+
2626
from git.util import LockFile
2727

2828
import os.path as osp
2929

3030
import configparser as cp
3131

32+
# typing-------------------------------------------------------
33+
34+
from typing import TYPE_CHECKING, Tuple
35+
36+
from git.types import Literal
37+
38+
if TYPE_CHECKING:
39+
pass
40+
41+
# -------------------------------------------------------------
3242

3343
__all__ = ('GitConfigParser', 'SectionConstraint')
3444

@@ -38,7 +48,8 @@
3848

3949
# invariants
4050
# represents the configuration level of a configuration file
41-
CONFIG_LEVELS = ("system", "user", "global", "repository")
51+
CONFIG_LEVELS = ("system", "user", "global", "repository"
52+
) # type: Tuple[Literal['system'], Literal['user'], Literal['global'], Literal['repository']]
4253

4354
# Section pattern to detect conditional includes.
4455
# https://git-scm.com/docs/git-config#_conditional_includes

‎git/diff.py‎

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

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

2221
if TYPE_CHECKING:
2322
from .objects.tree import Tree

0 commit comments

Comments
(0)

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