
    liK{                     n   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dlm
Z
 d dlmZmZmZmZmZmZmZmZmZmZmZmZ d dlmZ ddlmZ ddlmZ dZ e j        d	e j         e j!        
           eee"e#f         ee"e#ee#ef         f         f         Z$ee$         Z% G d de          Z&dS )    N)JSONEncoder)AnyCallableDictListLiteralOptionalSequenceSetTupleTypeUnionoverload)UnsupportedFeature   )BaseProvider)	TypesSpecT	faker-csv)quotingc                      e Zd ZdPdedefdZdee         fdZdQdedefdZ	e
defd	            Ze
d
ed         defd            Ze
d
ed         defd            ZdRd
edeeef         fdZe
defd            Ze
d
ed         defd            Ze
d
ed         defd            ZdRd
edeeef         fdZe
defd            Ze
d
ed         defd            Ze
d
ed         defd            ZdRd
edeeef         fdZe
defd            Ze
dddej        fd            Ze
deej        gef         defd            Ze
deej        gef         defd            Zefdeeeej        gef         eej        gef         f                  deeeej        f         fdZ	 	 	 	 	 dSded ed!ed"ed#edefd$Z	 	 	 	 dTd(ed)ed*ed+ee         def
d,Z	 	 	 	 dTd(ed)ed*ed+ee         def
d-Z	 	 	 	 dUd0eeef         d1ed2eeeee         ef                  d3ee         def
d4Z	 	 	 	 	 dVd7ed8eee                  d9eeef         d:ed;ed<edefd=Z	 	 	 	 dWd8eee                  d9eeef         d:ed;edef
d>Z	 	 	 	 dWd8eee                  d9eeef         d:ed;edef
d?Z	 	 	 	 dWd8eee                  d9eeef         d:ed;edef
d@Z	 	 	 	 dXd9ee          d:edAee         dBee!e"                  def
dCZ#	 	 	 	 dXd9ee          d:edAee         dBee!e"                  def
dDZ$	 	 	 	 dYdEedFedGee%         dHee%         def
dIZ&dZd9ee'         d:edKedefdLZ(dMedNedeeef         fdOZ)dS )[Provider2   chance_of_getting_truereturnc                 J    | j         j                            dd          |k    S )zGenerate a random boolean value based on ``chance_of_getting_true``.

        :sample: chance_of_getting_true=25
        :sample: chance_of_getting_true=50
        :sample: chance_of_getting_true=75
           d   	generatorrandomrandint)selfr   s     m/var/www/html/Pagina-Ingenieria-Requisitos/venv/lib/python3.11/site-packages/faker/providers/misc/__init__.pybooleanzProvider.boolean   s%     ~$,,Q448NNN    c                 V    dddd| j         j                            dd                   S )zGGenerate ``None``, ``True``, or ``False``, each with equal probability.NTF)r   r   r'   r   r   r"   s    r#   null_booleanzProvider.null_boolean'   s;     
 
 .

'
'A
.
.	0 	0r%      lengthc                       j         j        r* fdt          |          D             }t          |          S t	          j        |          S )zGenerate a random binary blob of ``length`` bytes.

        If this faker instance has been seeded, performance will be signficiantly reduced, to conform
        to the seeding.

        :sample: length=64
        c                 N    g | ]!}j         j                            d           "S )   )r   r    	randrange).0_r"   s     r#   
<listcomp>z#Provider.binary.<locals>.<listcomp>:   s,    PPPQDN)33C88PPPr%   )r   
_is_seededrangebytesosurandom)r"   r+   blobs   `  r#   binaryzProvider.binary0   sO     >$ 	PPPP%--PPPD;; z&!!!r%   c                     d S N r(   s    r#   md5zProvider.md5@   s    #r%   
raw_outputTc                     d S r;   r<   r"   r>   s     r#   r=   zProvider.md5C       7:sr%   Fc                     d S r;   r<   r@   s     r#   r=   zProvider.md5F   s    69cr%   c                     t          j        t          | j        j                                                                                            }|r|                                S |                                S )a2  Generate a random MD5 hash.

        If ``raw_output`` is ``False`` (default), a hexadecimal string representation of the MD5 hash
        will be returned. If ``True``, a ``bytes`` object representation will be returned instead.

        :sample: raw_output=False
        :sample: raw_output=True
        )hashlibr=   strr   r    encodedigest	hexdigestr"   r>   ress      r#   r=   zProvider.md5I   s\     %[T^-B-I-I-K-K)L)L)S)S)U)UVV 	 ::<<}}r%   c                     d S r;   r<   r(   s    r#   sha1zProvider.sha1W   s    3r%   c                     d S r;   r<   r@   s     r#   rL   zProvider.sha1Z   s    8;r%   c                     d S r;   r<   r@   s     r#   rL   zProvider.sha1]   rA   r%   c                     t          j        t          | j        j                                                                                            }|r|                                S |                                S )a6  Generate a random SHA-1 hash.

        If ``raw_output`` is ``False`` (default), a hexadecimal string representation of the SHA-1 hash
        will be returned. If ``True``, a ``bytes`` object representation will be returned instead.

        :sample: raw_output=False
        :sample: raw_output=True
        )rD   rL   rE   r   r    rF   rG   rH   rI   s      r#   rL   zProvider.sha1`   s\     %\#dn.C.J.J.L.L*M*M*T*T*V*VWW 	 ::<<}}r%   c                     d S r;   r<   r(   s    r#   sha256zProvider.sha256n   s     Sr%   c                     d S r;   r<   r@   s     r#   rQ   zProvider.sha256q   s    :=#r%   c                     d S r;   r<   r@   s     r#   rQ   zProvider.sha256t   s    9<r%   c                     t          j        t          | j        j                                                                                            }|r|                                S |                                S )a:  Generate a random SHA-256 hash.

        If ``raw_output`` is ``False`` (default), a hexadecimal string representation of the SHA-256 hash
        will be returned. If ``True``, a ``bytes`` object representation will be returned instead.

        :sample: raw_output=False
        :sample: raw_output=True
        )rD   rQ   rE   r   r    rF   rG   rH   rI   s      r#   rQ   zProvider.sha256w   s\     %^C0E0L0L0N0N,O,O,V,V,X,XYY 	 ::<<}}r%   c                     d S r;   r<   r(   s    r#   uuid4zProvider.uuid4   s    Cr%   cast_toNc                     d S r;   r<   r"   rW   s     r#   rV   zProvider.uuid4   s    14r%   c                     d S r;   r<   rY   s     r#   rV   zProvider.uuid4   s    ADr%   c                     d S r;   r<   rY   s     r#   rV   zProvider.uuid4   s    EHSr%   c                     t          j        | j        j                            d          d          }| ||          S |S )a"  Generate a random UUID4 object and cast it to another type if specified using a callable ``cast_to``.

        By default, ``cast_to`` is set to ``str``.

        May be called with ``cast_to=None`` to return a full-fledged ``UUID``.

        :sample:
        :sample: cast_to=None
              )intversion)uuidUUIDr   r    getrandbits)r"   rW   generated_uuids      r#   rV   zProvider.uuid4   sI     %)I$.2G2S2STW2X2Xbc$d$d$d7>***r%   
   special_charsdigits
upper_case
lower_casec                 >   d}g }|r7|                     | j        j                            d                     |dz  }|rK|                     | j        j                            t          j                             |t          j        z  }|rK|                     | j        j                            t          j                             |t          j        z  }|rK|                     | j        j                            t          j                             |t          j        z  }t          |          |k    s
J d            | 	                    ||          }t                      }	t          |	          t          |          k     rc|	                    | j        j                            dt          |          dz
                       t          |	          t          |          k     ct          |	          D ]\  }
}||
         ||<   d                    |          S )a  Generate a random password of the specified ``length``.

        The arguments ``special_chars``, ``digits``, ``upper_case``, and ``lower_case`` control
        what category of characters will appear in the generated password. If set to ``True``
        (default), at least one character from the corresponding category is guaranteed to appear.
        Special characters are characters from ``!@#$%^&*()_+``, digits are characters from
        ``0123456789``, and uppercase and lowercase characters are characters from the ASCII set of
        letters.

        :sample: length=12
        :sample: length=40, special_chars=False, upper_case=False
         z!@#$%^&*()_+z3Required length is shorter than required characters)r+   r   r   )appendr   r    choicestringrg   ascii_uppercaseascii_lowercaselenrandom_choicessetaddr!   	enumeratejoin)r"   r+   rf   rg   rh   ri   choicesrequired_tokenscharsrandom_indexesiindexs               r#   passwordzProvider.password   s   (  	&""4>#8#?#?#O#OPPP~%G 	%""4>#8#?#?#N#NOOOv}$G 	.""4>#8#?#?@V#W#WXXXv--G 	.""4>#8#?#?@V#W#WXXXv--G?##v---/d--- (((@@ $'55.!!C$8$888t~4<<QE

QOOPPP .!!C$8$888 ".11 	. 	.HAu*1-E%LLwwu~~r%      r      uncompressed_size	num_filesmin_file_sizecompressionc                    t          t          |t                     p|dk    t          |t                     p|dk    t          |t                     p|dk    g          rt          d          ||z  |k    rt	          d          |dv rt
          j        }n.|dv rt
          j        }n|dv rt
          j        }nt
          j	        }t          j                    }|}t          j        |d|          5 }t          d	|d	z             D ]}	| j                                        t!          |	          z   }
|||	z
  |z  z
  }|	|k     r&| j        j                            ||          }||z
  }n|}| j                            |          }|                    |
|           	 d
d
d
           n# 1 swxY w Y   |                                S )a  Generate a bytes object containing a random valid zip archive file.

        The number and sizes of files contained inside the resulting archive can be controlled
        using the following arguments:

        - ``uncompressed_size`` - the total size of files before compression, 16 KiB by default
        - ``num_files`` - the number of files archived in resulting zip file, 1 by default
        - ``min_file_size`` - the minimum size of each file before compression, 4 KiB by default

        No compression is used by default, but setting ``compression`` to one of the values listed
        below will use the corresponding compression type.

        - ``'bzip2'`` or ``'bz2'`` for BZIP2
        - ``'lzma'`` or ``'xz'`` for LZMA
        - ``'deflate'``, ``'gzip'``, or ``'gz'`` for GZIP

        :sample: uncompressed_size=256, num_files=4, min_file_size=32
        :sample: uncompressed_size=256, num_files=32, min_file_size=4, compression='bz2'
        r   O`num_files`, `min_file_size`, and `uncompressed_size` must be positive integersH`uncompressed_size` is smaller than the calculated minimum required sizebzip2bz2lzmaxz)deflategzipgzw)moder   r   N)any
isinstancer_   
ValueErrorAssertionErrorzipfile	ZIP_BZIP2ZIP_LZMAZIP_DEFLATED
ZIP_STOREDioBytesIOZipFiler4   r   pystrrE   r    r!   r9   writestrgetvalue)r"   r   r   r   r   compression_
zip_bufferremaining_size
zip_handlefile_numberfilenamemax_allowed_size	file_sizedatas                 r#   zipzProvider.zip   s?   4 y#...@)q.}c222Hmq6H0#666P:Kq:P
 
 		 a   9$'888 Z   ***",LLN**"+LL555"/LL"-LZ\\
*_Zc|LLL 	4PZ$Q	A66 4 4>//11C4D4DD#1Y5LP]4]#] ** $ 5 = =mM] ^ ^I%3i%?NN .I~,,Y77##Hd33334	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 ""$$$s   3B)F))F-0F-c                 X   t          t          |t                     p|dk    t          |t                     p|dk    t          |t                     p|dk    g          rt          d          ||z  |k    rt	          d          d}|dv rd}n|dv rd}n|d	v rd
}t          j                    }|}t          j        ||          5 }t          d|dz             D ]!}	t          j                    }
| j
                                        t          |	          z   }|||	z
  |z  z
  }|	|k     r&| j
        j                            ||          }||z
  }n|}t          j        |          }| j
                            |          }|
                    |           t%          |
                                          |_        |
                    d           |                    ||
           |
                                 #	 ddd           n# 1 swxY w Y   |                                S )a  Generate a bytes object containing a random valid tar file.

        The number and sizes of files contained inside the resulting archive can be controlled
        using the following arguments:

        - ``uncompressed_size`` - the total size of files before compression, 16 KiB by default
        - ``num_files`` - the number of files archived in resulting zip file, 1 by default
        - ``min_file_size`` - the minimum size of each file before compression, 4 KiB by default

        No compression is used by default, but setting ``compression`` to one of the values listed
        below will use the corresponding compression type.

        - ``'bzip2'`` or ``'bz2'`` for BZIP2
        - ``'lzma'`` or ``'xz'`` for LZMA
        - ``'gzip'`` or ``'gz'`` for GZIP

        :sample: uncompressed_size=256, num_files=4, min_file_size=32
        :sample: uncompressed_size=256, num_files=32, min_file_size=4, compression='bz2'
        r   r   r   zw|)r   r   zw|gzr   zw|bz2r   zw|xz)r   fileobjr   )nameN)r   r   r_   r   r   r   r   tarfileopenr4   r   r   rE   r    r!   TarInfor9   writerq   r   sizeseekaddfileclose)r"   r   r   r   r   r   
tar_bufferr   
tar_handler   file_bufferr   r   r   tarinfor   s                   r#   tarzProvider.tar  s   4 y#...@)q.}c222Hmq6H0#666P:Kq:P
 
 		 a   9$'888 Z   8<.((DD,,,DDN**DZ\\
*\tZ888 	$J$Q	A66 $ $ jll>//11C4D4DD#1Y5LP]4]#] ** $ 5 = =mM] ^ ^I%3i%?NN .I!/x888~,,Y77!!$'''";#7#7#9#9::  ###""7K888!!#####$	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$& ""$$$s   	D7HHHr.   r.   pngr   image_formathue
luminosityc           	         	
 	 ddl }ddl}n# t          $ r t          dd          w xY w|\  
	|j                            d| j                            ||                    }|j        	                    |          }|
                    	 
fdt                               dd	                    D              j                            ||           j                            ||          
           t          j                    5 }|                    ||           |                    d           |                                cddd           S # 1 swxY w Y   dS )a;  Generate an image and draw a random polygon on it using the Python Image Library.
        Without it installed, this provider won't be functional. Returns the bytes representing
        the image in a given format.

        The argument ``size`` must be a 2-tuple containing (width, height) in pixels. Defaults to 256x256.

        The argument ``image_format`` can be any valid format to the underlying library like ``'tiff'``,
        ``'jpeg'``, ``'pdf'`` or ``'png'`` (default). Note that some formats need present system libraries
        prior to building the Python Image Library.
        Refer to https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html for details.

        The arguments ``hue`` and ``luminosity`` are the same as in the color provider and are simply forwarded to
        it to generate both the background and the shape colors. Therefore, you can ask for a "dark blue" image, etc.

        :sample: size=(2, 2), hue='purple', luminosity='bright', image_format='pdf'
        :sample: size=(16, 16), hue=[90,270], image_format='ico'
        r   Nz-`image` requires the `Pillow` python library.imageRGB)r   r   c                 h    g | ].}                     d                                d           f/S )r   )
random_int)r0   r1   heightr"   widths     r#   r2   z"Provider.image.<locals>.<listcomp>  s:    llldooa''F)C)CDlllr%         )filloutline)format)	PIL.ImagePIL.ImageDrawImportErrorr   Imagenewr   color	ImageDrawDrawpolygonr4   r   r   r   saver   read)r"   r   r   r   r   PILr   drawfobjr   r   s   `        @@r#   r   zProvider.image`  s   0	_      	_ 	_ 	_$%TV]^^^	_ 	eT4>+?+?CT^+?+_+_``}!!%((lllllleTXTcTcdegiTjTjNkNklll%%#*%EEN((SZ(HH 	 	
 	
 	

 Z\\ 	TJJtLJ111IIaLLL99;;	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s    )A EE #E r   {{name}}{{address}}dialectheaderdata_columnsnum_rowsinclude_row_ids	fmtparamsc                     t          |t                    r|dk    rt          d          t          |t          t          f          st          d          |Zt          |t          t          f          st          d          t          |          t          |          k    rt          d          t          j                    }t          j
        |fd|i|}|r<|r%t          |          }|                    dd           |                    |           t          d	|d	z             D ]J}	 fd
|D             }
|r#|
                    dt          |	                     |                    |
           K|                                S )a  Generate random delimiter-separated values.

        This method's behavior share some similarities with ``csv.writer``. The ``dialect`` and
        ``**fmtparams`` arguments are the same arguments expected by ``csv.writer`` to control its
        behavior, and instead of expecting a file-like object to where output will be written, the
        output is controlled by additional keyword arguments and is returned as a string.

        The ``dialect`` argument defaults to ``'faker-csv'`` which is the name of a ``csv.excel``
        subclass with full quoting enabled.

        The ``header`` argument expects a list or a tuple of strings that will serve as the header row
        if supplied. The ``data_columns`` argument expects a list or a tuple of string tokens, and these
        string tokens will be passed to  :meth:`pystr_format() <faker.providers.python.Provider.pystr_format>`
        for data generation. Argument Groups are used to pass arguments to the provider methods.
        Both ``header`` and ``data_columns`` must be of the same length.

        Example:
            fake.set_arguments('top_half', {'min_value': 50, 'max_value': 100})
            fake.dsv(data_columns=('{{ name }}', '{{ pyint:top_half }}'))

        The ``num_rows`` argument controls how many rows of data to generate, and the ``include_row_ids``
        argument may be set to ``True`` to include a sequential row ID column.

        :sample: dialect='excel', data_columns=('{{name}}', '{{address}}')
        :sample: dialect='excel-tab', data_columns=('{{name}}', '{{address}}'), include_row_ids=True
        :sample: data_columns=('{{name}}', '{{address}}'), num_rows=5, delimiter='$'
        r   z%`num_rows` must be a positive integerz(`data_columns` must be a tuple or a listNz"`header` must be a tuple or a listz6`header` and `data_columns` must have matching lengthsr   IDr   c                 D    g | ]}j                             |          S r<   )r   pystr_format)r0   columnr"   s     r#   r2   z Provider.dsv.<locals>.<listcomp>  s)    RRR64>..v66RRRr%   )r   r_   r   listtuple	TypeErrorrq   r   StringIOcsvwriterinsertwriterowr4   rE   r   )r"   r   r   r   r   r   r   
dsv_bufferr   row_numrows   `          r#   dsvzProvider.dsv  s   J (C(( 	FHMMDEEE,u66 	HFGGGftUm44 F DEEE6{{c,//// !YZZZ[]]
JEEE9EE 	$ 'fa&&&OOF###Q1-- 	! 	!GRRRR\RRRC ,

1c'll+++OOC    ""$$$r%   c                 6    |                      ||||d          S )a  Generate random comma-separated values.

        For more information on the different arguments of this method, please refer to
        :meth:`dsv() <faker.providers.misc.Provider.dsv>` which is used under the hood.

        :sample: data_columns=('{{name}}', '{{address}}'), num_rows=10, include_row_ids=False
        :sample: header=('Name', 'Address', 'Favorite Color'),
                data_columns=('{{name}}', '{{address}}', '{{safe_color_name}}'),
                num_rows=10, include_row_ids=True
        ,r   r   r   r   	delimiterr   r"   r   r   r   r   s        r#   r   zProvider.csv  .    " xx%+  
 
 	
r%   c                 6    |                      ||||d          S )a   Generate random tab-separated values.

        For more information on the different arguments of this method, please refer to
        :meth:`dsv() <faker.providers.misc.Provider.dsv>` which is used under the hood.

        :sample: data_columns=('{{name}}', '{{address}}'), num_rows=10, include_row_ids=False
        :sample: header=('Name', 'Address', 'Favorite Color'),
                data_columns=('{{name}}', '{{address}}', '{{safe_color_name}}'),
                num_rows=10, include_row_ids=True
        	r   r   r   s        r#   tsvzProvider.tsv  s.    " xx%+  
 
 	
r%   c                 6    |                      ||||d          S )a  Generate random pipe-separated values.

        For more information on the different arguments of this method, please refer to
        :meth:`dsv() <faker.providers.misc.Provider.dsv>` which is used under the hood.

        :sample: data_columns=('{{name}}', '{{address}}'), num_rows=10, include_row_ids=False
        :sample: header=('Name', 'Address', 'Favorite Color'),
                data_columns=('{{name}}', '{{address}}', '{{safe_color_name}}'),
                num_rows=10, include_row_ids=True
        |r   r   r   s        r#   psvzProvider.psv  r   r%   indentclsc                 X    |                      ||||                                          S )z
        Generate random JSON structure and return as bytes.

        For more information on the different arguments of this method, refer to
        :meth:`json() <faker.providers.misc.Provider.json>` which is used under the hood.
        )r   r   r  r  )jsonrF   )r"   r   r   r  r  s        r#   
json_byteszProvider.json_bytes  s+     yylXfZ]y^^eegggr%   c                    	 ddd}rn|dt           t                   dt          f	 fd	dt          t          t          t
          t          t          t          f         f         dt          f fddt          t          t          f         dt          f	fd	|d
k    r t          j                   ||          S fdt          |          D             }t          j        |||          S )a  
        Generate random JSON structure values.

        Using a dictionary or list of records that is passed as ``data_columns``,
        define the structure that is used to build JSON structures.  For complex
        data structures it is recommended to use the dictionary format.

        Data Column Dictionary format:
            {'key name': 'definition'}

        The definition can be 'provider', 'provider:argument_group', tokenized
        'string {{ provider:argument_group }}' that is passed to the python
        provider method pystr_format() for generation, or a fixed '@word'.
        Using Lists, Tuples, and Dicts as a definition for structure.

        Example:
            fake.set_arguments('top_half', {'min_value': 50, 'max_value': 100})
            fake.json(data_columns={'Name': 'name', 'Score': 'pyint:top_half'})

        Data Column List format:
            [('key name', 'definition', {'arguments'})]

        With the list format the definition can be a list of records, to create
        a list within the structure data.  For literal entries within the list,
        set the 'field_name' to None.

        :param data_columns: specification for the data structure
        :type data_columns: dict
        :param num_rows: number of rows the returned
        :type num_rows: int
        :param indent: number of spaces to indent the fields
        :type indent: int
        :param cls: optional json encoder to use for non-standard objects such as datetimes
        :type cls: json.JSONEncoder
        :return: Serialized JSON data
        :rtype: str

        :sample: data_columns={'Spec': '@1.0.1', 'ID': 'pyint',
                'Details': {'Name': 'name', 'Address': 'address'}}, num_rows=2
        :sample: data_columns={'Candidates': ['name', 'name', 'name']},
                num_rows=1
        :sample: data_columns=[('Name', 'name'), ('Points', 'pyint',
                {'min_value': 50, 'max_value': 100})], num_rows=1
        r   r   )r   	residencyr   r   c                 f   i }| D ]^}}}|r|d         ni }t          |t                    st          d          | j        |fi |c S t          |t                    r |          ||<   kt          |t
          t          f          rfd|D             ||<    j        |fi |||<   |S )Nr   ,Invalid arguments type. Must be a dictionaryc                 (    g | ]} |g          S r<   r<   )r0   itemprocess_list_structures     r#   r2   zAProvider.json.<locals>.process_list_structure.<locals>.<listcomp>n  s'    "Y"Y"Yd#9#94&#A#A"Y"Y"Yr%   )r   dictr   _value_format_selectionr   r   rs   )r   entryr   
definition	argumentskwargsr  r"   s         r#   r  z-Provider.json.<locals>.process_list_structure_  s    $&E04 U U,j9)2:1!&$// T#$RSSS<747
MMfMMMMMj%00 U"8"8"D"DE$KK
T3K88 U"Y"Y"Y"Yj"Y"Y"YE$KK">$">z"T"TV"T"TE$KKLr%   c                    i }t          | t                    r                    |           S t          | t                    r|                                 D ]\  }}t          |t
          t          t          f          rfd|D             ||<   9t          |t          t          t          t          f          r |          ||<   p                    |          ||<   |S | S )Nc                 &    g | ]} |          S r<   r<   )r0   r  process_dict_structures     r#   r2   zAProvider.json.<locals>.process_dict_structure.<locals>.<listcomp>|  s%    &[&[&['='=d'C'C&[&[&[r%   )r   rE   r  r  itemsr   r   rs   r_   floatbool)r   r  r   r  r  r"   s       r#   r  z-Provider.json.<locals>.process_dict_structures  s    $&E$$$ :33D999$%% (,

 O O$D*!*udC.@AA O&[&[&[&[PZ&[&[&[d#JsE40HII O&<&<Z&H&Hd&*&B&B:&N&NdKr%   r   c                     t          | t                    r |           S t          | t                    r |           S t          d          )Nz7Invalid data_columns type. Must be a dictionary or list)r   r  r   r   )r   r  r  s    r#   create_json_structurez,Provider.json.<locals>.create_json_structure  sX    ,-- <--l;;;,-- <--l;;;UVVVr%   r   )r  r  c                 &    g | ]}           S r<   r<   )r0   r1   r  r   s     r#   r2   z!Provider.json.<locals>.<listcomp>  s%    MMM%%l33MMMr%   )r
   r   r   r_   r  r  r   rE   r   r  r  dumpsr4   )
r"   r   r   r  r  default_data_columnsr   r  r  r  s
   ``     @@@r#   r  zProvider.json&  sW   h & 
  
 ;G*`,,L`	# 	3 	 	 	 	 	 	 	(	sE4c3h/O)P 	UX 	 	 	 	 	 	 	$	WdDj0A 	Wd 	W 	W 	W 	W 	W 	W 	W q==:33LAA&VYZZZZMMMMMU8__MMMz$v37777r%   nb_elementsvariable_nb_elementsvalue_typesallowed_typesc                     	 ddl }n# t          $ r t          dd          w xY w| j                            ||||          }| j                                        |i}|                    |          S )a  
        Returns some XML.

        :nb_elements: number of elements for dictionary
        :variable_nb_elements: is use variable number of elements for dictionary
        :value_types: type of dictionary values

        Note: this provider required xmltodict library installed
        r   Nz.`xml` requires the `xmltodict` Python library.xml)r  r  r   r!  )	xmltodictr   r   r   pydictwordunparse)r"   r  r  r   r!  r$  _dicts          r#   r#  zProvider.xml  s     	^ 	^ 	^ 	^$%UW\]]]	^%%#!5#'	 & 
 
 $$&&.  '''s    "leftalignc           	         dddddifg}||}ddd	d
}g }t          |          D ]}g }|D ]z^}	}
}|r|d         ni }t          |t                    st          d           | j        |
fi |}|                    ||                    |d           |	 d|	                    {|                    d                    |                     d                    |          S )a  
        Generate random fixed width values.

        Using a list of tuple records that is passed as ``data_columns``, that
        defines the structure that will be generated. Arguments within the
        record are provider specific, and should be a dictionary that will be
        passed to the provider method.

        Data Column List format
            [('field width', 'definition', {'arguments'})]

        The definition can be 'provider', 'provider:argument_group', tokenized
        'string {{ provider:argument_group }}' that is passed to the python
        provider method pystr_format() for generation, or a fixed '@word'.
        Using Lists, Tuples, and Dicts as a definition for structure.

        Argument Groups can be used to pass arguments to the provider methods,
        but will override the arguments supplied in the tuple record.

        Example:
            fake.set_arguments('top_half', {'min_value': 50, 'max_value': 100})
            fake.fixed_width(data_columns=[(20, 'name'), (3, 'pyint:top_half')])

        :param data_columns: specification for the data structure
        :type data_columns: list
        :param num_rows: number of rows the generator will yield
        :type num_rows: int
        :param align: positioning of the value. (left, middle, right)
        :type align: str
        :return: Serialized Fixed Width data
        :rtype: str

        :sample: data_columns=[(20, 'name'), (3, 'pyint', {'min_value': 50,
                'max_value': 100})], align='right', num_rows=2
        )   r   r   pyint	max_valuer,  N<^>)r)  middlerightr   r	  rk   
)r4   r   r  r   r  rl   getrv   )r"   r   r   r*  r  	align_mapr   r1   r   r   r  r  r  results                 r#   fixed_widthzProvider.fixed_width  s3   J +r*+ 
 (<L
 
	
 x 	& 	&AC1= S S-zI)2:1!&$// T#$RSSS55jKKFKK

fimmE3&?&?IIII&5&QRRRRKK%%%%yyr%   r  r  c                    t          j        d|          r| j                            |          S t          j        d|          r|                    d          S t          j        d|          ri|                    d          \  }}| j                            |                                          } | j        j        |                                fi |S  | j        j        |fi |S )a  
        Formats the string in different ways depending on its contents.

        The return can be the '@word' itself, a '{{ token }}' passed to PyStr,
        or a 'provider:argument_group' format field that returns potentially
        a non-string type.

        This ensures that Numbers, Boolean types that are generated in the
        JSON structures in there proper type, and not just strings.
        z.*\{\{.*\}\}.*z^@.*@z^[a-zA-Z0-9_-]*:\w:)	rematchr   r   lstripsplitget_argumentsstripr   )r"   r  r  argument_groupr  s        r#   r  z Provider._value_format_selection  s     8%z22 	;>..z::: 8GZ(( 	*$$S))) 8):66 	J)3)9)9#)>)>&J44^5I5I5K5KLLI(4>()9)9););IIyIII %t~$Z::6:::r%   )r   )r*   )F)re   TTTT)r~   r   r   N)r   r   NN)r   Nr   re   F)Nr   re   F)Nre   NN)re   TNN)Nre   r)  )*__name__
__module____qualname__r_   r  r$   r	   r)   r5   r9   r   rE   r=   r   r   rL   rQ   rV   ra   rb   r   r}   r   r   r   r
   r   r   r   r   r   r   r   r   r   r  r  r   r#  DataColumnsr8  r  r<   r%   r#   r   r      sh       O Oc O4 O O O O0htn 0 0 0 0" "S " " " " "  S X:gdm:::: X:9gen9999 X9 d uUCZ/@     c X;wt};;;; X;:wu~:#::: X: t eSj0A          X ==5=== X=<<C<<< X<  %s
2C     s X4T4di444 X4DXtyk3&67DCDDD XDHXtyk5&89HeHHH XH ^a %$)c)9 :Hdi[RWEW<X XYZ 
uc49$	%   * "1 11 1 	1
 1 1 
1 1 1 1j "'!%)@% @%@% @% 	@%
 c]@% 
@% @% @% @%H "'!%)E% E%E% E% 	E%
 c]E% 
E% E% E% E%R !+!8<$() )CHo) ) eC#345	)
 SM) 
) ) ) )Z #*.(C %?% ?%?% #'?% CHo	?%
 ?% ?% ?% 
?% ?% ?% ?%F +/(C %
 
#'
 CHo
 	

 
 

 
 
 
6 +/(C %
 
#'
 CHo
 	

 
 

 
 
 
6 +/(C %
 
#'
 CHo
 	

 
 

 
 
 
6 (, $+/h htnh h 	h
 d;'(h 
h h h h" (, $+/l8 l8tnl8 l8 	l8
 d;'(l8 
l8 l8 l8 l8` %)+/-1( (( #( i(	(
  	*( 
( ( ( (:> >(= >PS >ad >ru > > > >@;# ; ;sTWx ; ; ; ; ; ;r%   r   )'r   rD   r   r  r6   r<  rn   r   ra   r   r   typingr   r   r   r   r   r	   r
   r   r   r   r   r   faker.exceptionsr   rk   r   pythonr   	localizedregister_dialectexcel	QUOTE_ALLr_   rE   
ColumnSpecrF  r   r<   r%   r#   <module>rO     s   



  				  				 				           l l l l l l l l l l l l l l l l l l l l l l l l l l l l / / / / / /            	  [#)S] C C C C 5c?E#sDcN*B$CCD
:p; p; p; p; p;| p; p; p; p; p;r%   