Skip to content

Commit 84fc806

Browse files
committed
Remove some unneeded mypy suppressions
These include suppressions that are no longer required because they worked around mypy bugs that have been fixed, or because they were not actually effective. It may also include some that are no longer needed becuase of improvements made to GitPython's type annotations (or other code) since they were introduced, I am not sure. This deliberately keeps warn_unused_ignores uncommented in pyproject.toml, at least for now.
1 parent aeacb00 commit 84fc806

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

git/config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ def __init__(
344344
configuration files.
345345
"""
346346
cp.RawConfigParser.__init__(self, dict_type=_OMD)
347-
self._dict: Callable[..., _OMD] # type: ignore # mypy/typeshed bug?
347+
self._dict: Callable[..., _OMD]
348348
self._defaults: _OMD
349-
self._sections: _OMD # type: ignore # mypy/typeshed bug?
349+
self._sections: _OMD
350350

351351
# Used in Python 3. Needs to stay in sync with sections for underlying
352352
# implementation to work.

git/objects/commit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def name_rev(self) -> str:
292292
def iter_items(
293293
cls,
294294
repo: "Repo",
295-
rev: Union[str, "Commit", "SymbolicReference"], # type: ignore
295+
rev: Union[str, "Commit", "SymbolicReference"],
296296
paths: Union[PathLike, Sequence[PathLike]] = "",
297297
**kwargs: Any,
298298
) -> Iterator["Commit"]:

git/objects/tree.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def cache(self) -> TreeModifier:
300300
return TreeModifier(self._cache)
301301

302302
def traverse(
303-
self, # type: ignore[override]
303+
self,
304304
predicate: Callable[[Union[IndexObjUnion, TraversedTreeTup], int], bool] = lambda i, d: True,
305305
prune: Callable[[Union[IndexObjUnion, TraversedTreeTup], int], bool] = lambda i, d: False,
306306
depth: int = -1,
@@ -331,7 +331,7 @@ def traverse(
331331
super()._traverse(
332332
predicate,
333333
prune,
334-
depth, # type: ignore
334+
depth,
335335
branch_first,
336336
visit_once,
337337
ignore_self,

git/objects/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ class TraversableIterableObj(IterableObj, Traversable):
619619
def list_traverse(self: T_TIobj, *args: Any, **kwargs: Any) -> IterableList[T_TIobj]:
620620
return super()._list_traverse(*args, **kwargs)
621621

622-
@overload # type: ignore
622+
@overload
623623
def traverse(self: T_TIobj) -> Iterator[T_TIobj]:
624624
...
625625

git/refs/reference.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def iter_items(
150150

151151
# { Remote Interface
152152

153-
@property # type: ignore # mypy cannot deal with properties with an extra decorator (2021-04-21).
153+
@property
154154
@require_remote_ref_path
155155
def remote_name(self) -> str:
156156
"""
@@ -162,7 +162,7 @@ def remote_name(self) -> str:
162162
# /refs/remotes/<remote name>/<branch_name>
163163
return tokens[2]
164164

165-
@property # type: ignore # mypy cannot deal with properties with an extra decorator (2021-04-21).
165+
@property
166166
@require_remote_ref_path
167167
def remote_head(self) -> str:
168168
"""

git/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ def expand_path(p: Union[None, PathLike], expand_vars: bool = True) -> Optional[
510510
try:
511511
p = osp.expanduser(p) # type: ignore
512512
if expand_vars:
513-
p = osp.expandvars(p) # type: ignore
514-
return osp.normpath(osp.abspath(p)) # type: ignore
513+
p = osp.expandvars(p)
514+
return osp.normpath(osp.abspath(p))
515515
except Exception:
516516
return None
517517

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ python_version = "3.8"
2424
disallow_untyped_defs = true
2525
no_implicit_optional = true
2626
warn_redundant_casts = true
27-
# warn_unused_ignores = true
27+
warn_unused_ignores = true
2828
warn_unreachable = true
2929
show_error_codes = true
3030
implicit_reexport = true

0 commit comments

Comments
 (0)