← Back
Editing: baseconv.cpython-311.pyc
� �|�e� � �� � d Z dZdZdZdZdZedz Z G d� d� � Z ee� � Z ee� � Z ee� � Z ee� � Z ee� � Z eed � � � Z dS )a� Convert numbers from base 10 integers to base X strings and back again. Sample usage:: >>> base20 = BaseConverter('0123456789abcdefghij') >>> base20.encode(1234) '31e' >>> base20.decode('31e') 1234 >>> base20.encode(-1234) '-31e' >>> base20.decode('-31e') -1234 >>> base11 = BaseConverter('0123456789-', sign='$') >>> base11.encode('$1234') '$-22' >>> base11.decode('$-22') '$1234' �01�0123456789ABCDEF�823456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz�$0123456789abcdefghijklmnopqrstuvwxyz�>0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzz-_c �2 � e Zd ZdZd d�Zd� Zd� Zd� Zd� ZdS ) � BaseConverter� 0123456789�-c �R � || _ || _ || j v rt d� � �d S )Nz.Sign character found in converter base digits.)�sign�digits� ValueError)�selfr r s �7/usr/lib/python3/dist-packages/django/utils/baseconv.py�__init__zBaseConverter.__init__3 s4 � ��� �����4�;����M�N�N�N� �� c �\ � d| j j �dt | j � � �d| j �d�S )N�<z: basez (z)>)� __class__�__name__�lenr )r s r �__repr__zBaseConverter.__repr__9 s6 � � �&*�n�&=�&=�&=�s�4�;�?O�?O�?O�?O�QU�Q\�Q\�Q\�]�]r c �h � | � || j | j d� � \ }}|r | j |z S |S �Nr )�convert�decimal_digitsr r )r �i�neg�values r �encodezBaseConverter.encode<