Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wiseplat
GitHub Repository: wiseplat/python-code
Path: blob/master/ invest-robot-contest_TinkoffBotTwitch-main/venv/lib/python3.8/site-packages/attr/exceptions.py
7759 views
1
# SPDX-License-Identifier: MIT
2
3
from __future__ import absolute_import, division, print_function
4
5
6
class FrozenError(AttributeError):
7
"""
8
A frozen/immutable instance or attribute have been attempted to be
9
modified.
10
11
It mirrors the behavior of ``namedtuples`` by using the same error message
12
and subclassing `AttributeError`.
13
14
.. versionadded:: 20.1.0
15
"""
16
17
msg = "can't set attribute"
18
args = [msg]
19
20
21
class FrozenInstanceError(FrozenError):
22
"""
23
A frozen instance has been attempted to be modified.
24
25
.. versionadded:: 16.1.0
26
"""
27
28
29
class FrozenAttributeError(FrozenError):
30
"""
31
A frozen attribute has been attempted to be modified.
32
33
.. versionadded:: 20.1.0
34
"""
35
36
37
class AttrsAttributeNotFoundError(ValueError):
38
"""
39
An ``attrs`` function couldn't find an attribute that the user asked for.
40
41
.. versionadded:: 16.2.0
42
"""
43
44
45
class NotAnAttrsClassError(ValueError):
46
"""
47
A non-``attrs`` class has been passed into an ``attrs`` function.
48
49
.. versionadded:: 16.2.0
50
"""
51
52
53
class DefaultAlreadySetError(RuntimeError):
54
"""
55
A default has been set using ``attr.ib()`` and is attempted to be reset
56
using the decorator.
57
58
.. versionadded:: 17.1.0
59
"""
60
61
62
class UnannotatedAttributeError(RuntimeError):
63
"""
64
A class with ``auto_attribs=True`` has an ``attr.ib()`` without a type
65
annotation.
66
67
.. versionadded:: 17.3.0
68
"""
69
70
71
class PythonTooOldError(RuntimeError):
72
"""
73
It was attempted to use an ``attrs`` feature that requires a newer Python
74
version.
75
76
.. versionadded:: 18.2.0
77
"""
78
79
80
class NotCallableError(TypeError):
81
"""
82
A ``attr.ib()`` requiring a callable has been set with a value
83
that is not callable.
84
85
.. versionadded:: 19.2.0
86
"""
87
88
def __init__(self, msg, value):
89
super(TypeError, self).__init__(msg, value)
90
self.msg = msg
91
self.value = value
92
93
def __str__(self):
94
return str(self.msg)
95
96