summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYobmod <yobmod@gmail.com>2021-08-02 14:00:33 +0100
committerYobmod <yobmod@gmail.com>2021-08-02 14:00:33 +0100
commit2163322ef62fa97573ac94298261161fd9721993 (patch)
tree2eb3a713664a8d5e37a962141fcfdf1ecbca75f0
parentc878771e3a31c983a0c3468396ed33a532f87e98 (diff)
downloadgitpython-2163322ef62fa97573ac94298261161fd9721993.tar.gz
increase mypy strictness (warn unused ignored)
-rw-r--r--git/cmd.py2
-rw-r--r--git/config.py16
-rw-r--r--git/objects/util.py2
-rw-r--r--git/util.py4
-rw-r--r--pyproject.toml3
5 files changed, 14 insertions, 13 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 85a5fbe9..9d070367 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -164,7 +164,7 @@ CREATE_NO_WINDOW = 0x08000000
## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards,
# see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal
-PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP # type: ignore[attr-defined]
+PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP
if is_win else 0)
diff --git a/git/config.py b/git/config.py
index 3565eece..91bf65d3 100644
--- a/git/config.py
+++ b/git/config.py
@@ -44,10 +44,10 @@ T_OMD_value = TypeVar('T_OMD_value', str, bytes, int, float, bool)
if sys.version_info[:3] < (3, 7, 2):
# typing.Ordereddict not added until py 3.7.2
- from collections import OrderedDict # type: ignore # until 3.6 dropped
- OrderedDict_OMD = OrderedDict # type: ignore # until 3.6 dropped
+ from collections import OrderedDict
+ OrderedDict_OMD = OrderedDict
else:
- from typing import OrderedDict # type: ignore # until 3.6 dropped
+ from typing import OrderedDict
OrderedDict_OMD = OrderedDict[str, List[T_OMD_value]] # type: ignore[assignment, misc]
# -------------------------------------------------------------
@@ -177,7 +177,7 @@ class SectionConstraint(Generic[T_ConfigParser]):
class _OMD(OrderedDict_OMD):
"""Ordered multi-dict."""
- def __setitem__(self, key: str, value: _T) -> None: # type: ignore[override]
+ def __setitem__(self, key: str, value: _T) -> None:
super(_OMD, self).__setitem__(key, [value])
def add(self, key: str, value: Any) -> None:
@@ -203,8 +203,8 @@ class _OMD(OrderedDict_OMD):
prior = super(_OMD, self).__getitem__(key)
prior[-1] = value
- def get(self, key: str, default: Union[_T, None] = None) -> Union[_T, None]: # type: ignore
- return super(_OMD, self).get(key, [default])[-1] # type: ignore
+ def get(self, key: str, default: Union[_T, None] = None) -> Union[_T, None]:
+ return super(_OMD, self).get(key, [default])[-1]
def getall(self, key: str) -> List[_T]:
return super(_OMD, self).__getitem__(key)
@@ -299,9 +299,9 @@ class GitConfigParser(cp.RawConfigParser, metaclass=MetaParserBuilder):
:param repo: Reference to repository to use if [includeIf] sections are found in configuration files.
"""
- cp.RawConfigParser.__init__(self, dict_type=_OMD) # type: ignore[arg-type]
+ cp.RawConfigParser.__init__(self, dict_type=_OMD)
self._dict: Callable[..., _OMD] # type: ignore[assignment] # mypy/typeshed bug
- self._defaults: _OMD # type: ignore[assignment] # mypy/typeshed bug
+ self._defaults: _OMD
self._sections: _OMD # type: ignore[assignment] # mypy/typeshed bug
# Used in python 3, needs to stay in sync with sections for underlying implementation to work
diff --git a/git/objects/util.py b/git/objects/util.py
index f627211e..d3842cfb 100644
--- a/git/objects/util.py
+++ b/git/objects/util.py
@@ -346,7 +346,7 @@ class Traversable(Protocol):
if not as_edge:
out: IterableList[Union['Commit', 'Submodule', 'Tree', 'Blob']] = IterableList(id)
- out.extend(self.traverse(as_edge=as_edge, *args, **kwargs)) # type: ignore
+ out.extend(self.traverse(as_edge=as_edge, *args, **kwargs))
return out
# overloads in subclasses (mypy does't allow typing self: subclass)
# Union[IterableList['Commit'], IterableList['Submodule'], IterableList[Union['Submodule', 'Tree', 'Blob']]]
diff --git a/git/util.py b/git/util.py
index 8056804a..63060530 100644
--- a/git/util.py
+++ b/git/util.py
@@ -403,8 +403,8 @@ def expand_path(p: Union[None, PathLike], expand_vars: bool = True) -> Optional[
try:
p = osp.expanduser(p) # type: ignore
if expand_vars:
- p = osp.expandvars(p) # type: ignore
- return osp.normpath(osp.abspath(p)) # type: ignore
+ p = osp.expandvars(p)
+ return osp.normpath(osp.abspath(p))
except Exception:
return None
diff --git a/pyproject.toml b/pyproject.toml
index 4751ffcb..12c5d961 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -22,7 +22,8 @@ filterwarnings = 'ignore::DeprecationWarning'
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
-# warn_unused_ignores = True
+implicit_reexport = true
+warn_unused_ignores = true
# warn_unreachable = True
show_error_codes = true