2
2
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
3
3
# Copyright (c) https://github.com/PyCQA/astroid/blob/main/CONTRIBUTORS.txt
4
4
5
- """this module contains exceptions used in the astroid library
6
- """
5
+ """This module contains exceptions used in the astroid library."""
7
6
8
7
from __future__ import annotations
9
8
49
48
50
49
51
50
class AstroidError (Exception ):
52
- """base exception class for all astroid related exceptions
51
+ """Base exception class for all astroid related exceptions.
53
52
54
53
AstroidError and its subclasses are structured, intended to hold
55
54
objects representing state when the exception is thrown. Field
@@ -73,7 +72,7 @@ def __str__(self) -> str:
73
72
74
73
75
74
class AstroidBuildingError (AstroidError ):
76
- """exception class when we are unable to build an astroid representation
75
+ """Exception class when we are unable to build an astroid representation.
77
76
78
77
Standard attributes:
79
78
modname: Name of the module that AST construction failed for.
@@ -140,8 +139,8 @@ def __init__(
140
139
141
140
142
141
class NoDefault (AstroidError ):
143
- """raised by function's `default_value` method when an argument has
144
- no default value
142
+ """Raised by function's `default_value` method when an argument has
143
+ no default value.
145
144
146
145
Standard attributes:
147
146
func: Function node.
@@ -228,7 +227,7 @@ def __str__(self) -> str:
228
227
229
228
230
229
class InferenceError (ResolveError ): # pylint: disable=too-many-instance-attributes
231
- """raised when we are unable to infer a node
230
+ """Raised when we are unable to infer a node.
232
231
233
232
Standard attributes:
234
233
node: The node inference was called on.
@@ -332,13 +331,15 @@ def __init__(
332
331
333
332
334
333
class UseInferenceDefault (Exception ):
335
- """exception to be raised in custom inference function to indicate that it
336
- should go back to the default behaviour
334
+ """Exception to be raised in custom inference function to indicate that it
335
+ should go back to the default behaviour.
337
336
"""
338
337
339
338
340
339
class _NonDeducibleTypeHierarchy (Exception ):
341
- """Raised when is_subtype / is_supertype can't deduce the relation between two types."""
340
+ """Raised when is_subtype / is_supertype can't deduce the relation between two
341
+ types.
342
+ """
342
343
343
344
344
345
class AstroidIndexError (AstroidError ):
@@ -380,14 +381,14 @@ class AstroidValueError(AstroidError):
380
381
381
382
382
383
class InferenceOverwriteError (AstroidError ):
383
- """Raised when an inference tip is overwritten
384
+ """Raised when an inference tip is overwritten.
384
385
385
386
Currently only used for debugging.
386
387
"""
387
388
388
389
389
390
class ParentMissingError (AstroidError ):
390
- """Raised when a node which is expected to have a parent attribute is missing one
391
+ """Raised when a node which is expected to have a parent attribute is missing one.
391
392
392
393
Standard attributes:
393
394
target: The node for which the parent lookup failed.
@@ -399,7 +400,9 @@ def __init__(self, target: nodes.NodeNG) -> None:
399
400
400
401
401
402
class StatementMissing (ParentMissingError ):
402
- """Raised when a call to node.statement() does not return a node. This is because
403
+ """Raised when a call to node.statement() does not return a node.
404
+
405
+ This is because
403
406
a node in the chain does not have a parent attribute and therefore does not
404
407
return a node for statement().
405
408
0 commit comments