
    -i                     >   d dl mZmZmZ d dlmZmZ d dlmZm	Z	m
Z
 ddlmZ ddlmZmZmZmZ dZdZ	 	 dd
eeef         dedeed	f         deed	f         def
dZddedefdZ ej                     dfd	d	dd
eeef         de
edf         dedede	e         f
dZd	S )    )choiceschoicerandint)ascii_lowercasedigits)UnionList	Annotated   )DAvatar)DStyleDOptionsDColor_stats_increase)create_avatarcreate_randombulk_createz
utility.pyNstyleseedoptionscustomisationsreturnc                     |rt          |t                    st          d          t          t          dd           t          | |||          S )a  
    Creates a DAvatar object and returns it.

    :param style: class `DStyle` :: the style of your avatar
    :param seed: class `str` :: the seed for the avatar; the avatar will be edited according to the seed
    :param options: class `DOptions` :: the options for the avatar
    :param customisations: class `dict` :: customisations for the specified avatar style
    :return: DAvatar object
    zSeed must be a non-empty string/z.create_avatar()r   custom)
isinstancestr
ValueErrorr   __filename__r   )r   r   r   r   s       N/var/www/html/speakWrite/venv/lib/python3.11/site-packages/dicebear/utility.pyr   r   &   sV      <z$,, <:;;;L#'9:::5$GGGG    FrandomOptionsc           	      
   t          t          dd           d}| rt          ddg          }t          j                    g}|dk    r&|                    t          j                               t          t          ddg          t          d |D                       |t          d	d
                    }t          t          j                    d
                    t          t          t          z   d                    |          S )z
    Creates a random DAvatar object and returns it.

    :param randomOptions: class `bool` :: whether to use random (background) options for this avatar or not
    :type randomOptions: bool
    :return: DAvatar object
    r   z.create_random()NsolidgradientLinearTFc                 ,    g | ]}t          |          S  )r   ).0xs     r!   
<listcomp>z!create_random.<locals>.<listcomp>L   s    #;#;#;qCFF#;#;#;r"   r   ih  )flipbackgroundColorbackgroundTypebackgroundRotation    k)r   )r   r    r   r   randomappendr   r   r   r   joinr   r   r   )r#   r   _type_colors       r!   r   r   ;   s     L#'9:::G 

!1233-//"$$$MM&-//***u&&"#;#;F#;#;#;<< &q#	
 
 
 
&0B77788   r"      r   amountzMin: 1, Max: 50r   c                   |dk    s|dk     rt          d          t          t          dd           | t          j                    } |i }|t
          j        }g }t          |          D ]}	 |                    t          | d
                    t          t          t          z   d	                    ||
                     Y# t          $ r}t          d|            Y d}~zd}~ww xY w|S )a  
    Creates a list of :py:class:`DAvatar` objects. Easy way to make multiple of the same style (but different randomly generated seeds) at once.

    :param style: class `DStyle` :: the style to apply to all avatars
    :type style: dicebear.models.DStyle
    :param amount: class `int` :: the amount of DAvatars to create. Default: 2, Min: 1, Max: 50
    :type amount: int
    :param options: class `DOptions` :: options for the avatar
    :type options: dicebear.models.DOptions
    :param custom: class `dict` :: customisations for the specified style
    :type custom: dict
    :return: list[DAvatar] :: a list with DAvatar objects
    2   r   z*argument `amount` must be between 1 and 50r   z.bulk_create()Nr0   r1   r2   r   zError creating DAvatar: )r   r   r    r   r4   r   emptyranger5   r   r6   r   r   r   	Exceptionprint)r   r:   r   r   result_es          r!   r   r   W   s   ( ||vzzEFFFL#'7888}~.F6]] 2 2
	2MMGGGOf$<CCCDD#!	       	2 	2 	20Q0011111111	2Ms   -AC
C)C$$C))NN)F)r4   r   r   r   stringr   r   typingr   r	   r
   avatarr   modelsr   r   r   r   __all__r    r   dictr   boolr   intr   r(   r"   r!   <module>rL      s  . , + + + + + + + + + * * * * * * * * ) ) ) ) ) ) ) ) ) )       = = = = = = = = = = = =
  &*(,	H HfH
H 8T>"H $*%	H
 H H H H*  '    : !.01* * * *f*c,,-* 	*
 * 
']* * * * * *r"   