관리-도구
편집 파일: exc.cpython-39.opt-1.pyc
a ����f�Wc�8����������������������@���s���d�Z�G�dd��de�ZG�dd��de�ZG�dd��de�ZG�dd��de�ZG�d d ��d e�ZG�dd��de�ZG�d d��de�Z G�dd��de�Z G�dd��de �ZG�dd��de �ZG�dd��de �Z G�dd��de�ZG�dd��de�ZG�dd��de�ZG�dd��de�ZG�dd ��d e�ZG�d!d"��d"e�Zd#d$��Zd%d&��Zd'd(��Zd)d*��Zd?d,d-�Zd@d.d/�ZdAd0d1�ZdBd2d3�ZdCd4d5�ZdDd7d8�Zd6ZdEd:d;�Z dFd=d>�Z!d+S�)Gz6passlib.exc -- exceptions & warnings raised by passlibc�������������������@���s���e�Zd�ZdZdd��ZdS�)�UnknownBackendErrorz� Error raised if multi-backend handler doesn't recognize backend name. Inherits from :exc:`ValueError`. .. versionadded:: 1.7 c�����������������C���s*���||�_�||�_d|j|f�}t�|�|��d�S�)Nz%s: unknown backend: %r)�hasher�backend�name� ValueError�__init__)�selfr���r����message��r ����//usr/lib/python3.9/site-packages/passlib/exc.pyr������s����zUnknownBackendError.__init__N��__name__� __module__�__qualname__�__doc__r���r ���r ���r ���r ���r������s���r���c�������������������@���s���e�Zd�ZdZdS�)�MissingBackendErrora���Error raised if multi-backend handler has no available backends; or if specifically requested backend is not available. :exc:`!MissingBackendError` derives from :exc:`RuntimeError`, since it usually indicates lack of an external library or OS feature. This is primarily raised by handlers which depend on external libraries (which is currently just :class:`~passlib.hash.bcrypt`). N�r���r ���r���r���r ���r ���r ���r ���r������s���r���c�������������������@���s���e�Zd�ZdZdS�)�InternalBackendErrorz� Error raised if something unrecoverable goes wrong with backend call; such as if ``crypt.crypt()`` returning a malformed hash. .. versionadded:: 1.7.3 Nr���r ���r ���r ���r ���r���#���s���r���c�������������������@���s���e�Zd�ZdZdS�)�PasswordValueErrora��� Error raised if a password can't be hashed / verified for various reasons. This exception derives from the builtin :exc:`!ValueError`. May be thrown directly when password violates internal invariants of hasher (e.g. some don't support NULL characters). Hashers may also throw more specific subclasses, such as :exc:`!PasswordSizeError`. .. versionadded:: 1.7.3 Nr���r ���r ���r ���r ���r���,���s��� r���c�������������������@���s���e�Zd�ZdZdZddd�ZdS�)�PasswordSizeErrora�� Error raised if a password exceeds the maximum size allowed by Passlib (by default, 4096 characters); or if password exceeds a hash-specific size limitation. This exception derives from :exc:`PasswordValueError` (above). Many password hash algorithms take proportionately larger amounts of time and/or memory depending on the size of the password provided. This could present a potential denial of service (DOS) situation if a maliciously large password is provided to an application. Because of this, Passlib enforces a maximum size limit, but one which should be *much* larger than any legitimate password. :exc:`PasswordSizeError` derives from :exc:`!ValueError`. .. note:: Applications wishing to use a different limit should set the ``PASSLIB_MAX_PASSWORD_SIZE`` environmental variable before Passlib is loaded. The value can be any large positive integer. .. attribute:: max_size indicates the maximum allowed size. .. versionadded:: 1.6 Nc�����������������C���s"���||�_�|d�u�rd}t�|�|��d�S�)Nz%password exceeds maximum allowed size)�max_sizer���r���)r���r����msgr ���r ���r ���r���X���s����zPasswordSizeError.__init__)N)r���r ���r���r���r���r���r ���r ���r ���r ���r���:���s���r���c�������������������@���s���e�Zd�ZdZddd�ZdS�)�PasswordTruncateErrora]�� Error raised if password would be truncated by hash. This derives from :exc:`PasswordSizeError` (above). Hashers such as :class:`~passlib.hash.bcrypt` can be configured to raises this error by setting ``truncate_error=True``. .. attribute:: max_size indicates the maximum allowed size. .. versionadded:: 1.7 Nc�����������������C���s,���|d�u�rd|j�|jf�}t�|�|j|��d�S�)Nz1Password too long (%s truncates to %d characters))r���Z truncate_sizer���r���)r����clsr���r ���r ���r ���r���p���s ���� �zPasswordTruncateError.__init__)Nr���r ���r ���r ���r ���r���a���s���r���c�������������������@���s���e�Zd�ZdZdS�)�PasslibSecurityErrorz� Error raised if critical security issue is detected (e.g. an attempt is made to use a vulnerable version of a bcrypt backend). .. versionadded:: 1.6.3 Nr���r ���r ���r ���r ���r���w���s���r���c�������������������@���s���e�Zd�ZdZdZddd�ZdS�)� TokenErrora��� Base error raised by v:mod:`passlib.totp` when a token can't be parsed / isn't valid / etc. Derives from :exc:`!ValueError`. Usually one of the more specific subclasses below will be raised: * :class:`MalformedTokenError` -- invalid chars, too few digits * :class:`InvalidTokenError` -- no match found * :class:`UsedTokenError` -- match found, but token already used .. versionadded:: 1.7 zToken not acceptableNc�����������������O���s,���|d�u�r|�j�}tj|�|g|�R�i�|���d�S��N)�_default_messager���r���)r���r����args�kwdsr ���r ���r ���r�������s����zTokenError.__init__)N)r���r ���r���r���r���r���r ���r ���r ���r ���r�������s���r���c�������������������@���s���e�Zd�ZdZdZdS�)�MalformedTokenErrorz� Error raised by :mod:`passlib.totp` when a token isn't formatted correctly (contains invalid characters, wrong number of digits, etc) zUnrecognized tokenN�r���r ���r���r���r���r ���r ���r ���r ���r�������s���r���c�������������������@���s���e�Zd�ZdZdZdS�)�InvalidTokenErrorz� Error raised by :mod:`passlib.totp` when a token is formatted correctly, but doesn't match any tokens within valid range. zToken did not matchNr ���r ���r ���r ���r ���r!�������s���r!���c�������������������@���s ���e�Zd�ZdZdZdZdd��ZdS�)�UsedTokenErrorz� Error raised by :mod:`passlib.totp` if a token is reused. Derives from :exc:`TokenError`. .. autoattribute:: expire_time .. versionadded:: 1.7 z5Token has already been used, please wait for another.Nc�����������������O���s*���|��dd��|�_tj|�g|�R�i�|���d�S�)N�expire_time)�popr#���r���r���)r���r���r���r ���r ���r ���r�������s����zUsedTokenError.__init__)r���r ���r���r���r���r#���r���r ���r ���r ���r ���r"�������s���r"���c�������������������@���s"���e�Zd�ZdZddd�Zdd��ZdS�)�UnknownHashErrorar�� Error raised by :class:`~passlib.crypto.lookup_hash` if hash name is not recognized. This exception derives from :exc:`!ValueError`. As of version 1.7.3, this may also be raised if hash algorithm is known, but has been disabled due to FIPS mode (message will include phrase "disabled for fips"). As of version 1.7.4, this may be raised if a :class:`~passlib.context.CryptContext` is unable to identify the algorithm used by a password hash. .. versionadded:: 1.7 .. versionchanged: 1.7.3 added 'message' argument. .. versionchanged:: 1.7.4 altered call signature. Nc�����������������C���s.���||�_�|d�u�rd|�}||�_t�|�||��d�S�)Nzunknown hash algorithm: %r)�valuer���r���r���)r���r���r&���r ���r ���r ���r�������s ����zUnknownHashError.__init__c�����������������C���s���|�j�S�r���)r���)r���r ���r ���r ����__str__����s����zUnknownHashError.__str__)NN)r���r ���r���r���r���r'���r ���r ���r ���r ���r%�������s��� r%���c�������������������@���s���e�Zd�ZdZdS�)�PasslibWarningzxbase class for Passlib's user warnings, derives from the builtin :exc:`UserWarning`. .. versionadded:: 1.6 Nr���r ���r ���r ���r ���r(�������s���r(���c�������������������@���s���e�Zd�ZdZdS�)�PasslibConfigWarningaH��Warning issued when non-fatal issue is found related to the configuration of a :class:`~passlib.context.CryptContext` instance. This occurs primarily in one of two cases: * The CryptContext contains rounds limits which exceed the hard limits imposed by the underlying algorithm. * An explicit rounds value was provided which exceeds the limits imposed by the CryptContext. In both of these cases, the code will perform correctly & securely; but the warning is issued as a sign the configuration may need updating. .. versionadded:: 1.6 Nr���r ���r ���r ���r ���r)�������s���r)���c�������������������@���s���e�Zd�ZdZdS�)�PasslibHashWarninga���Warning issued when non-fatal issue is found with parameters or hash string passed to a passlib hash class. This occurs primarily in one of two cases: * A rounds value or other setting was explicitly provided which exceeded the handler's limits (and has been clamped by the :ref:`relaxed<relaxed-keyword>` flag). * A malformed hash string was encountered which (while parsable) should be re-encoded. .. versionadded:: 1.6 Nr���r ���r ���r ���r ���r*�������s���r*���c�������������������@���s���e�Zd�ZdZdS�)�PasslibRuntimeWarninga8��Warning issued when something unexpected happens during runtime. The fact that it's a warning instead of an error means Passlib was able to correct for the issue, but that it's anomalous enough that the developers would love to hear under what conditions it occurred. .. versionadded:: 1.6 Nr���r ���r ���r ���r ���r+�����s���r+���c�������������������@���s���e�Zd�ZdZdS�)�PasslibSecurityWarningzxSpecial warning issued when Passlib encounters something that might affect security. .. versionadded:: 1.6 Nr���r ���r ���r ���r ���r,�����s���r,���c�����������������C���s���|�r |�j�S�dS�)Nz <unnamed>)r�����handlerr ���r ���r ���� _get_name"��s����r/���c�����������������C���s<���|�j�}|jr&|jdvr&d|j|jf�S�|�du�r2dS�|jS�dS�)z<return pretty-printed string containing name of value's type)Z__builtin__�builtinsz%s.%sN�None)� __class__r ���r���)r&���r���r ���r ���r ���� type_name(��s����r3���c�����������������C���s���t�|��}td|||f��S�)zGerror message when param was supposed to be one type, but found anotherz%s must be %s, not %s)r3���� TypeError)r&���Zexpected�paramr���r ���r ���r ����ExpectedTypeError2��s����r6���c�����������������C���s���t�|�d|�S�)z<error message when param was supposed to be unicode or byteszunicode or bytes)r6����r&���r5���r ���r ���r ����ExpectedStringError8��s����r8���Nc�����������������C���s���t�|��}td||f��S�)zEraised when verify() method gets passed config string instead of hashz.expected %s hash, got %s config string instead�r/���r����r.���r���r ���r ���r ����MissingDigestError?��s�����r;���c�����������������C���s���t�|��}td|��S�)zFraised by OS crypt() supporting hashes, which forbid NULLs in passwordz(%s does not allow NULL bytes in password)r/���r���r:���r ���r ���r ����NullPasswordErrorE��s����r<���c�����������������C���s���t�dt|����S�)z5error raised if unrecognized hash provided to handlerznot a valid %s hash)r���r/���r-���r ���r ���r ����InvalidHashErrorM��s����r=���c�����������������C���s$���dt�|���}|rd||f�}t|�S�)zAerror raised if recognized-but-malformed hash provided to handlerzmalformed %s hashz%s (%s)r9���)r.����reason�textr ���r ���r ����MalformedHashErrorQ��s����r@���c�����������������C���s ���t�|�d�S�)zJerror raised if hash was recognized but contained zero-padded rounds fieldzzero-padded rounds)r@���r-���r ���r ���r ����ZeroPaddedRoundsErrorX��s����rA���Fc�����������������C���s(���|�j�}|rdnd}d||f�}t|�|�S�)z@error raised if hash was recognized, but checksum was wrong size�bytes�charszchecksum must be exactly %d %s)� checksum_sizer@���)r.����rawrD���Zunitr>���r ���r ���r ����ChecksumSizeError_��s����rF����hashc�����������������C���s.���t�s|�du�st|�t�rt|��S�d|t|��f�S�)a��� helper used to display sensitive data (hashes etc) within error messages. currently returns placeholder test UNLESS unittests are running, in which case the real value is displayed. mainly useful to prevent hashes / secrets from being exposed in production tracebacks; while still being visible from test failures. NOTE: api subject to change, may formalize this more in the future. Nz<%s %s value omitted>)�ENABLE_DEBUG_ONLY_REPR� isinstance�bool�repr�typer7���r ���r ���r ����debug_only_reprp��s����rM���� crypt.crypt()c�����������������C���s,���t�|��}d||t|�t|�f�}t|��dS�)z� helper to generate standard message when ``crypt.crypt()`` returns invalid result. takes care of automatically masking contents of config & hash outside of UTs. z.%s returned invalid %s hash: config=%s hash=%sN)r/���rM���r���)r.���ZconfigrG����sourcer���r���r ���r ���r ����CryptBackendError���s �����rP���)N)N)N)NN)N)F)rG���)rN���)"r���r���r����RuntimeErrorr���r���r���r���r���r���r���r���r!���r"���r%����UserWarningr(���r)���r*���r+���r,���r/���r3���r6���r8���r;���r<���r=���r@���rA���rF���rH���rM���rP���r ���r ���r ���r ����<module>���s>��� ' ! ��