Add final types to config.py · gitpython-developers/GitPython@d6e7369 · GitHub
Skip to content

Commit d6e7369

Browse files
committed
Add final types to config.py
1 parent 35231db commit d6e7369

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

git/config.py

Lines changed: 11 additions & 7 deletions

git/util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def expand_path(p: Union[None, PathLike], expand_vars: bool = True) -> Optional[
408408
return None
409409

410410

411-
def remove_password_if_present(cmdline):
411+
def remove_password_if_present(cmdline: Sequence[str]) -> List[str]:
412412
"""
413413
Parse any command line argument and if on of the element is an URL with a
414414
password, replace it by stars (in-place).
@@ -1033,7 +1033,7 @@ def __delitem__(self, index: Union[SupportsIndex, int, slice, str]) -> None:
10331033

10341034
class IterableClassWatcher(type):
10351035
""" Metaclass that watches """
1036-
def __init__(cls, name, bases, clsdict):
1036+
def __init__(cls, name: str, bases: List, clsdict: Dict) -> None:
10371037
for base in bases:
10381038
if type(base) == IterableClassWatcher:
10391039
warnings.warn(f"GitPython Iterable subclassed by {name}. "
@@ -1052,7 +1052,7 @@ class Iterable(metaclass=IterableClassWatcher):
10521052
_id_attribute_ = "attribute that most suitably identifies your instance"
10531053

10541054
@classmethod
1055-
def list_items(cls, repo, *args, **kwargs):
1055+
def list_items(cls, repo: 'Repo', *args: Any, **kwargs: Any) -> Any:
10561056
"""
10571057
Deprecated, use IterableObj instead.
10581058
Find all items of this type - subclasses can specify args and kwargs differently.
@@ -1062,7 +1062,7 @@ def list_items(cls, repo, *args, **kwargs):
10621062
:note: Favor the iter_items method as it will
10631063
10641064
:return:list(Item,...) list of item instances"""
1065-
out_list = IterableList(cls._id_attribute_)
1065+
out_list: Any = IterableList(cls._id_attribute_)
10661066
out_list.extend(cls.iter_items(repo, *args, **kwargs))
10671067
return out_list
10681068

pyproject.toml

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)