I am trying to validate the following example straight from the docs -- Here I renamed the two methods _ from the example to _int and _bool to obviate an issue already reported, i.e., python/mypy#2904
fromfunctoolsimportsingledispatchmethodclassNegator:
@singledispatchmethoddefneg(self, arg):
raiseNotImplementedError("Cannot negate a")
@neg.registerdef_int(self, arg: int):
return-arg@neg.registerdef_bool(self, arg: bool):
returnnotargn=Negator()
n.neg(2)
n.neg(True)When I run mypy checks on this file, I get the following errors:
negator.py:17: error: "singledispatchmethod[Any]" not callable
negator.py:18: error: "singledispatchmethod[Any]" not callable
Found 2 errors in 1 file (checked 1 source file)
Python 3.8.2
mypy 0.770
I am trying to validate the following example straight from the docs -- Here I renamed the two methods
_from the example to_intand_boolto obviate an issue already reported, i.e., python/mypy#2904When I run mypy checks on this file, I get the following errors:
Python 3.8.2
mypy 0.770