Files
django-stubs/mypy_django_plugin/transformers2/new_helpers.py
Maxim Kurnikov 1419b144d9 wip
2020-03-15 00:58:11 +03:00

31 lines
864 B
Python

from typing import Union
from mypy.nodes import TypeInfo, MypyFile
class IncompleteDefnError(Exception):
pass
class TypeInfoNotFound(IncompleteDefnError):
def __init__(self, fullname: str) -> None:
super().__init__(f'It is final iteration and required type {fullname!r} is not ready yet.')
class AttributeNotFound(IncompleteDefnError):
def __init__(self, node: Union[TypeInfo, MypyFile], attrname: str) -> None:
super().__init__(f'Attribute {attrname!r} is not defined for the {node.fullname!r}.')
class NameNotFound(IncompleteDefnError):
def __init__(self, name: str) -> None:
super().__init__(f'Could not find {name!r} in the current activated namespaces')
class SymbolAdditionNotPossible(Exception):
pass
def get_class_fullname(klass: type) -> str:
return klass.__module__ + '.' + klass.__qualname__