
    (phR                         S r SSKrSSKrSSKJr  SSKJr  Sr " S S5      r	\	" 5       r
\
R                  r\
R                  rg)z
humanhash: Human-readable representations of digests.

The simplest ways to use this module are the :func:`humanize` and :func:`uuid`
functions. For tighter control over the output, see :class:`HumanHasher`.
    N)ArgumentError)reduce(   ackalabamaalaninealaskaalphaangelapartaprilarizonaarkansasartist	asparagusaspenaugustautumnavocadobaconbakerloobatmanbeerberlin	berylliumblackblossombluebluebirdbravobulldogburgerbutter
californiacarboncardinalcarolinacarpetcatceilingcharliechickencoffeecolacoldcoloradocometconnecticutcrazycupdakotadecemberdelawaredeltadietdondoubleearlyeartheastechoedwardeighteighteenelevenemmaenemyequalfailedfantafifteenfilletfinchfishfivefixfloorfloridafootballfourfourteenfoxtrotfreddiefriendfruitgeegeorgiaglucosegolfgreengreyhamperhappyharryhawaiiheliumhighhothotelhydrogenidahoillinoisindiaindigoinkiowaislanditemjerseyjigjohnnyjulietjulyjupiterkansaskentuckykilokingkittenlactoselakelamplemonleopardlimalionlithiumlondon	louisianalowmagazine	magnesiummainemangomarchmarsmarylandmassachusettsmaymexicomichiganmike	minnesotamirrormississippimissourimobilemockingbirdmonkeymontanamoonmountainmuppetmusicnebraskaneptunenetworknevadaninenineteennitrogennorthnovembernutsoctoberohiooklahomaoneorangeorangesoregonoscarovenoxygenpapaparispastapennsylvaniapippizzaplutopotatoprincesspurplequebecqueenquietredriverrobertrobinromeorugbysadsalamisaturn	septemberseven	seventeenshadesierrasinglesinksixsixteenskylarksnakesocialsodiumsolarsouth	spaghettispeakerspringstairwaysteakstreamsummersweettabletangoten	tennesseetennistexasthirteenthreetimingtripletwelvetwentytwouncleundressuniformuranusutahveganvenusvermontvictorvideovioletvirginia
washingtonwestwhiskeywhitewilliamwinnerwinter	wisconsinwolframwyomingxrayyankeeyellowzebrazuluc                   D    \ rS rSrSr\4S jrS	S jr\S 5       r	S r
Srg)
HumanHasheri  a  
Transforms hex digests to human-readable strings.

The format of these strings will look something like:
`victor-bacon-zulu-lima`. The output is obtained by compressing the input
digest to a fixed number of bytes, then mapping those bytes to one of 256
words. A default wordlist is provided, but you can override this if you
prefer.

As long as you use the same wordlist, the output will be consistent (i.e.
the same digest will always render the same representation).
c                 D    [        U5      S:w  a  [        S5      eXl        g )N   z$Wordlist must have exactly 256 items)lenr   wordlist)selfr
  s     E/var/www/html/venv/lib/python3.13/site-packages/django_q/humanhash.py__init__HumanHasher.__init__  s    x=C FGG     c                   ^  [        [        SR                  [        [        USSS2   USSS2   5      5      5      5       Vs/ s H  n[	        US5      PM     nnT R                  XR5      nUR                  U 4S jU 5       5      $ s  snf )a  
Humanize a given hexadecimal digest.

Change the number of words output by specifying `words`. Change the
word separator with `separator`.

    >>> digest = '60ad8d0d871b6095808297'
    >>> HumanHasher().humanize(digest)
    'sodium-magnesium-nineteen-hydrogen'
 N         c              3   B   >#    U  H  nTR                   U   v   M     g 7f)Nr
  ).0byter  s     r  	<genexpr>'HumanHasher.humanize.<locals>.<genexpr>8  s     IjddmmD1js   )listmapjoinzipintcompress)r  	hexdigestwords	separatorxbytes
compresseds   `      r  humanizeHumanHasher.humanize$  s     #bggtC	#A#	!$Q$,P'QRS
S 2JS 	 

 ]]50
~~IjIII
s   Bc                     [        U 5      nX:  a  [        S5      eX!-  n[        U5       Vs/ s H  o@XC-  US-   U-   PM     nnUS   R                  XU-  S 5        S n[	        [        Xe5      5      nU$ s  snf )a  
Compress a list of byte values to a fixed target length.

    >>> bytes = [96, 173, 141, 13, 135, 27, 96, 149, 128, 130, 151]
    >>> HumanHasher.compress(bytes, 4)
    [205, 128, 156, 96]

Attempting to compress a smaller number of bytes to a larger number is
an error:

    >>> HumanHasher.compress(bytes, 15)  # doctest: +ELLIPSIS
    Traceback (most recent call last):
    ...
    ValueError: Fewer input bytes than requested output
z'Fewer input bytes than requested outputr  Nc                 8    [        [        R                  U S5      $ )Nr   )r   operatorxor)r%  s    r  checksum&HumanHasher.compress.<locals>.checksum[  s    (,,q11r  )r	  
ValueErrorrangeextendr  r  )r%  targetlengthseg_sizeisegmentsr.  	checksumss           r  r   HumanHasher.compress:  s    $ U?FGG # ?DFm
>K!,!a%8!34m 	 

 	E8"3"567	2 X01	
s   A7c                     [        [        R                  " 5       5      R                  SS5      nU R                  " U40 UD6U4$ )z
Generate a UUID with a human-readable representation.

Returns `(human_repr, full_digest)`. Accepts the same keyword arguments
as :meth:`humanize` (they'll be passed straight through).
-r  )struuidlibuuid4replacer'  )r  paramsdigests      r  uuidHumanHasher.uuida  s:     W]]_%--c26}}V.v.66r  r  N)   r;  )__name__
__module____qualname____firstlineno____doc__DEFAULT_WORDLISTr  r'  staticmethodr   rB  __static_attributes__ r  r  r  r    s1     !1 !
J, $ $L	7r  r  )rI  r,  rB  r=  argparser   	functoolsr   rJ  r  DEFAULT_HASHERr'  rM  r  r  <module>rQ     sN      " A HY7 Y7x ""r  