Skip to content

Commit 2163322

Browse files
committed
increase mypy strictness (warn unused ignored)
1 parent c878771 commit 2163322

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

‎git/cmd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def dict_to_slots_and__excluded_are_none(self: object, d: Mapping[str, Any], exc
164164

165165
## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards,
166166
# see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal
167-
PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP # type: ignore[attr-defined]
167+
PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP
168168
if is_win else 0)
169169

170170

‎git/config.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444

4545
if sys.version_info[:3] < (3, 7, 2):
4646
# typing.Ordereddict not added until py 3.7.2
47-
from collections import OrderedDict # type: ignore # until 3.6 dropped
48-
OrderedDict_OMD = OrderedDict # type: ignore # until 3.6 dropped
47+
from collections import OrderedDict
48+
OrderedDict_OMD = OrderedDict
4949
else:
50-
from typing import OrderedDict # type: ignore # until 3.6 dropped
50+
from typing import OrderedDict
5151
OrderedDict_OMD = OrderedDict[str, List[T_OMD_value]] # type: ignore[assignment, misc]
5252

5353
# -------------------------------------------------------------
@@ -177,7 +177,7 @@ def __exit__(self, exception_type: str, exception_value: str, traceback: str) ->
177177
class _OMD(OrderedDict_OMD):
178178
"""Ordered multi-dict."""
179179

180-
def __setitem__(self, key: str, value: _T) -> None: # type: ignore[override]
180+
def __setitem__(self, key: str, value: _T) -> None:
181181
super(_OMD, self).__setitem__(key, [value])
182182

183183
def add(self, key: str, value: Any) -> None:
@@ -203,8 +203,8 @@ def setlast(self, key: str, value: Any) -> None:
203203
prior = super(_OMD, self).__getitem__(key)
204204
prior[-1] = value
205205

206-
def get(self, key: str, default: Union[_T, None] = None) -> Union[_T, None]: # type: ignore
207-
return super(_OMD, self).get(key, [default])[-1] # type: ignore
206+
def get(self, key: str, default: Union[_T, None] = None) -> Union[_T, None]:
207+
return super(_OMD, self).get(key, [default])[-1]
208208

209209
def getall(self, key: str) -> List[_T]:
210210
return super(_OMD, self).__getitem__(key)
@@ -299,9 +299,9 @@ def __init__(self, file_or_files: Union[None, PathLike, 'BytesIO', Sequence[Unio
299299
:param repo: Reference to repository to use if [includeIf] sections are found in configuration files.
300300
301301
"""
302-
cp.RawConfigParser.__init__(self, dict_type=_OMD) # type: ignore[arg-type]
302+
cp.RawConfigParser.__init__(self, dict_type=_OMD)
303303
self._dict: Callable[..., _OMD] # type: ignore[assignment] # mypy/typeshed bug
304-
self._defaults: _OMD # type: ignore[assignment] # mypy/typeshed bug
304+
self._defaults: _OMD
305305
self._sections: _OMD # type: ignore[assignment] # mypy/typeshed bug
306306

307307
# Used in python 3, needs to stay in sync with sections for underlying implementation to work

‎git/objects/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def _list_traverse(self, as_edge: bool = False, *args: Any, **kwargs: Any
346346

347347
if not as_edge:
348348
out: IterableList[Union['Commit', 'Submodule', 'Tree', 'Blob']] = IterableList(id)
349-
out.extend(self.traverse(as_edge=as_edge, *args, **kwargs)) # type: ignore
349+
out.extend(self.traverse(as_edge=as_edge, *args, **kwargs))
350350
return out
351351
# overloads in subclasses (mypy does't allow typing self: subclass)
352352
# Union[IterableList['Commit'], IterableList['Submodule'], IterableList[Union['Submodule', 'Tree', 'Blob']]]

‎git/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ def expand_path(p: Union[None, PathLike], expand_vars: bool = True) -> Optional[
403403
try:
404404
p = osp.expanduser(p) # type: ignore
405405
if expand_vars:
406-
p = osp.expandvars(p) # type: ignore
407-
return osp.normpath(osp.abspath(p)) # type: ignore
406+
p = osp.expandvars(p)
407+
return osp.normpath(osp.abspath(p))
408408
except Exception:
409409
return None
410410

‎pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ filterwarnings = 'ignore::DeprecationWarning'
2222
disallow_untyped_defs = true
2323
no_implicit_optional = true
2424
warn_redundant_casts = true
25-
# warn_unused_ignores = True
25+
implicit_reexport = true
26+
warn_unused_ignores = true
2627
# warn_unreachable = True
2728
show_error_codes = true
2829

0 commit comments

Comments
 (0)