Skip to content

Commit 6a2f5d0

Browse files
committed
Add types to Remote. init getattr exists
1 parent 96f8f17 commit 6a2f5d0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

git/remote.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -433,15 +433,15 @@ class Remote(LazyMixin, Iterable):
433433
__slots__ = ("repo", "name", "_config_reader")
434434
_id_attribute_ = "name"
435435

436-
def __init__(self, repo, name):
436+
def __init__(self, repo: 'Repo', name: str) -> None:
437437
"""Initialize a remote instance
438438
439439
:param repo: The repository we are a remote of
440440
:param name: the name of the remote, i.e. 'origin'"""
441441
self.repo = repo # type: 'Repo'
442442
self.name = name
443443

444-
def __getattr__(self, attr):
444+
def __getattr__(self, attr: str) -> Any:
445445
"""Allows to call this instance like
446446
remote.special( \\*args, \\*\\*kwargs) to call git-remote special self.name"""
447447
if attr == "_config_reader":
@@ -481,7 +481,7 @@ def __ne__(self, other):
481481
def __hash__(self):
482482
return hash(self.name)
483483

484-
def exists(self):
484+
def exists(self) -> bool:
485485
"""
486486
:return: True if this is a valid, existing remote.
487487
Valid remotes have an entry in the repository's configuration"""

mypy.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[mypy]
33

44
# TODO: enable when we've fully annotated everything
5-
#disallow_untyped_defs = True
5+
disallow_untyped_defs = True
66

77
# TODO: remove when 'gitdb' is fully annotated
88
[mypy-gitdb.*]

0 commit comments

Comments
 (0)