Updated aiohttp v3.12.12 -> v3.12.13 Updated attrs v23.1.0 -> v23.2.0 Updated blessed v1.19.1 -> v1.21.0 Updated cbor2 v4.0.1 -> v4.1.2 Updated compare-locales v9.0.1 -> v9.0.4 Updated distro v1.8.0 -> v1.9.0 Updated fluent-migrate v0.13.2 -> v0.13.3 Updated importlib-metadata v6.0.0 -> v6.11.0 Updated jsmin v3.0.0 -> v3.0.1 Updated json-e v4.5.3 -> v4.8.0 Updated looseversion v1.0.1 -> v1.3.0 Updated mozilla-taskgraph v3.3.1 -> v3.3.2 Updated multidict v6.4.4 -> v6.5.0 Updated pathspec v0.9.0 -> v0.12.1 Updated pyasn1 v0.4.8 -> v0.6.1 Updated pyasn1-modules v0.2.8 -> v0.4.2 Updated pylru v1.0.9 -> v1.2.1 Updated python-hglib v2.4 -> v2.6.2 Updated redo v2.0.3 -> v2.0.4 Updated requests-unixsocket v0.2.0 -> v0.4.1 Updated responses v0.10.6 -> v0.25.7 Updated rsa v4.9 -> v4.9.1 Updated sentry-sdk v1.14.0 -> v1.45.1 Updated six v1.16.0 -> v1.17.0 Updated tomlkit v0.12.3 -> v0.13.3 Updated tqdm v4.66.3 -> v4.67.1 Updated typing-extensions v4.12.2 -> v4.14.0 Updated voluptuous v0.12.1 -> v0.15.2 Updated yamllint v1.23.0 -> v1.37.1 Differential Revision: https://phabricator.services.mozilla.com/D254096
96 lines
1.9 KiB
Python
96 lines
1.9 KiB
Python
# SPDX-License-Identifier: MIT
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import ClassVar
|
|
|
|
|
|
class FrozenError(AttributeError):
|
|
"""
|
|
A frozen/immutable instance or attribute have been attempted to be
|
|
modified.
|
|
|
|
It mirrors the behavior of ``namedtuples`` by using the same error message
|
|
and subclassing `AttributeError`.
|
|
|
|
.. versionadded:: 20.1.0
|
|
"""
|
|
|
|
msg = "can't set attribute"
|
|
args: ClassVar[tuple[str]] = [msg]
|
|
|
|
|
|
class FrozenInstanceError(FrozenError):
|
|
"""
|
|
A frozen instance has been attempted to be modified.
|
|
|
|
.. versionadded:: 16.1.0
|
|
"""
|
|
|
|
|
|
class FrozenAttributeError(FrozenError):
|
|
"""
|
|
A frozen attribute has been attempted to be modified.
|
|
|
|
.. versionadded:: 20.1.0
|
|
"""
|
|
|
|
|
|
class AttrsAttributeNotFoundError(ValueError):
|
|
"""
|
|
An *attrs* function couldn't find an attribute that the user asked for.
|
|
|
|
.. versionadded:: 16.2.0
|
|
"""
|
|
|
|
|
|
class NotAnAttrsClassError(ValueError):
|
|
"""
|
|
A non-*attrs* class has been passed into an *attrs* function.
|
|
|
|
.. versionadded:: 16.2.0
|
|
"""
|
|
|
|
|
|
class DefaultAlreadySetError(RuntimeError):
|
|
"""
|
|
A default has been set when defining the field and is attempted to be reset
|
|
using the decorator.
|
|
|
|
.. versionadded:: 17.1.0
|
|
"""
|
|
|
|
|
|
class UnannotatedAttributeError(RuntimeError):
|
|
"""
|
|
A class with ``auto_attribs=True`` has a field without a type annotation.
|
|
|
|
.. versionadded:: 17.3.0
|
|
"""
|
|
|
|
|
|
class PythonTooOldError(RuntimeError):
|
|
"""
|
|
It was attempted to use an *attrs* feature that requires a newer Python
|
|
version.
|
|
|
|
.. versionadded:: 18.2.0
|
|
"""
|
|
|
|
|
|
class NotCallableError(TypeError):
|
|
"""
|
|
A field requiring a callable has been set with a value that is not
|
|
callable.
|
|
|
|
.. versionadded:: 19.2.0
|
|
"""
|
|
|
|
def __init__(self, msg, value):
|
|
super(TypeError, self).__init__(msg, value)
|
|
self.msg = msg
|
|
self.value = value
|
|
|
|
def __str__(self):
|
|
return str(self.msg)
|