관리-도구
편집 파일: punycode.cpython-36.opt-1.pyc
3 \� � @ s� d Z ddlZdd� Zdd� Zdd� Zd d � Zdd� Zd Zdd� Zdd� Z dd� Z dd� Zdd� Zdd� Z dd� ZG dd� dej�ZG dd� dej�ZG d d!� d!ej�ZG d"d#� d#eej�ZG d$d%� d%eej�Zd&d'� ZdS )(uY Codec for the Punicode encoding, as specified in RFC 3492 Written by Martin v. Löwis. � Nc C sT t � }t� }x2| D ]*}t|�dk r2|jt|�� q|j|� qW t|�}t|�|fS )z 3.1 Basic code point segregation� )� bytearray�set�ord�append�add�sorted�bytes)�str�base�extended�c� r �*/usr/lib64/python3.6/encodings/punycode.py� segregate s r c C s* d}x | D ]}t |�|k r |d7 }q W |S )z@Return the length of str, considering only characters below max.r � )r )r �max�resr r r r � selective_len s r c C sR t | �}xD|d7 }||krdS | | }||kr:|d |fS ||k r |d7 }q W dS )a Return a pair (index, pos), indicating the next occurrence of char in str. index is the position of the character considering only ordinals up to and including char, and pos is the position in the full string. index/pos is the starting position in the full string.r N���r )r r )�len)r �char�index�pos�lr r r r �selective_find s r c C s� d}g }d}x~|D ]v}d }}t |�}t| |�} | d || } xBt| |||�\}}|dkr^P | || 7 } |j| d � |}d} qBW |}qW |S )z3.2 Insertion unsort codingr r r r r r )r r r r )r r Zoldchar�resultZoldindexr r r r Zcurlen�deltar r r �insertion_unsort0 s$ r c C s, d| d | }|dk rdS |dkr(dS |S )N�$ r � r )�j�biasr r r r �TF s r# s$ abcdefghijklmnopqrstuvwxyz0123456789c C sr t � }d}xbt||�}| |k r4|jt| � t|�S |jt|| | d| � | | d| } |d7 }qW dS )z(3.3 Generalized variable-length integersr r r N)r r# r �digitsr )�Nr"