
    9 f]                        d dl Z d dlZd dlZddlmZmZmZmZmZ  ej	        d          Z
d Zd#dZ G d de          Z G d	 d
          Z G d d          Z G d d          Z G d d          Z G d d          Z G d dee          Zej        e_         G d d          Z G d de          Z G d de          Z G d de          Z G d de          Z G d  d!e          Zd" ZdS )$    N   )builderdeclarationsenumserrorsutilszfactory.generatec                     d | D             S )z8Retrieve all FactoryMetaClass-derived bases from a list.c                 <    g | ]}t          |t                    |S  )
issubclassBaseFactory).0bs     B/var/www/equiseq/venv/lib/python3.11/site-packages/factory/base.py
<listcomp>z%get_factory_bases.<locals>.<listcomp>   s'    ;;;!
1k : :;A;;;    r   )basess    r   get_factory_basesr      s    ;;u;;;;r   c                 T    |D ]$}t          ||           rt          ||           c S %|S )zAFind the first definition of an attribute according to MRO order.)hasattrgetattr)namer   defaultbases       r   resolve_attributer      sC     ' '4 	'4&&&&&	'Nr   c                   .     e Zd ZdZd Z fdZd Z xZS )FactoryMetaClassz4Factory metaclass for handling ordered declarations.c                 N   | j         j        t          j        k    r | j        di |S | j         j        t          j        k    r | j        di |S | j         j        t          j        k    r | j        di |S t          j
        d                    | j         j                            )zOverride the default Factory() syntax to call the default strategy.

        Returns an instance of the associated class.
        zUnknown Meta.strategy: {}Nr   )_metastrategyr   BUILD_STRATEGYbuildCREATE_STRATEGYcreateSTUB_STRATEGYstubr   UnknownStrategyformatclskwargss     r   __call__zFactoryMetaClass.__call__   s     9!55539&&v&&&Y5#8883:'''''Y5#66638%%f%%%()D)K)K	"*$ *$ % % %r   c                 ~   t          |          }|r	|d         }nd}|                    dd          }|                    dd          }t          d|          }t          d|t                    }	 |	            }
|
|d<   t	                                          | |||          }|
                    |||||           |S )a  Record attributes as a pattern for later instance construction.

        This is called when a new Factory subclass is defined; it will collect
        attribute declaration from the class definition.

        Args:
            class_name (str): the name of the class being created
            bases (list of class): the parents of the class being created
            attrs (str => obj dict): the attributes as defined in the class
                definition

        Returns:
            A new class
        r   NMetaParamsr   _options_class)meta	base_metabase_factoryparams)r   popr   FactoryOptionssuper__new__contribute_to_class)mcs
class_namer   attrsparent_factoriesr3   
attrs_metaattrs_paramsr2   options_classr1   	new_class	__class__s               r   r8   zFactoryMetaClass.__new__/   s     -U33 	 +A.LLLYYvt,,
yy400%gu55	)*:E>RR}gGGOOUE+ +	 	  % 	! 	
 	
 	
 r   c                 ^    | j         j        r
d| j        z  S d| j         d| j         j         dS )Nz<%s (abstract)>< for >)r   abstract__name__modelr*   s    r   __str__zFactoryMetaClass.__str__Z   s;    9 	=$s|33<s|<<#)/<<<<r   )rH   
__module____qualname____doc__r,   r8   rK   __classcell__)rB   s   @r   r   r      s]        >>% % % ) ) ) ) )V= = = = = = =r   r   c                        e Zd ZdZej        ZdS )BaseMetaTN)rH   rL   rM   rG   r   r#   r    r   r   r   rQ   rQ   a   s        H$HHHr   rQ   c                   &    e Zd ZdZddZd Zd ZdS )OptionDefaulta  The default for an option.

    Attributes:
        name: str, the name of the option ('class Meta' attribute)
        value: object, the default value for the option
        inherit: bool, whether to inherit the value from the parent factory's `class Meta`
            when no value is provided
        checker: callable or None, an optional function used to detect invalid option
            values at declaration time
    FNc                 >    || _         || _        || _        || _        d S N)r   valueinheritchecker)selfr   rV   rW   rX   s        r   __init__zOptionDefault.__init__q   s"    	
r   c                     | j         }| j        r|t          || j        |          }|t          || j        |          }| j        |                     ||           |S rU   )rV   rW   r   r   rX   )rY   r1   r2   rV   s       r   applyzOptionDefault.applyw   se    
< 	9I1Ity%88ED$)U33E<#LLu%%%r   c                 P    | j         j        d| j        d| j        d| j        dS )N(, z
, inherit=))rB   rH   r   rV   rW   rY   s    r   rK   zOptionDefault.__str__   s3    N###IIItzzz4<<<1 	1r   )FN)rH   rL   rM   rN   rZ   r\   rK   r   r   r   rS   rS   f   sP        	 	   
 
 
1 1 1 1 1r   rS   c                       e Zd Zd Zed             Zd Zd ZddZd Z	d Z
d	 ZddZd Zd Zd Zd Zd Zd Zd Zd ZdS )r6   c                     d | _         d | _        i | _        i | _        i | _        t          j                    | _        t          j                    | _        d | _	        d | _
        d S rU   )factoryr3   base_declarations
parametersparameters_dependenciesr   DeclarationSetpre_declarationspost_declarations_countercounter_referencera   s    r   rZ   zFactoryOptions.__init__   s_     !#')$ ' 6 8 8!(!7!9!9!%r   c                     t          | j                  }t          j        | j                                        d           D ].\  }}|                    |                    ||                     /|S )Nc                     | d         S Nr   r   items    r   <lambda>z-FactoryOptions.declarations.<locals>.<lambda>   s    cghicj r   getter)dictre   r   sort_ordered_objectsrf   itemsupdateas_declarations)rY   re   r   params       r   r   zFactoryOptions.declarations   sx     !788 5do6K6K6M6MVjVjkkk 	U 	UKD%$$U%:%:4AR%S%STTTT  r   c           
          d }t          ddd|          t          ddd          t          d	t          j        d          t          d
dd          t          ddd          t          di d          gS )z"Provide the default value for all allowed fields.

        Custom FactoryOptions classes should override this method
        to update() its return value.
        c                     t          |t                    r+t          t          |          dt          j                  d S )Nz is already a )
isinstancer   	TypeErrorreprFactoryrH   )r1   rV   s     r   is_modelz7FactoryOptions._build_default_options.<locals>.is_model   sK    %!122 E{{{{G$4$46   r   rI   NT)rW   rX   rG   F)rW   r    inline_argsr   excluderename)rS   r   r#   )rY   r   s     r   _build_default_optionsz%FactoryOptions._build_default_options   s    	 	 	 '4xHHH*eU;;;*e&;TJJJ-T:::)R666(B555
 	
r   c                    |i }n+d t          |                                          D             }|                                 D ]p}t          | |j                  rJ d|j        z              |                    ||          }|                    |j        d            t          | |j        |           q|rLt          d| j	        dd
                    t          |                                                              d S )Nc                 D    i | ]\  }}|                     d           ||S )_)
