[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2021-09-27 19:47:17 +00:00
parent 70858ac266
commit 56fda99fa1
6 changed files with 14 additions and 18 deletions

View File

@ -392,8 +392,7 @@ class MyOptionParser(argparse.ArgumentParser):
prog: Optional[str] = None,
) -> None:
self._parser = parser
argparse.ArgumentParser.__init__(
self,
super().__init__(
prog=prog,
usage=parser._usage,
add_help=False,
@ -486,7 +485,7 @@ class DropShorterLongHelpFormatter(argparse.HelpFormatter):
super().__init__(*args, **kwargs)
def _format_action_invocation(self, action: argparse.Action) -> str:
orgstr = argparse.HelpFormatter._format_action_invocation(self, action)
orgstr = super()._format_action_invocation(action)
if orgstr and orgstr[0] != "-": # only optional arguments
return orgstr
res: Optional[str] = getattr(action, "_formatted_action_invocation", None)

View File

@ -190,8 +190,7 @@ def _init_runner_class() -> Type["doctest.DocTestRunner"]:
optionflags: int = 0,
continue_on_failure: bool = True,
) -> None:
doctest.DebugRunner.__init__(
self, checker=checker, verbose=verbose, optionflags=optionflags
super().__init__(checker=checker, verbose=verbose, optionflags=optionflags
)
self.continue_on_failure = continue_on_failure
@ -513,8 +512,7 @@ class DoctestModule(pytest.Module):
if isinstance(obj, property):
obj = getattr(obj, "fget", obj)
# Type ignored because this is a private function.
return doctest.DocTestFinder._find_lineno( # type: ignore
self,
return super()._find_lineno(
obj,
source_lines,
)
@ -527,8 +525,7 @@ class DoctestModule(pytest.Module):
with _patch_unwrap_mock_aware():
# Type ignored because this is a private function.
doctest.DocTestFinder._find( # type: ignore
self, tests, obj, name, module, source_lines, globs, seen
super()._find(tests, obj, name, module, source_lines, globs, seen
)
if self.path.name == "conftest.py":
@ -613,7 +610,7 @@ def _init_checker_class() -> Type["doctest.OutputChecker"]:
)
def check_output(self, want: str, got: str, optionflags: int) -> bool:
if doctest.OutputChecker.check_output(self, want, got, optionflags):
if super().check_output(want, got, optionflags):
return True
allow_unicode = optionflags & _get_allow_unicode_flag()
@ -637,7 +634,7 @@ def _init_checker_class() -> Type["doctest.OutputChecker"]:
if allow_number:
got = self._remove_unwanted_precision(want, got)
return doctest.OutputChecker.check_output(self, want, got, optionflags)
return super().check_output(want, got, optionflags)
def _remove_unwanted_precision(self, want: str, got: str) -> str:
wants = list(self._number_re.finditer(want))

View File

@ -784,7 +784,7 @@ class _LiveLoggingStreamHandler(logging.StreamHandler):
terminal_reporter: TerminalReporter,
capture_manager: Optional[CaptureManager],
) -> None:
logging.StreamHandler.__init__(self, stream=terminal_reporter) # type: ignore[arg-type]
super().__init__(stream=terminal_reporter) # type: ignore[arg-type]
self.capture_manager = capture_manager
self.reset()
self.set_when(None)

View File

@ -33,7 +33,7 @@ class OutcomeException(BaseException):
"Perhaps you meant to use a mark?"
)
raise TypeError(error_msg.format(type(self).__name__, type(msg).__name__))
BaseException.__init__(self, msg)
super().__init__(msg)
self.msg = msg
self.pytrace = pytrace
@ -61,7 +61,7 @@ class Skipped(OutcomeException):
*,
_use_item_location: bool = False,
) -> None:
OutcomeException.__init__(self, msg=msg, pytrace=pytrace)
super().__init__(msg=msg, pytrace=pytrace)
self.allow_module_level = allow_module_level
# If true, the skip location is reported as the item's location,
# instead of the place that raises the exception/calls skip().

View File

@ -221,7 +221,7 @@ class ApproxNumpy(ApproxBase):
if not np.isscalar(actual) and actual.shape != self.expected.shape:
return False
return ApproxBase.__eq__(self, actual)
return super().__eq__(actual)
def _yield_comparisons(self, actual):
import numpy as np
@ -292,7 +292,7 @@ class ApproxMapping(ApproxBase):
except AttributeError:
return False
return ApproxBase.__eq__(self, actual)
return super().__eq__(actual)
def _yield_comparisons(self, actual):
for k in self.expected.keys():
@ -365,7 +365,7 @@ class ApproxSequencelike(ApproxBase):
return False
except TypeError:
return False
return ApproxBase.__eq__(self, actual)
return super().__eq__(actual)
def _yield_comparisons(self, actual):
return zip(actual, self.expected)

View File

@ -322,7 +322,7 @@ class TestCaseFunction(Function):
def _prunetraceback(
self, excinfo: _pytest._code.ExceptionInfo[BaseException]
) -> None:
Function._prunetraceback(self, excinfo)
super()._prunetraceback(excinfo)
traceback = excinfo.traceback.filter(
lambda x: not x.frame.f_globals.get("__unittest")
)