Skip to content

Commit 12c139c

Browse files
authored
Merge pull request #1860 from EliahKagan/typing-tweaks
Revise type annotations slightly
2 parents b2c3d8b + 5d7e55b commit 12c139c

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

Diff for: git/cmd.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ class CatFileContentStream:
749749
rest to ensure the underlying stream continues to work.
750750
"""
751751

752-
__slots__: Tuple[str, ...] = ("_stream", "_nbr", "_size")
752+
__slots__ = ("_stream", "_nbr", "_size")
753753

754754
def __init__(self, size: int, stream: IO[bytes]) -> None:
755755
self._stream = stream
@@ -846,14 +846,14 @@ def __del__(self) -> None:
846846
self._stream.read(bytes_left + 1)
847847
# END handle incomplete read
848848

849-
def __init__(self, working_dir: Union[None, PathLike] = None):
849+
def __init__(self, working_dir: Union[None, PathLike] = None) -> None:
850850
"""Initialize this instance with:
851851
852852
:param working_dir:
853-
Git directory we should work in. If ``None``, we always work in the current
854-
directory as returned by :func:`os.getcwd`.
855-
This is meant to be the working tree directory if available, or the
856-
``.git`` directory in case of bare repositories.
853+
Git directory we should work in. If ``None``, we always work in the current
854+
directory as returned by :func:`os.getcwd`.
855+
This is meant to be the working tree directory if available, or the
856+
``.git`` directory in case of bare repositories.
857857
"""
858858
super().__init__()
859859
self._working_dir = expand_path(working_dir)
@@ -1103,8 +1103,8 @@ def execute(
11031103
:raise git.exc.GitCommandError:
11041104
11051105
:note:
1106-
If you add additional keyword arguments to the signature of this method,
1107-
you must update the ``execute_kwargs`` variable housed in this module.
1106+
If you add additional keyword arguments to the signature of this method, you
1107+
must update the ``execute_kwargs`` variable housed in this module.
11081108
"""
11091109
# Remove password for the command if present.
11101110
redacted_command = remove_password_if_present(command)
@@ -1438,7 +1438,7 @@ def _call_process(
14381438
14391439
turns into::
14401440
1441-
git rev-list max-count 10 --header master
1441+
git rev-list max-count 10 --header master
14421442
14431443
:return:
14441444
Same as :meth:`execute`. If no args are given, used :meth:`execute`'s

Diff for: git/objects/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Object(LazyMixin):
5555

5656
type: Union[Lit_commit_ish, None] = None
5757

58-
def __init__(self, repo: "Repo", binsha: bytes):
58+
def __init__(self, repo: "Repo", binsha: bytes) -> None:
5959
"""Initialize an object by identifying it by its binary sha.
6060
6161
All keyword arguments will be set on demand if ``None``.

Diff for: git/objects/submodule/root.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class RootModule(Submodule):
5656

5757
k_root_name = "__ROOT__"
5858

59-
def __init__(self, repo: "Repo"):
59+
def __init__(self, repo: "Repo") -> None:
6060
# repo, binsha, mode=None, path=None, name = None, parent_commit=None, url=None, ref=None)
6161
super().__init__(
6262
repo,

Diff for: git/refs/head.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class HEAD(SymbolicReference):
4444

4545
__slots__ = ()
4646

47-
def __init__(self, repo: "Repo", path: PathLike = _HEAD_NAME):
47+
def __init__(self, repo: "Repo", path: PathLike = _HEAD_NAME) -> None:
4848
if path != self._HEAD_NAME:
4949
raise ValueError("HEAD instance must point to %r, got %r" % (self._HEAD_NAME, path))
5050
super().__init__(repo, path)

Diff for: git/refs/log.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def __new__(cls, filepath: Union[PathLike, None] = None) -> "RefLog":
164164
inst = super().__new__(cls)
165165
return inst
166166

167-
def __init__(self, filepath: Union[PathLike, None] = None):
167+
def __init__(self, filepath: Union[PathLike, None] = None) -> None:
168168
"""Initialize this instance with an optional filepath, from which we will
169169
initialize our data. The path is also used to write changes back using the
170170
:meth:`write` method."""

Diff for: git/refs/symbolic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SymbolicReference:
7474
_remote_common_path_default = "refs/remotes"
7575
_id_attribute_ = "name"
7676

77-
def __init__(self, repo: "Repo", path: PathLike, check_path: bool = False):
77+
def __init__(self, repo: "Repo", path: PathLike, check_path: bool = False) -> None:
7878
self.repo = repo
7979
self.path = path
8080

Diff for: git/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ class Stats:
917917

918918
__slots__ = ("total", "files")
919919

920-
def __init__(self, total: Total_TD, files: Dict[PathLike, Files_TD]):
920+
def __init__(self, total: Total_TD, files: Dict[PathLike, Files_TD]) -> None:
921921
self.total = total
922922
self.files = files
923923

0 commit comments

Comments
 (0)