o
    Ďi-                     @   s  d Z ddlZddlZddlZddlmZ dxddZeede_	dyd
dZ
dzddZG dd dZG dd dZG dd dZG dd dZG dd dZG dd dZG dd dZG dd dZG dd  d ZG d!d" d"ZG d#d$ d$ZG d%d& d&ZG d'd( d(ZG d)d* d*ZG d+d, d,ZG d-d. d.ZG d/d0 d0ZG d1d2 d2ZG d3d4 d4ZG d5d6 d6ZG d7d8 d8Z G d9d: d:Z!G d;d< d<Z"G d=d> d>Z#G d?d@ d@Z$G dAdB dBZ%G dCdD dDZ&e'dEdFdGgZ(G dHdI dIe(Z)G dJdK dKZ*e* Z+G dLdM dMZ,G dNdO dOZ-dPdQ Z.dRdS Z/G dTdU dUe0Z1e1d	dVdWZ2G dXdY dYej3Z4G dZd[ d[Z5d{d]d^Z6d|d`daZ7dbdc Z8G ddde deZ9G dfdg dgZ:G dhdi diZ;djdk Z<e<d}dmdnZ=dodp Z>dzdqdrZ?d~dvdwZ@dS )zAThis module has components that are used for testing Python Fire.    N)test_components_py3
      c                 O   s   | |||||fS N )arg1arg2arg3arg4arg5arg6r   r   P/home/jeff/fluffinator/venv/lib/python3.10/site-packages/fire/test_components.pyidentity      r   )r   r
      c                 C   s   | | S )zMultiplies num by rate.

  Args:
    num (int): the num you want to multiply
    rate (int): the rate for multiplication
  Returns:
    Multiplication of num by rate
  r   )numrater   r   r   multiplier_with_docstring      	r   Tc                 C      | S r   r   )helpr   r   r   function_with_help*      r   c                   @      e Zd ZdS )EmptyN__name__
__module____qualname__r   r   r   r   r   .       r   c                   @   r   )OldStyleEmptyNr   r   r   r   r   r    2   r   r    c                   @      e Zd Zdd ZdS )WithInitc                 C   s   d S r   r   selfr   r   r   __init__8   r   zWithInit.__init__Nr   r   r   r%   r   r   r   r   r"   6       r"   c                   @      e Zd ZdddZdS )ErrorInConstructorvaluec                 C   s   || _ td)NzError in constructor)r*   
ValueErrorr$   r*   r   r   r   r%   >   s   zErrorInConstructor.__init__N)r*   r&   r   r   r   r   r)   <       r)   c                   @   s   e Zd ZdZdddZdS )WithHelpArgz2Test class for testing when class has a help= arg.Tc                 C   s   || _ ddi| _d S )N__helpzhelp in a dict)has_help
dictionary)r$   r   r   r   r   r%   F   s   zWithHelpArg.__init__NTr   r   r   __doc__r%   r   r   r   r   r.   C   s    r.   c                   @      e Zd Zdd Zdd ZdS )
NoDefaultsc                 C      d| S Nr   r   r$   countr   r   r   doubleM      zNoDefaults.doublec                 C   r7   N   r   r9   r   r   r   tripleP   r<   zNoDefaults.tripleNr   r   r   r;   r?   r   r   r   r   r6   K       r6   c                   @   s0   e Zd ZdZdddZdddZ	ddd	Zd
S )WithDefaultsz1Class with functions that have default arguments.r   c                 C   r7   )zReturns the input multiplied by 2.

    Args:
      count: Input number that you want to double.

    Returns:
      A number that is the double of count.
    r   r   r9   r   r   r   r;   W   r   zWithDefaults.doublec                 C   r7   r=   r   r9   r   r   r   r?   b   r<   zWithDefaults.tripleP00010203040506070809101112131415161718192021222324252627282930313233343536373839c                 C      |S r   r   )r$   stringr   r   r   texte   s   zWithDefaults.textNr   )rC   )r   r   r   r4   r;   r?   rF   r   r   r   r   rB   T   s    