startswith)r   kvs      r   
<dictcomp>z2FactoryOptions._fill_from_meta.<locals>.<dictcomp>   s@       Q||C((1  r   zCan't override field %s.z'class Meta' for z got unknown attribute(s) ,)varsrw   r   r   r   r\   r5   setattrr~   rd   joinsortedkeys)rY   r1   r2   
meta_attrsoptionrV   s         r   _fill_from_metazFactoryOptions._fill_from_meta   s#   <JJ "4jj..00  J 1133 	. 	.FtV[11[[3MPVP[3[[[1LLy11ENN6;---D&+u---- 	G)<<<&1B1B*C*C!D!D!DFG G G	G 	Gr   Nc                    || _         || _        |                     ||           |                                 | _        | j        d| _        |                                 | _        t          | j         j	        dd                    D ][}t          |d          s| j                            |j        j                   | j                            |j        j                   \t          | j                                                   D ]%\  }}|                     ||          r
|| j        |<   &|xt%          j        t          |                                          d           D ]A\  }}|                    d          s't*          j                            |          | j        |<   B|                     | j                   t3          j        | j                  \  | _        | _        d S )N)r1   r2   Tr   r   c                     | d         S ro   r   rp   s    r   rr   z4FactoryOptions.contribute_to_class.<locals>.<lambda>   s    ]abc]d r   rs   r   )rd   r3   r   get_model_classrI   rG   _get_counter_referencerl   reversed__mro__r   re   rx   r   rf   r   rw   _is_declarationr   rv   r   r   SimpleParameterwrap_check_parameter_dependenciesr   parse_declarationsri   rj   )	rY   rd   r1   r2   r3   r4   parentr   r   s	            r   r9   z"FactoryOptions.contribute_to_class   s   ($)<<<))++
: DM!%!<!<!>!> t|3ABB788 	< 	<F67++ "))&,*HIIIO""6<#:;;;;&&,,.. 	. 	.DAq##Aq)) .,-&q)24<<3E3E3G3GPdPdeee N N1||C(( N)5)E)J)J1)M)MDOA&**4?;;;8?8RSWSd8e8e5t555r   c                     | j         M| j        F| j        j        j         5t          | j         | j        j        j                   r| j        j        j        S | S )z;Identify which factory should be used for a shared counter.)rI   r3   r   r   rl   ra   s    r   r   z%FactoryOptions._get_counter_reference   sU     J"%1%+1=tz4+<+B+HII >$*<<Kr   c                     | j         dS | j        | u r.t          | j                                                  | _         dS | j                                         | j        j         | _         dS )zInitialize our counter pointer.

        If we're the top-level factory, instantiate a new counter
        Otherwise, point to the top-level factory's counter.
        Nseq)rk   rl   _Counterrd   _setup_next_sequence_initialize_counterra   s    r   r   z"FactoryOptions._initialize_counter   si     =$F!T))$)J)J)L)LMMMDMMM"66888 2;DMMMr   c                 \    |                                   | j                                        S )a  Retrieve a new sequence ID.

        This will call, in order:
        - next_sequence from the base factory, if provided
        - _setup_next_sequence, if this is the 'toplevel' factory and the
            sequence counter wasn't initialized yet; then increase it.
        )r   rk   nextra   s    r   next_sequencezFactoryOptions.next_sequence  s*     	  """}!!###r   Fc                    |                                   | j        | ur'|s%t          d| j        d| j        j        d          || j        j                                        }| j                            |           d S )Nz-Can't reset a sequence on descendant factory z; reset sequence on z or use `force=True`.)r   rl   
ValueErrorrd   r   rk   reset)rY   rV   forces      r   reset_sequencezFactoryOptions.reset_sequence  s      """!--e-*<<<!7!?!?!?AB B B =*2GGIIEE"""""r   c                 F    t          |            j        j        di  fd                                D              j                                        D ]!\  }}|v r                    |          |<   "t          fd j        D                       }|fS )z5Convert an attributes dict to a (args, kwargs) tuple.c                 \    i | ](\  }}|j         v|j        v|t          j        u%||)S r   )r   rf   r   SKIP)r   r   r   rY   s      r   r   z4FactoryOptions.prepare_arguments.<locals>.<dictcomp>%  sO     
 
 
Q$$$/)A)Aa|O`F`F` qF`F`F`r   c              3   B   K   | ]}                     |          V  d S rU   )r5   )r   arg_namer+   s     r   	<genexpr>z3FactoryOptions.prepare_arguments.<locals>.<genexpr>0  sC       
 
 JJx  
 
 
 
 
 
r   r   )ru   rd   _adjust_kwargsrw   r   r5   tupler   )rY   
attributesold_namenew_nameargsr+   s   `    @r   prepare_argumentsz FactoryOptions.prepare_arguments  s    j!!,,66v66
 
 
 
#\\^^
 
 
 #'+"3"3"5"5 	8 	8Hh6!!#)::h#7#7x   
 
 
 
 ,
 
 
 
 

 V|r   c                 :   |                                  }|j        j        t          j        k    r | j        j        |g|R i |S |j        j        t          j        k    r | j        j        |g|R i |S |j        j        t          j	        k    sJ t          di |S Nr   )r   r   r    r   r!   rd   _buildr#   _creater%   
StubObject)rY   stepr   r+   rI   s        r   instantiatezFactoryOptions.instantiate7  s    $$&&< E$888&4<&u>t>>>v>>>\"e&;;;'4<'???????<(E,?????'''''r   c                 p    | j                             ||j        j        t          j        k    |           d S )N)r$   results)rd   _after_postgenerationr   r    r   r#   )rY   r   instancer   s       r   use_postgeneration_resultsz)FactoryOptions.use_postgeneration_resultsB  sA    **<(E,AA 	+ 	
 	
 	
 	
 	
r   c                     t          |t          t          f          rdS t          j        |          rdS |                    d           S )a1  Determines if a class attribute is a field value declaration.

        Based on the name and value of the class attribute, return ``True`` if
        it looks like a declaration of a default field value, ``False`` if it
        is private (name starts with '_') or a classmethod or staticmethod.

        FTr   )r}   classmethodstaticmethodr   get_builder_phaser   )rY   r   rV   s      r   r   zFactoryOptions._is_declarationI  sM     ek<899 	5$U++ 	4??3''''r   c                 \   t          j        t                    t          j        t                    }|                                D ]\  }}t	          |t
          j                  rr|                    |          }|s7t          j        fd|D              |<   |xx         t          |          z  cc<   |D ]}||         	                    |           d                                 D             }|r2t          j        d| j        dd                    |                    |S )z3Find out in what order parameters should be called.c              3   (   K   | ]}|         V  d S rU   r   )r   depdeep_revdepss     r   r   z?FactoryOptions._check_parameter_dependencies.<locals>.<genexpr>e  s(      0\0\sc1B0\0\0\0\0\0\r   c                      g | ]\  }}||v 	|S r   r   )r   r   
field_depss      r   r   z@FactoryOptions._check_parameter_dependencies.<locals>.<listcomp>k  s'    ZZZ+4tzGYGY$GYGYGYr   zCyclic definition detected on z; Params around r_   )collectionsdefaultdictsetrw   r}   r   	Parameterget_revdepsunionaddr   CyclicDefinitionErrorrd   r   )	rY   rf   depsr   	parameterfield_revdepsr   cyclicr   s	           @r   r   z,FactoryOptions._check_parameter_dependenciesX  sR    #.s33&s++)//11 	( 	(OD))\%;<< ( ) 5 5j A A$ %(Y0\0\0\0\m0\0\0\%]T"T"""c-&8&88"""( ( (CIMM$'''' [Z|/A/A/C/CZZZ 	5..<<<6!2!2!245 5 5 r   c                     | j         S )zExtension point for loading model classes.

        This can be overridden in framework-specific subclasses to hook into
        existing model repositories, for instance.
        )rI   ra   s    r   r   zFactoryOptions.get_model_classr  s     zr   c                 <    d| j         j        d| j        j        dS )NrD   rE   rF   )rB   rH   rd   ra   s    r   rK   zFactoryOptions.__str__z  s%      $ 7 7 79N9N9NOOr   c                      t          |           S rU   )strra   s    r   __repr__zFactoryOptions.__repr__}  s    4yyr   )NNNNNF)rH   rL   rM   rZ   propertyr   r   r   r9   r   r   r   r   r   r   r   r   r   r   rK   r   r   r   r   r6   r6      s4       
& 
& 
& ! ! X!
 
 
.G G G. f  f  f  fD	 	 	< < <	$ 	$ 	$
# 
# 
# 
#  2	( 	( 	(
 
 
( ( (  4  P P P    r   r6   c                   &    e Zd ZdZd Zd ZddZdS )r   zSimple, naive counter.

    Attributes:
        for_class (obj): the class this counter related to
        seq (int): the next value
    c                     || _         d S rU   r   )rY   r   s     r   rZ   z_Counter.__init__  s    r   c                 4    | j         }| xj         dz  c_         |S ro   r   )rY   rV   s     r   r   z_Counter.next  s    Ar   r   c                     || _         d S rU   r   )rY   
next_values     r   r   z_Counter.reset  s    r   N)r   )rH   rL   rM   rN   rZ   r   r   r   r   r   r   r     sP             
     r   r   c                      e Zd ZdZej        Zej        Zd Z e            Z	dZ
edd            Zed             Zed             Zed             Zedd	            Zed
             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             Zed             ZdS )r   z9Factory base support for sequences, attributes and stubs.c                 *    t          j        d          )z3Would be called if trying to instantiate the class.z"You cannot instantiate BaseFactory)r   FactoryError)r*   r   r+   s      r   r8   zBaseFactory.__new__  s    !"FGGGr   NFc                 >    | j                             ||           dS )a<  Reset the sequence counter.

        Args:
            value (int or None): the new 'next' sequence value; if None,
                recompute the next value from _setup_next_sequence().
            force (bool): whether to force-reset parent sequence counters
                in a factory inheritance chain.
        )r   N)r   r   )r*   rV   r   s      r   r   zBaseFactory.reset_sequence  s%     		  e 44444r   c                     dS )zSet up an initial sequence value for Sequence attributes.

        Returns:
            int: the first available ID to use for instances of this factory.
        r   r   rJ   s    r   r   z BaseFactory._setup_next_sequence  s	     qr   c                     |S )z-Extension point for custom kwargs adjustment.r   r)   s     r   r   zBaseFactory._adjust_kwargs  s	     r   c                     | j         j        r*t          j        dt	          | j                  z            t          j        | j         ||          }|                                S )zgenerate the object.

        Args:
            params (dict): attributes to use for generating the object
            strategy: the strategy to use
        zCannot generate instances of abstract factory %(f)s; Ensure %(f)s.Meta.model is set and %(f)s.Meta.abstract is either not set or False.)f)	r   rG   r   r   ru   rH   r   StepBuilderr"   )r*   r    r4   r   s       r   	_generatezBaseFactory._generate  sk     9 	F%.04s|0D0D0DEF F F
 "39fh??zz||r   c                     dS )a   Hook called after post-generation declarations have been handled.

        Args:
            instance (object): the generated object
            create (bool): whether the strategy was 'build' or 'create'
            results (dict or None): result of post-generation declarations
        Nr   )r*   r   r$   r   s       r   r   z!BaseFactory._after_postgeneration  s	     	r   c                      ||i |S )a  Actually build an instance of the model_class.

        Customization point, will be called once the full set of args and kwargs
        has been computed.

        Args:
            model_class (type): the class for which an instance should be
                built
            args (tuple): arguments to use when building the class
            kwargs (dict): keyword arguments to use when building the class
        r   r*   model_classr   r+   s       r   r   zBaseFactory._build       {D+F+++r   c                      ||i |S )a  Actually create an instance of the model_class.

        Customization point, will be called once the full set of args and kwargs
        has been computed.

        Args:
            model_class (type): the class for which an instance should be
                created
            args (tuple): arguments to use when creating the class
            kwargs (dict): keyword arguments to use when creating the class
        r   r   s       r   r   zBaseFactory._create  r   r   c                 B    |                      t          j        |          S )zABuild an instance of the associated class, with overridden attrs.)r   r   r!   r)   s     r   r"   zBaseFactory.build  s     }}U16:::r   c                 >      fdt          |          D             S )zBuild a batch of instances of the given class, with overridden attrs.

        Args:
            size (int): the number of instances to build

        Returns:
            object list: the built instances
        c                 *    g | ]} j         d i S r   )r"   r   r   r*   r+   s     r   r   z+BaseFactory.build_batch.<locals>.<listcomp>  s+    999		##F##999r   ranger*   sizer+   s   ` `r   build_batchzBaseFactory.build_batch  s)     :9999U4[[9999r   c                 B    |                      t          j        |          S )zBCreate an instance of the associated class, with overridden attrs.)r   r   r#   r)   s     r   r$   zBaseFactory.create  s     }}U2F;;;r   c                 >      fdt          |          D             S )zCreate a batch of instances of the given class, with overridden attrs.

        Args:
            size (int): the number of instances to create

        Returns:
            object list: the created instances
        c                 *    g | ]} j         d i S r   )r$   r   s     r   r   z,BaseFactory.create_batch.<locals>.<listcomp>  s+    :::

$$V$$:::r   r  r  s   ` `r   create_batchzBaseFactory.create_batch  s)     ;::::eDkk::::r   c                 B    |                      t          j        |          S )zRetrieve a stub of the associated class, with overridden attrs.

        This will return an object whose attributes are those defined in this
        factory's declarations or in the extra kwargs.
        )r   r   r%   r)   s     r   r&   zBaseFactory.stub  s     }}U0&999r   c                 >      fdt          |          D             S )zStub a batch of instances of the given class, with overridden attrs.

        Args:
            size (int): the number of instances to stub

        Returns:
            object list: the stubbed instances
        c                 *    g | ]} j         d i S r   r&   r   s     r   r   z*BaseFactory.stub_batch.<locals>.<listcomp>1  s+    888q""6""888r   r  r  s   ` `r   
stub_batchzBaseFactory.stub_batch'  s)     98888E$KK8888r   c                     |t           j        t           j        t           j        fv sJ t	          | |          } |di |S )a9  Generate a new instance.

        The instance will be created with the given strategy (one of
        BUILD_STRATEGY, CREATE_STRATEGY, STUB_STRATEGY).

        Args:
            strategy (str): the strategy to use for generating the instance.

        Returns:
            object: the generated instance
        r   r   r%   r!   r#   r   )r*   r    r+   actions       r   generatezBaseFactory.generate3  sJ     E/1EuG\]]]]]h''vr   c                     |t           j        t           j        t           j        fv sJ t	          | d|z            } ||fi |S )a  Generate a batch of instances.

        The instances will be created with the given strategy (one of
        BUILD_STRATEGY, CREATE_STRATEGY, STUB_STRATEGY).

        Args:
            strategy (str): the strategy to use for generating the instance.
            size (int): the number of instances to generate

        Returns:
            object list: the generated instances
        z%s_batchr  )r*   r    r  r+   batch_actions        r   generate_batchzBaseFactory.generate_batchD  sQ     E/1EuG\]]]]]sJ$9::|D++F+++r   c                 R    |rt           j        nt           j        } | j        |fi |S )zGenerate a new instance.

        The instance will be either 'built' or 'created'.

        Args:
            create (bool): whether to 'build' or 'create' the instance.

        Returns:
            object: the generated instance
        )r   r#   r!   r  )r*   r$   r+   r    s       r   simple_generatezBaseFactory.simple_generateV  s3     -3L5((8Ls|H/////r   c                 T    |rt           j        nt           j        } | j        ||fi |S )a<  Generate a batch of instances.

        These instances will be either 'built' or 'created'.

        Args:
            size (int): the number of instances to generate
            create (bool): whether to 'build' or 'create' the instances.

        Returns:
            object list: the generated instances
        )r   r#   r!   r  )r*   r$   r  r+   r    s        r   simple_generate_batchz!BaseFactory.simple_generate_batche  s6     -3L5((8L!s!(D;;F;;;r   r   rU   )rH   rL   rM   rN   r   r'   UnsupportedStrategyr8   r6   r   rk   r   r   r   r   r   r   r   r   r"   r  r$   r	  r&   r  r  r  r  r  r   r   r   r   r     s(       CC ,O 4H H H NE H	5 	5 	5 [	5   [   [   [     [ , , [, , , [, ; ; [; 	: 	: [	: < < [< 	; 	; [	; : : [: 	9 	9 [	9     [   , , [," 0 0 [0 < < [< < <r   r   c                   .    e Zd ZdZ G d de          ZdS )r   zFactory base with build and create support.

    This class has the ability to support multiple ORMs by using custom creation
    functions.
    c                       e Zd ZdS )Factory.MetaN)rH   rL   rM   r   r   r   r.   r  }  s        r   r.   N)rH   rL   rM   rN   rQ   r.   r   r   r   r   r   v  sH             x     r   r   )	metaclassc                       e Zd ZdZd ZdS )r   zA generic container.c                 \    |                                 D ]\  }}t          | ||           d S rU   )rw   r   )rY   r+   fieldrV   s       r   rZ   zStubObject.__init__  s<    "LLNN 	( 	(LE5D%''''	( 	(r   N)rH   rL   rM   rN   rZ   r   r   r   r   r     s)        ( ( ( ( (r   r   c                   T    e Zd Z G d d          Zed             Zed             ZdS )StubFactoryc                        e Zd Zej        ZeZdS )StubFactory.MetaN)rH   rL   rM   r   r%   r    r   rI   r   r   r   r.   r%    s        &r   r.   c                      | j         di |S r   r  r)   s     r   r"   zStubFactory.build  s    sx!!&!!!r   c                 (    t          j                    rU   )r   r  r)   s     r   r$   zStubFactory.create  s    (***r   N)rH   rL   rM   r.   r   r"   r$   r   r   r   r#  r#    sr                " " [" + + [+ + +r   r#  c                   X    e Zd ZdZ G d d          Zed             Zed             ZdS )BaseDictFactoryz$Factory for dictionary-like classes.c                       e Zd ZdZdS )BaseDictFactory.MetaTNrH   rL   rM   rG   r   r   r   r.   r+            r   r.   c                 :    |rt          d| z             |di |S )Nz1DictFactory %r does not support Meta.inline_args.r   )r   r   s       r   r   zBaseDictFactory._build  s>     	KCcIK K K{$$V$$$r   c                 $     | j         |g|R i |S rU   r   r   s       r   r   zBaseDictFactory._create  $    sz+7777777r   NrH   rL   rM   rN   r.   r   r   r   r   r   r   r)  r)    sx        ..        % % [% 8 8 [8 8 8r   r)  c                   (    e Zd Z G d d          ZdS )DictFactoryc                       e Zd ZeZdS )DictFactory.MetaN)rH   rL   rM   ru   rI   r   r   r   r.   r6            r   r.   NrH   rL   rM   r.   r   r   r   r4  r4    <                 r   r4  c                   X    e Zd ZdZ G d d          Zed             Zed             ZdS )BaseListFactoryzFactory for list-like classes.c                       e Zd ZdZdS )BaseListFactory.MetaTNr,  r   r   r   r.   r=    r-  r   r.   c                 h    |rt          d| z            |                                } ||          S )Nz1ListFactory %r does not support Meta.inline_args.)r   values)r*   r   r   r+   r?  s        r   r   zBaseListFactory._build  sG     	KCcIK K K
 {6"""r   c                 $     | j         |g|R i |S rU   r0  r   s       r   r   zBaseListFactory._create  r1  r   Nr2  r   r   r   r;  r;    sx        ((        # # [# 8 8 [8 8 8r   r;  c                   (    e Zd Z G d d          ZdS )ListFactoryc                       e Zd ZeZdS )ListFactory.MetaN)rH   rL   rM   listrI   r   r   r   r.   rD    r7  r   r.   Nr8  r   r   r   rB  rB    r9  r   rB  c                 J     t          j        dt          d            fd}|S )z|Force the use of a different strategy.

    This is an alternative to setting default_strategy in the class definition.
    z?use_strategy() is deprecated and will be removed in the future.   )
stacklevelc                      | j         _        | S rU   )r   r    )klassnew_strategys    r   wrapped_classz#use_strategy.<locals>.wrapped_class  s    +r   )warningswarnDeprecationWarning)rK  rL  s   ` r   use_strategyrP    sH    
 MI        r   rU   )r   loggingrM   r   r   r   r   r   	getLoggerloggerr   r   typer   rQ   rS   r6   r   r   r   AssociatedClassErrorr   r#  r)  r4  r;  rB  rP  r   r   r   <module>rW     s         9 9 9 9 9 9 9 9 9 9 9 9 9 9		-	.	.
< < <
   B= B= B= B= B=t B= B= B=J% % % % % % % %
 1  1  1  1  1  1  1  1Fu u u u u u u uv       ([< [< [< [< [< [< [< [<|    k%5      &: ( ( ( ( ( ( ( (+ + + + +' + + +8 8 8 8 8g 8 8 8"    /   
8 8 8 8 8g 8 8 8*    /   
    r   