Exceptions¶
this module contains exceptions used in the astroid library
Classes
BinaryOperationError |
alias of astroid.util.BadBinaryOperationMessage |
OperationError |
alias of astroid.util.BadOperationMessage |
UnaryOperationError |
alias of astroid.util.BadUnaryOperationMessage |
Exceptions
AstroidBuildingError ([message]) |
exception class when we are unable to build an astroid representation |
AstroidBuildingException |
alias of astroid.exceptions.AstroidBuildingError |
AstroidError ([message]) |
base exception class for all astroid related exceptions |
AstroidImportError ([message]) |
Exception class used when a module can’t be imported by astroid. |
AstroidIndexError ([message]) |
Raised when an Indexable / Mapping does not have an index / key. |
AstroidSyntaxError ([message]) |
Exception class used when a module can’t be parsed. |
AstroidTypeError ([message]) |
Raised when a TypeError would be expected in Python code. |
AttributeInferenceError ([message]) |
Raised when an attribute lookup fails, corresponds to AttributeError. |
DuplicateBasesError ([message]) |
Error raised when there are duplicate bases in the same class bases. |
InconsistentMroError ([message]) |
Error raised when a class’s MRO is inconsistent. |
InferenceError ([message]) |
raised when we are unable to infer a node |
MroError ([message]) |
Error raised when there is a problem with method resolution of a class. |
NameInferenceError ([message]) |
Raised when a name lookup fails, corresponds to NameError. |
NoDefault ([message]) |
raised by function’s default_value method when an argument has no default value |
NotFoundError |
alias of astroid.exceptions.AttributeInferenceError |
ResolveError ([message]) |
Base class of astroid resolution/inference error. |
SuperArgumentTypeError |
alias of astroid.exceptions.SuperError |
SuperError ([message]) |
Error raised when there is a problem with a super call. |
TooManyLevelsError ([message]) |
Exception class which is raised when a relative import was beyond the top-level. |
UnresolvableName |
alias of astroid.exceptions.NameInferenceError |
UseInferenceDefault |
exception to be raised in custom inference function to indicate that it should go back to the default behaviour |
-
exception
astroid.exceptions.
AstroidBuildingError
(message='Failed to import module {modname}.', **kws)[source]¶ Bases:
astroid.exceptions.AstroidError
exception class when we are unable to build an astroid representation
- Standard attributes:
- modname: Name of the module that AST construction failed for. error: Exception raised during construction.
-
astroid.exceptions.
AstroidBuildingException
¶
-
exception
astroid.exceptions.
AstroidError
(message='', **kws)[source]¶ Bases:
Exception
base exception class for all astroid related exceptions
AstroidError and its subclasses are structured, intended to hold objects representing state when the exception is thrown. Field values are passed to the constructor as keyword-only arguments. Each subclass has its own set of standard fields, but use your best judgment to decide whether a specific exception instance needs more or fewer fields for debugging. Field values may be used to lazily generate the error message: self.message.format() will be called with the field names and values supplied as keyword arguments.
-
exception
astroid.exceptions.
AstroidImportError
(message='Failed to import module {modname}.', **kws)[source]¶ Bases:
astroid.exceptions.AstroidBuildingError
Exception class used when a module can’t be imported by astroid.
-
exception
astroid.exceptions.
AstroidIndexError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.AstroidError
Raised when an Indexable / Mapping does not have an index / key.
-
exception
astroid.exceptions.
AstroidSyntaxError
(message='Failed to import module {modname}.', **kws)[source]¶ Bases:
astroid.exceptions.AstroidBuildingError
Exception class used when a module can’t be parsed.
-
exception
astroid.exceptions.
AstroidTypeError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.AstroidError
Raised when a TypeError would be expected in Python code.
-
exception
astroid.exceptions.
AstroidValueError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.AstroidError
Raised when a ValueError would be expected in Python code.
-
exception
astroid.exceptions.
AttributeInferenceError
(message='{attribute!r} not found on {target!r}.', **kws)[source]¶ Bases:
astroid.exceptions.ResolveError
Raised when an attribute lookup fails, corresponds to AttributeError.
- Standard attributes:
- target: The node for which lookup failed. attribute: The attribute for which lookup failed, as a string. context: InferenceContext object.
-
attribute
= None¶
-
target
= None¶
-
exception
astroid.exceptions.
DuplicateBasesError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.MroError
Error raised when there are duplicate bases in the same class bases.
-
exception
astroid.exceptions.
InconsistentMroError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.MroError
Error raised when a class’s MRO is inconsistent.
-
exception
astroid.exceptions.
InferenceError
(message='Inference failed for {node!r}.', **kws)[source]¶ Bases:
astroid.exceptions.ResolveError
raised when we are unable to infer a node
- Standard attributes:
- node: The node inference was called on. context: InferenceContext object.
-
context
= None¶
-
node
= None¶
-
exception
astroid.exceptions.
InferenceOverwriteError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.AstroidError
Raised when an inference tip is overwritten
Currently only used for debugging.
-
exception
astroid.exceptions.
MroError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.ResolveError
Error raised when there is a problem with method resolution of a class.
- Standard attributes:
- mros: A sequence of sequences containing ClassDef nodes. cls: ClassDef node whose MRO resolution failed. context: InferenceContext object.
-
cls
= None¶
-
mros
= ()¶
-
exception
astroid.exceptions.
NameInferenceError
(message='{name!r} not found in {scope!r}.', **kws)[source]¶ Bases:
astroid.exceptions.InferenceError
Raised when a name lookup fails, corresponds to NameError.
- Standard attributes:
- name: The name for which lookup failed, as a string. scope: The node representing the scope in which the lookup occurred. context: InferenceContext object.
-
name
= None¶
-
scope
= None¶
-
exception
astroid.exceptions.
NoDefault
(message='{func!r} has no default for {name!r}.', **kws)[source]¶ Bases:
astroid.exceptions.AstroidError
raised by function’s default_value method when an argument has no default value
- Standard attributes:
- func: Function node. name: Name of argument without a default.
-
func
= None¶
-
name
= None¶
-
astroid.exceptions.
NotFoundError
¶
-
exception
astroid.exceptions.
ResolveError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.AstroidError
Base class of astroid resolution/inference error.
ResolveError is not intended to be raised.
- Standard attributes:
- context: InferenceContext object.
-
context
= None¶
-
astroid.exceptions.
SuperArgumentTypeError
¶ alias of
astroid.exceptions.SuperError
-
exception
astroid.exceptions.
SuperError
(message='', **kws)[source]¶ Bases:
astroid.exceptions.ResolveError
Error raised when there is a problem with a super call.
- Standard attributes:
- super_: The Super instance that raised the exception. context: InferenceContext object.
-
super_
= None¶
-
exception
astroid.exceptions.
TooManyLevelsError
(message='Relative import with too many levels ({level}) for module {name!r}', **kws)[source]¶ Bases:
astroid.exceptions.AstroidImportError
Exception class which is raised when a relative import was beyond the top-level.
- Standard attributes:
- level: The level which was attempted. name: the name of the module on which the relative import was attempted.
-
level
= None¶
-
name
= None¶
-
astroid.exceptions.
UnresolvableName
¶