rB   c                   @   s    e Zd ZdddZdddZdS )OldStyleWithDefaultsr   c                 C   r7   r8   r   r9   r   r   r   r;   o   r<   zOldStyleWithDefaults.doublec                 C   r7   r=   r   r9   r   r   r   r?   r   r<   zOldStyleWithDefaults.tripleNrG   r@   r   r   r   r   rH   m       
rH   c                   @   s(   e Zd Zdd Zd
ddZdddZd	S )MixedDefaultsc                 C      dS )Nr   r   r#   r   r   r   tenx   r   zMixedDefaults.tenr   c                 C   s   |d|  S r8   r   r$   alphabetar   r   r   sum{      zMixedDefaults.sum0c                 C      ||fS r   r   rM   r   r   r   r   ~   r<   zMixedDefaults.identityNr   r   )rR   )r   r   r   rL   rP   r   r   r   r   r   rJ   v   s    
rJ   c                   @   s    e Zd ZdddZdddZdS )	SimilarArgNamesFc                 C   rS   r   r   )r$   bool_onebool_twor   r   r   r      r<   zSimilarArgNames.identityNc                 C   rS   r   r   )r$   arN   r   r   r   	identity2   r<   zSimilarArgNames.identity2)FF)NN)r   r   r   r   rY   r   r   r   r   rU      rI   rU   c                   @   s   e Zd ZdddZdS )CapitalizedArgNames      ?       @c                 C      || S r   r   )r$   DeltaGammar   r   r   rP      r<   zCapitalizedArgNames.sumN)r[   r\   )r   r   r   rP   r   r   r   r   rZ      r-   rZ   c                   @   s4   e Zd ZdddZdddZdeie_deie_dS )	Annotationsr   c                 C   r7   r8   r   r9   r   r   r   r;      r<   zAnnotations.doublec                 C   r7   r=   r   r9   r   r   r   r?      r<   zAnnotations.tripler:   NrG   )r   r   r   r;   r?   float__annotations__r   r   r   r   r`      s
    


r`   c                   @      e Zd ZdZdd ZdS )TypedPropertieszDTest class for testing Python Fire with properties of various types.c                 C   s@   d| _ d| _t | _ddddd| _dd	g| _d
| _d| _d S )NT)   r   r>   ErX   b)r   re   )echonestalexbethany)carrydividemyexcitingstring)rN   rO   rB   charliedeltarh   foxgammar#   r   r   r   r%      s   

zTypedProperties.__init__Nr3   r   r   r   r   rd          rd   c                   @   s"   e Zd ZdZdd ZdddZdS )	VarArgsz@Test class for testing Python Fire with a property with varargs.c                 G   s6   d }g }|D ]}|d u r|}n||7 }| | q|S r   )append)r$   itemstotalsumsitemr   r   r   cumsums   s   zVarArgs.cumsumsr   c                 G   s   ||d |fS )N join)r$   rN   rO   charsr   r   r   varchars   r   zVarArgs.varcharsNrT   )r   r   r   r4   rz   r   r   r   r   r   rt      s    rt   c                   @   r5   )Underscoresc                 C   s
   d| _ d S )Nzfish fingers)underscore_exampler#   r   r   r   r%         
