From e6345d60a7926bd413d3d7238ba06f7c81a7faf9 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Sat, 24 Jul 2021 17:10:32 +0100 Subject: Replace all Typeguard with cast, revert update to typing-extensions==3.10.0 --- git/remote.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'git/remote.py') diff --git a/git/remote.py b/git/remote.py index d903552f..7da466e6 100644 --- a/git/remote.py +++ b/git/remote.py @@ -37,9 +37,9 @@ from .refs import ( # typing------------------------------------------------------- from typing import (Any, Callable, Dict, Iterator, List, NoReturn, Optional, Sequence, # NOQA[TC002] - TYPE_CHECKING, Type, Union, overload) + TYPE_CHECKING, Type, Union, cast, overload) -from git.types import PathLike, Literal, TBD, TypeGuard, Commit_ish # NOQA[TC002] +from git.types import PathLike, Literal, TBD, Commit_ish # NOQA[TC002] if TYPE_CHECKING: from git.repo.base import Repo @@ -50,8 +50,8 @@ if TYPE_CHECKING: flagKeyLiteral = Literal[' ', '!', '+', '-', '*', '=', 't', '?'] -def is_flagKeyLiteral(inp: str) -> TypeGuard[flagKeyLiteral]: - return inp in [' ', '!', '+', '-', '=', '*', 't', '?'] +# def is_flagKeyLiteral(inp: str) -> TypeGuard[flagKeyLiteral]: +# return inp in [' ', '!', '+', '-', '=', '*', 't', '?'] # ------------------------------------------------------------- @@ -342,8 +342,8 @@ class FetchInfo(IterableObj, object): # parse lines remote_local_ref_str: str control_character, operation, local_remote_ref, remote_local_ref_str, note = match.groups() - assert is_flagKeyLiteral(control_character), f"{control_character}" - + # assert is_flagKeyLiteral(control_character), f"{control_character}" + control_character = cast(flagKeyLiteral, control_character) try: _new_hex_sha, _fetch_operation, fetch_note = fetch_line.split("\t") ref_type_name, fetch_note = fetch_note.split(' ', 1) -- cgit v1.2.1 From d812818cb20c39e0bb5609186214ea4bcc18c047 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Sat, 24 Jul 2021 22:05:06 +0100 Subject: Rmv with_metaclass shim, make section constraint generic wrt its configparser type --- git/remote.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git/remote.py') diff --git a/git/remote.py b/git/remote.py index 7da466e6..11007cb6 100644 --- a/git/remote.py +++ b/git/remote.py @@ -23,6 +23,7 @@ from git.util import ( ) from .config import ( + GitConfigParser, SectionConstraint, cp, ) @@ -911,7 +912,7 @@ class Remote(LazyMixin, IterableObj): return self._get_push_info(proc, progress) @ property - def config_reader(self) -> SectionConstraint: + def config_reader(self) -> SectionConstraint[GitConfigParser]: """ :return: GitConfigParser compatible object able to read options for only our remote. -- cgit v1.2.1