Skip to content

Add remaining types to remote.py #1232

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
merged 2 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 4 additions & 3 deletions git/compat/__init__.py → git/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Dict,
IO,
Optional,
Tuple,
Type,
Union,
overload,
Expand Down Expand Up @@ -92,16 +93,16 @@ def win_encode(s: Optional[AnyStr]) -> Optional[bytes]:
return None


def with_metaclass(meta: Type[Any], *bases: Any) -> 'metaclass': # type: ignore ## mypy cannot understand dynamic class creation
def with_metaclass(meta: Type[Any], *bases: Any) -> TBD: # type: ignore ## mypy cannot understand dynamic class creation
"""copied from https://github.com/Byron/bcore/blob/master/src/python/butility/future.py#L15"""

class metaclass(meta): # type: ignore
__call__ = type.__call__
__init__ = type.__init__ # type: ignore

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

return metaclass(meta.__name__ + 'Helper', None, {})
return metaclass(meta.__name__ + 'Helper', None, {}) # type: ignore
13 changes: 0 additions & 13 deletions git/compat/typing.py

This file was deleted.

15 changes: 13 additions & 2 deletions git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,23 @@
with_metaclass,
is_win,
)
from git.compat.typing import Literal

from git.util import LockFile

import os.path as osp

import configparser as cp

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

from typing import TYPE_CHECKING, Tuple

from git.types import Literal

if TYPE_CHECKING:
pass

# -------------------------------------------------------------

__all__ = ('GitConfigParser', 'SectionConstraint')

Expand All @@ -38,7 +48,8 @@

# invariants
# represents the configuration level of a configuration file
CONFIG_LEVELS = ("system", "user", "global", "repository")
CONFIG_LEVELS = ("system", "user", "global", "repository"
) # type: Tuple[Literal['system'], Literal['user'], Literal['global'], Literal['repository']]

# Section pattern to detect conditional includes.
# https://git-scm.com/docs/git-config#_conditional_includes
Expand Down
3 changes: 1 addition & 2 deletions git/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
# typing ------------------------------------------------------------------

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

if TYPE_CHECKING:
from .objects.tree import Tree
Expand Down
Loading