MCPcopy Create free account
hub / github.com/rthalley/dnspython / __init__

Method __init__

dns/exception.py:55–69  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

53 fmt: str | None = None # message parametrized with results from _fmt_kwargs
54
55 def __init__(self, *args, **kwargs):
56 self._check_params(*args, **kwargs)
57 if kwargs:
58 # This call to a virtual method from __init__ is ok in our usage
59 self.kwargs = self._check_kwargs(**kwargs) # lgtm[py/init-calls-subclass]
60 self.msg = str(self)
61 else:
62 self.kwargs = dict() # defined but empty for old mode exceptions
63 if self.msg is None:
64 # doc string is better implicit message than empty string
65 self.msg = self.__doc__
66 if args:
67 super().__init__(*args)
68 else:
69 super().__init__(self.msg)
70
71 def _check_params(self, *args, **kwargs):
72 """Old exceptions supported only args and not kwargs.

Callers

nothing calls this directly

Calls 3

_check_paramsMethod · 0.95
_check_kwargsMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected