Skip to content

AttributeError: module 'typing' has no attribute 'TypingMeta' #8

Description

@Hendiadyoin1

for some reason my program throws this error rooted in this lib. when i try to simply overload the init of my class.
Code:

from overloading import overload
import cmath

class Quaternion:
    def __init__(self, r: int, i: int, j: int, k: int):
        self.r = r
        self.i = i
        self.j = j
        self.k = k

    @overload
    def __init__(self, c: complex):
        self.r = c.real
        self.i = c.imag


print(Quaternion(1, 2, 3, 4).r)
print(Quaternion(1 + 2j).r)

Error:

Traceback (most recent call last):
File "C:...\Python\Python37\lib\site-packages\overloading.py", line 63, in overload
return register(__registry[fname], func)
KeyError: 'main.Quaternion.init'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:...\Python\Testing\quaternion.py", line 6, in
class Quaternion:
File "C:...\Python\Testing\quaternion.py", line 14, in Quaternion
def init(self, c: complex):
File "C:...\Python\Python37\lib\site-packages\overloading.py", line 65, in overload
registry[fname] = overloaded(func)
File "C:...\Python\Python37\lib\site-packages\overloading.py", line 151, in overloaded
return register(dispatcher, func)
File "C:...\Python\Python37\lib\site-packages\overloading.py", line 199, in register
signature = get_signature(fn)
File "C:...\Python\Python37\lib\site-packages\overloading.py", line 441, in get_signature
types = tuple(normalize_type(type_hints.get(param, AnyType)) for param in parameters)
File "C:...\Python\Python37\lib\site-packages\overloading.py", line 441, in
types = tuple(normalize_type(type_hints.get(param, AnyType)) for param in parameters)
File "C:...\Python\Python37\lib\site-packages\overloading.py", line 468, in normalize_type
if not typing or not isinstance(type
, typing.TypingMeta) or type
is AnyType:
AttributeError: module 'typing' has no attribute 'TypingMeta'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions