Skip to content

Commit 37cef23

Browse files
committed
flake8 fixes
1 parent 6a2f5d0 commit 37cef23

File tree

8 files changed

+80
-71
lines changed

8 files changed

+80
-71
lines changed

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

+4-3
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) -> 'metaclass': # type: ignore ## mypy cannot understand dynamic class creation
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

-13
This file was deleted.

git/config.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,23 @@
2222
with_metaclass,
2323
is_win,
2424
)
25-
from git.compat.typing import Literal
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

+1-2
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)