관리-도구
편집 파일: context.cpython-39.opt-1.pyc
a f�Wc�� � @ s� d Z ddlmZ ddlZddlZe�e�ZddlZddl Z ddl mZ ddlm Z ddlmZmZmZ ddlmZmZ ddlmZmZmZmZmZmZmZmZ dd lm Z dd l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z, ddl-m.Z.m/Z/ g d�Z0e1� Z2d d� Z3e4dg�Z5e6e7e7e7e3e7d�Z8dd� Z9e:d dd��Z;e4ddg�Z<dZ=G dd� de1�Z>G dd� de1�Z?G dd� de1�Z@G dd� de@�ZAdS )!z-passlib.context - CryptContext implementation� )�with_statementN)�warn)�exc)�ExpectedStringError�ExpectedTypeError�PasslibConfigWarning)�get_crypt_handler�_validate_handler_name)�handlers�to_bytes� to_unicode� splitcomma�as_bool�timer�rng� getrandstr)�BASE64_CHARS)� iteritems� num_types�irange�PY2�PY3�unicode�SafeConfigParser�NativeStringIO�BytesIO�unicode_or_bytes_types�native_string_types)�deprecated_method�memoized_property)�CryptContext�LazyCryptContext�CryptPolicyc C sF | � d�rt| �d��d S z t| �W S ty@ t| � Y S 0 dS )z>parse vary_rounds string to percent as [0,1) float, or integer�%�{�G�z�?N)�endswith�float�rstrip�int� ValueError��value� r, �3/usr/lib/python3.9/site-packages/passlib/context.py�_coerce_vary_rounds* s r. Zsalt)Z min_roundsZ max_roundsZdefault_rounds�vary_roundsZ salt_sizec C s t | jd�| u S )z3detect if handler is registered or a custom handlerN)r �name��handlerr, r, r- �_is_handler_registeredC s r3 c C s dS )z dummy function patched into handler.needs_update() by _CryptConfig when hash alg has been deprecated for context. Tr, )�hash�secretr, r, r- �_always_needs_updateG s r6 Ztruncate_errorr/ zaThe CryptPolicy class has been deprecated as of Passlib 1.6, and will be removed in Passlib 1.8. c @ s� e Zd ZdZed)dd��Zed*dd��Zed+d d ��Zed,dd��Zd d� Z dZ dZdd� Zdd� Z dd� Zd-dd�Zd.dd�Zd/dd�Zd0dd�Zd1dd �Zd2d!d"�Zd3d#d$�Zd4d%d&�Zd5d'd(�ZdS )6r"