Skip to content

Commit a094ac1

Browse files
committed
add types to git.util and git.__init__
1 parent 5b0028e commit a094ac1

File tree

3 files changed

+68
-57
lines changed

3 files changed

+68
-57
lines changed

Diff for: git/__init__.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88
import inspect
99
import os
1010
import sys
11-
1211
import os.path as osp
1312

13+
from typing import Optional
14+
from git.types import PathLike
1415

1516
__version__ = 'git'
1617

1718

19+
20+
1821
#{ Initialization
19-
def _init_externals():
22+
def _init_externals() -> None:
2023
"""Initialize external projects by putting them into the path"""
2124
if __version__ == 'git' and 'PYOXIDIZER' not in os.environ:
2225
sys.path.insert(1, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))
@@ -65,7 +68,7 @@ def _init_externals():
6568
#{ Initialize git executable path
6669
GIT_OK = None
6770

68-
def refresh(path=None):
71+
def refresh(path:Optional[PathLike]=None) -> None:
6972
"""Convenience method for setting the git executable path."""
7073
global GIT_OK
7174
GIT_OK = False

Diff for: git/remote.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
TagReference
3535
)
3636

37+
# typing-------------------------------------------------------
38+
39+
from git.repo.Base import Repo
3740

3841
log = logging.getLogger('git.remote')
3942
log.addHandler(logging.NullHandler())
@@ -403,7 +406,7 @@ def __init__(self, repo, name):
403406
404407
:param repo: The repository we are a remote of
405408
:param name: the name of the remote, i.e. 'origin'"""
406-
self.repo = repo
409+
self.repo = repo # type: 'Repo'
407410
self.name = name
408411

409412
if is_win:

0 commit comments

Comments
 (0)