zUnderscores.__init__c                 C   rD   r   r   )r$   underscore_argr   r   r   underscore_function   r   zUnderscores.underscore_functionN)r   r   r   r%   r   r   r   r   r   r      rA   r   c                   @   r(   )BoolConverterFc                 C   s   t |S r   )bool)r$   argr   r   r   as_bool   r<   zBoolConverter.as_boolN)F)r   r   r   r   r   r   r   r   r      r-   r   c                   @   r!   )
ReturnsObjc                 G   s   ~t  S r   )r   )r$   rv   r   r   r   get_obj   s   zReturnsObj.get_objN)r   r   r   r   r   r   r   r   r      r'   r   c                   @   s    e Zd ZdddZd	ddZdS )
NumberDefaults      $@c                 C      d| S Nr[   r   r$   divisorr   r   r   
reciprocal   r<   zNumberDefaults.reciprocalr   c                 C   r   r   r   r   r   r   r   integer_reciprocal   r<   z!NumberDefaults.integer_reciprocalN)r   r   )r   r   r   r   r   r   r   r   r   r      rI   r   c                   @   r5   )InstanceVarsc                 C   s   || _ || _d S r   r   r   r$   r   r   r   r   r   r%      s   
zInstanceVars.__init__c                 C   s   | j | j||fS r   r   r   r   r   r   run   r   zInstanceVars.runN)r   r   r   r%   r   r   r   r   r   r      s    r   c                   @   s&   e Zd Zdd Zdd ZdddZdS )	Kwargsc                 K   rD   r   r   r$   kwargsr   r   r   props   r   zKwargs.propsc                 K   s   d t|  S )N )r}   sortedkeysupperr   r   r   r   r      s   zKwargs.upperNc                 K   s
   |||fS r   r   )r$   
positionalnamedr   r   r   r   r      r   z
Kwargs.runr   )r   r   r   r   r   r   r   r   r   r   r      s    r   c                   @   r!   )ErrorRaiserc                 C      t d)NzThis error is part of a test.r+   r#   r   r   r   fail   r<   zErrorRaiser.failN)r   r   r   r   r   r   r   r   r      r'   r   c                   @   r5   )NonComparablec                 C   r   Nz+Instances of this class cannot be compared.r   r$   otherr   r   r   __eq__   r<   zNonComparable.__eq__c                 C   r   r   r   r   r   r   r   __ne__  r<   zNonComparable.__ne__N)r   r   r   r   r   r   r   r   r   r      rA   r   c                   @   r5   )EmptyDictOutputc                 C   s   i S r   r   r#   r   r   r   totally_empty  r   zEmptyDictOutput.totally_emptyc                 C   s   ddiS )N__do_not_print_mere   r   r#   r   r   r   nothing_printable  r<   z!EmptyDictOutput.nothing_printableN)r   r   r   r   r   r   r   r   r   r     rA   r   c                   @   r!   )CircularReferencec                 C   s   i }||d< |S )Nyr   r$   xr   r   r   create  s   zCircularReference.createN)r   r   r   r   r   r   r   r   r     r'   r   c                   @   r5   )OrderedDictionaryc                 C   s   t  S r   collectionsOrderedDictr#   r   r   r   empty  r<   zOrderedDictionary.emptyc                 C   s   t  }d|d< d|d< |S )NAr   r   )r$   ordered_dictr   r   r   	non_empty  s   zOrderedDictionary.non_emptyN)r   r   r   r   r   r   r   r   r   r     rA   r   c                   @       e Zd ZdZdd Zdd ZdS )
NamedTuplez2Functions returning named tuples used for testing.c                 C   s   t dddg}|dddS )z(Point example straight from Python docs.Pointr   r         )r   r   
namedtupler$   r   r   r   r   point&     zNamedTuple.pointc                 C   s   t dddg}|dddS )zField name equals value.r   r   r   r   r   r   r   r   r   r   matching_names,  r   zNamedTuple.matching_namesN)r   r   r   r4   r   r   r   r   r   r   r   #  s    r   c                   @   s$   e Zd ZdZdZdd Zdd ZdS )CallableWithPositionalArgs#Test class for supporting callable.re   c                 C   r]   r   r   )r$   r   r   r   r   r   __call__8  r<   z#CallableWithPositionalArgs.__call__c                 C   s   |d S Nre   r   r   r   r   r   fn;  r<   zCallableWithPositionalArgs.fnN)r   r   r   r4   TESTr   r   r   r   r   r   r   3  s
    r   NamedTuplePointr   r   c                   @   rc   )SubPointz@Used for verifying subclasses of namedtuples behave as intended.c                 C   s   | j | j S r   r   r#   r   r   r   coordinate_sumE  rQ   zSubPoint.coordinate_sumN)r   r   r   r4   r   r   r   r   r   r   B  rs   r   c                   @   r   )CallableWithKeywordArgumentr   c                 K   s&   |  D ]\}}td|| qd S )Nz{}: {})rv   printformat)r$   r   keyr*   r   r   r   r   L  s   z$CallableWithKeywordArgument.__call__c                 C   s   t | d S r   r   r$   msgr   r   r   	print_msgP  rQ   z%CallableWithKeywordArgument.print_msgN)r   r   r   r4   r   r   r   r   r   r   r   I  s    r   c                   @   s$   e Zd ZdZdddZd	ddZdS )
ClassWithDocstringzbTest class for testing help text output.

  This is some detail description of this test class.
  Hello!c                 C   s
   || _ dS )zConstructor of the test class.

    Constructs a new ClassWithDocstring object.

    Args:
      message: The default message to print.
    N)message)r$   r   r   r   r   r%   ]  s   
zClassWithDocstring.__init__Nc                 C   s   |du r| j }t| dS )zPrints a message.N)r   r   r   r   r   r   r   g  s   zClassWithDocstring.print_msg)r   r   )r   r   r   r4   r%   r   r   r   r   r   r   W  s    

r   c                   @   s   e Zd ZdZedd ZdS )ClassWithMultilineDocstringzTest class for testing help text output with multiline docstring.

  This is a test class that has a long docstring description that spans across
  multiple lines for testing line breaking in help text.
  c                 c   s    t | E dH  dS )a  Generators have a ``Yields`` section instead of a ``Returns`` section.

    Args:
        n (int): The upper limit of the range to generate, from 0 to `n` - 1.

    Yields:
        int: The next number in the range of 0 to `n` - 1.

    Examples:
        Examples should be written in doctest format, and should illustrate how
        to use the function.

        >>> print([i for i in example_generator(4)])
        [0, 1, 2, 3]

    N)range)nr   r   r   example_generatoru  s   z-ClassWithMultilineDocstring.example_generatorN)r   r   r   r4   staticmethodr   r   r   r   r   r   n  s    r   c                   C   s   h dS N>   threere   r   r   r   r   r   r   
simple_set  r<   r   c                   C   s   t h dS r   )	frozensetr   r   r   r   simple_frozenset  rQ   r   c                   @   s   e Zd ZdZdS )Subdictz)A subclass of dict, for testing purposes.N)r   r   r   r4   r   r   r   r   r     s    r   blue)re   redc                   @   s   e Zd ZdZdZdZdS )Colorre   r   r>   N)r   r   r   REDGREENBLUEr   r   r   r   r     s    r   c                   @   s4   e Zd ZdZdZdd Zedd Zedd Z	d	S )
HasStaticAndClassMethodsz0A class with a static method and a class method.re   c                 C   s
   || _ d S r   )instance_state)r$   r   r   r   r   r%     r   z!HasStaticAndClassMethods.__init__c                 C   r   r   r   )argsr   r   r   	static_fn  s   z"HasStaticAndClassMethods.static_fnc                 C   s
   || j  S r   )CLASS_STATE)clsr   r   r   r   class_fn  s   
z!HasStaticAndClassMethods.class_fnN)
r   r   r   r4   r   r%   r   r   classmethodr   r   r   r   r   r     s    
r   re   c                 G   s
   ~ ~~|S )zFunction with varargs.

  Args:
    arg1: Position arg docstring.
    arg2: Position arg docstring.
    arg3: Flags docstring.
    *varargs: Accepts unlimited positional args.
  Returns:
    The unlimited positional args.
  r   )r   r   r	   varargsr   r   r   function_with_varargs  s   r   r>   c                 K   s
   ~| |fS r   r   r   r   r   r   r   r   function_with_keyword_arguments  s   r   c                   C   rK   )zThis has code in the docstring.



  Example:
    x = fn_with_code_in_docstring()
    indentation_matters = True



  Returns:
    True.
  Tr   r   r   r   r   fn_with_code_in_docstring  s   r   c                   @   sJ   e Zd ZdZdddZdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dS )BinaryCanvasz:A canvas with which to make binary art, one bit at a time.r   c                    s.    fddt  D | _ | _d| _d| _d S )Nc                    s   g | ]}d g  qS rG   r   ).0_sizer   r   
<listcomp>  s    z)BinaryCanvas.__init__.<locals>.<listcomp>r   )r   pixels_size_row_col)r$   r   r   r   r   r%     s   
zBinaryCanvas.__init__c                 C   s   d dd | jD S )N
c                 s   s$    | ]}d  dd |D V  qdS )r   c                 s   s    | ]}t |V  qd S r   )str)r   pixelr   r   r   	<genexpr>  s    z1BinaryCanvas.__str__.<locals>.<genexpr>.<genexpr>Nr|   )r   rowr   r   r   r    s    
z'BinaryCanvas.__str__.<locals>.<genexpr>)r}   r  r#   r   r   r   __str__  s   
zBinaryCanvas.__str__c                 C   s   t |  | S r   r   r#   r   r   r   show  s   zBinaryCanvas.showc                 C   s   || j  | _|| j  | _| S r   )r  r  r  )r$   r	  colr   r   r   move  s   zBinaryCanvas.movec                 C   
   |  dS r   setr#   r   r   r   on  r   zBinaryCanvas.onc                 C   r  )Nr   r  r#   r   r   r   off  r   zBinaryCanvas.offc                 C   s   || j | j | j< | S r   )r  r  r  r,   r   r   r   r    s   zBinaryCanvas.setNr   )r   r   r   r4   r%   r
  r  r  r  r  r  r   r   r   r   r     s    
r   c                   @   r5   )DefaultMethodc                 C   r7   r8   r   r$   numberr   r   r   r;     r<   zDefaultMethod.doublec                 C   s   dd }|S )Nc                   S   rK   )NzUndefined functionr   r   r   r   r   _missing  r   z+DefaultMethod.__getattr__.<locals>._missingr   )r$   namer  r   r   r   __getattr__  s   zDefaultMethod.__getattr__N)r   r   r   r;   r  r   r   r   r   r    rA   r  c                   @   s    e Zd Zdd Zedd ZdS )InvalidPropertyc                 C   r7   r8   r   r  r   r   r   r;     r<   zInvalidProperty.doublec                 C   r   )Ntestr   r#   r   r   r   prop     zInvalidProperty.propN)r   r   r   r;   propertyr  r   r   r   r   r    s    r  c                    s   t   fdd}|S )Nc                     s    | i |S r   r   )r   r   fr   r   wrapper  s   z!simple_decorator.<locals>.wrapper)	functoolswraps)r  r   r   r  r   simple_decorator  s   r#  Worldc                 C   s   d|  S )NzHello %sr   )r  r   r   r   decorated_method  r  r%  c                 K   s   ~ ~| dS )zFunction with kwarg.

  :param arg1: Description of arg1.
  :param arg2: Description of arg2.
  :key arg3: Description of arg3.
  r	   getr   r   r   r   fn_with_kwarg  s   
r(  c                 K   s   ~ ~~| dS )zFunction with kwarg and defaults.

  :param arg1: Description of arg1.
  :param arg2: Description of arg2.
  :key arg3: Description of arg3.
  r	   r&  )r   r   optr   r   r   r   fn_with_kwarg_and_defaults$  s   
r*  firstlastlatec                 C   s   ~~| S )zFunction with kwarg and defaults.

  :key first: Description of first.
  :key last: Description of last.
  :key late: Description of late.
  r   r+  r,  r-  r   r   r   fn_with_multiple_defaults/  s   r/  )r   r   )r   r2   )re   )r>   )r$  r.  )Ar4   r   enumr!  firer   py3r   intrb   r   r   r   r    r"   r)   r.   r6   rB   rH   rJ   rU   rZ   r`   rd   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   CALLABLE_WITH_KEYWORD_ARGUMENTr   r   r   r   dictr   SUBDICTEnumr   r   r   r   r   r   r  r  r#  r%  r(  r*  r/  r   r   r   r   <module>   sx   


					
		

!

