HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/faker/__pycache__/cli.cpython-310.pyc
o

'we�#�@s�ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZmZmZmZddlmZmZmZmZddlmZmZmZddlmZdd	lmZd
Zed�Z		d!ded
edee efdee
e deeddfdd�Z!ddedddfdee dee
ede deeeefdee"dee
e ddfdd�Z#Gdd�d�Z$d"dee ddfdd�Z%e&d kr�e%�dSdS)#�N)�
TextIOWrapper)�Path)�Dict�List�Optional�TextIO�TypeVar�Union�)�VERSION�Faker�
documentor�
exceptions)�AVAILABLE_LOCALES�DEFAULT_LOCALE�META_PROVIDERS_MODULES)�
Documentor��BaseProvider�joke2k�T�doc�provider�
formatters�excludes�output�returnc	Cs|durtj}|dur
g}t|d�td|�|���|d�t|d�td|jd�}|��D]\\}}||vr8q/tj||dd�}ztjt	|��
�d|ddd	�}	Wnty]d
g}	Yntymt
d|�d|����wtj||	d
d�D]\}
}td|
d|���d|��|d�qvq/dS)N��filez### ��z  )�width�subsequent_indent�z# )r!�initial_indentr"z<bytes>z	error on z with value �)�	fillvalue�	�<)�sys�stdout�print�get_provider_name�max�max_name_len�items�textwrap�wrap�str�
expandtabs�UnicodeDecodeError�UnicodeEncodeError�	Exception�	itertools�zip_longest)rrrrr�margin�	signature�example�signature_lines�lines�left�right�r@�B/home/arjun/projects/env/lib/python3.10/site-packages/faker/cli.py�print_providers8



�
�"��rB�provider_or_field�args�lang�seed�includesc
Cs�|durg}|dur
tj}t||d�}|�|�ddlm}tt|��}|r�d|vre|�d�}	|	dt	vr9|	dn|}
t|
|g|d�}|�|�t
�|�}||_t
||��d|�|��d�|d�dSzt|j|g|�R�d|d	�WdSty�td
|�d|�d���wt
�|�}g}	z
|jd
d
|d�}
Wntjy�}z|�|j�WYd}~nd}~wwnq�|
D]\}}t
||||d�q�dS)N)�localerGrr�.���)�	providersrG)rr%)�endrzNo faker found for "�(z)"T)�	with_args�
with_defaultsr)r)r*r�
seed_instance�faker.providersr�list�dir�splitrr
r�already_generatedrB�
get_providers�get_provider_formattersr+�format�AttributeError�
ValueError�get_formattersr�UnsupportedFeature�append�name)rCrDrErrFrG�faker�base_provider_formatters�partsrHr�unsupportedr�er�fakersr@r@rA�	print_doc>sR





�"�
����rec@s.eZdZddeeddfdd�Zd	dd�ZdS)
�CommandN�argvrcCs*|ptjdd�|_t|jd�j|_dS)Nr)r)rgrr^�	prog_name)�selfrgr@r@rA�__init__vszCommand.__init__c	Cs�tj�dd��d�d}|tvrt}dd�tt���d|�dt�d	�}tj	}tj
|j|j�d
t��||d�}|j
dd
dt��d�|j
ddddd�|j
ddt�d�tjdd�|j
ddt|ddd�|j
dd d!td"d#�|j
d$d%d&d'd(�|j
d)d*td+d,�|j
d-d.td/d0d1�|j
d2d3d4d5d6�|j
d7d8d3d/d9d:�|�|jd!d;��}|jr�tjtjd<�ntjtjd<�t�|j�d=d>�t|j�D�}t|j�D]!}t|j|j |j!|j"|||j#d?�t$|j%|j"d@�|js�d;Sq�d;S)Az{
        Given the command-line arguments, this creates a parser appropriate
        to that command, and runs it.
        �LANG�en_USrIrzsupported locales:

  z, a

  Faker can take a locale as an optional argument, to return localized data. If
  no locale argument is specified, the factory falls back to the user's OS
  locale as long as it is supported by at least one of the providers.
     - for this user, the default locale is z�.

  If the optional argument locale and/or user's default locale is not available
  for the specified provider, the factory falls back to faker's default locale,
  which is aL.

examples:

  $ faker address
  968 Bahringer Garden Apt. 722
  Kristinaland, NJ 09890

  $ faker -l de_DE address
  Samira-Niemeier-Allee 56
  94812 Biedenkopf

  $ faker profile ssn,birthdate
  {'ssn': u'628-10-1085', 'birthdate': '2008-03-29'}

  $ faker -r=3 -s=";" name
  Willam Kertzmann;
  Josiah Maggio;
  Gayla Schmitt;

z	 version )�prog�description�epilog�formatter_classz	--version�versionz	%(prog)s )�actionrqz-vz	--verbose�
store_truez�show INFO logging events instead of CRITICAL, which is the default. These logging events provide insight into localization of specific providers.)rr�helpz-or�wzredirect output to a file)�metavar�type�defaultrtz-lz--lang�LOCALEz:specify the language for a localized provider (e.g. de_DE))�choicesrxrvrtz-rz--repeatr
z(generate the specified number of outputs)rxrwrtz-sz--sep�
z-use the specified separator after each output)rxrtz--seed�SEEDzlspecify a seed for the random generator so that results are repeatable. Also compatible with 'repeat' option)rvrwrtz-iz	--include�*z�list of additional custom providers to user, given as the import path of the module containing your Provider class (not the provider class itself))rx�nargsrtr_�store�?z6name of the fake to generate output for (e.g. profile))rrr~rt�	fake_argsz
fake argumentz�optional arguments to pass to the fake (e.g. the profile fake takes an optional list of comma separated field names as the first argument))rvrrr~rtN)�levelcSsg|]}t���qSr@)�random)�.0�_r@r@rA�
<listcomp>sz#Command.execute.<locals>.<listcomp>)rErrFrGr)&�os�environ�getrTrr�join�sorted�argparse�RawDescriptionHelpFormatter�ArgumentParserrhr�add_argument�FileTyper)r*�intr�
parse_argsrg�verbose�logging�basicConfig�DEBUG�CRITICALr�rF�range�repeatrer_r�rE�o�includer+�sep)ri�default_localerorp�parser�	arguments�seeds�ir@r@rA�executezs����!��
�����	������zCommand.execute�N)rN)�__name__�
__module__�__qualname__rr2rjr�r@r@r@rArfusrfrgcCs6tjjdurtdtjd�td�t|�}|��dS)z$A simple method that runs a Command.Nzlplease set python env PYTHONIOENCODING=UTF-8, example: export PYTHONIOENCODING=UTF-8, when writing to stdoutrr
)r)r*�encodingr+�stderr�exitrfr�)rg�commandr@r@rA�execute_from_command_lines�r��__main__)NNr�)'r�r7r�r�r�r)r0�ior�pathlibr�typingrrrrrr	r%rrr
r�configrrrrrKr�
__author__rr2rB�floatrerfr�r�r@r@r@rA�<module>st ���
�
��
�(��
����
�
�7$
