
    1~h#                        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
 d dlmZmZmZmZmZmZ ddlmZmZmZmZ ddlmZmZmZ ddlmZ dd	lmZ d
Z ed      Z	 	 ddededee ef   deee       dee   ddfdZ!ddedddfdee    deee      de deeeef      dee"   deee       ddfdZ# G d d      Z$ddee    ddfdZ%e&dk(  r e%        yy)     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           	      h   |t         j                  }|g }t        |       t        d| j                  |       |       t        |       t	        d| j
                  dz         }|j                         D ]  \  }}||v rt        j                  ||d      }	 t        j                  t        |      j                         d|z
  dd	      }	t        j                  ||	d      D ]  \  }
}t        d|
d| dd| |         y # t        $ r d
g}	Y It        $ r t        d|d|      w xY w)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)r   r   r   r   r   margin	signatureexamplesignature_lineslinesleftrights               R/var/www/peopleoo.sandbox-dev.co.uk/venv/lib/python3.12/site-packages/faker/cli.pyprint_providerrC      sP    ~	v	D&&x01
2@	vS%%)*F(..0 ?	7 "--	SWX	NMMG'')Fl#"&	E %00%SUV 	?KD%BtAfXP:&b0v>	?%? " 	  KE! 	Ni	}LLMM	Ns   3D		D1D1provider_or_fieldargslangseedincludesc                 r   |g }|t         j                  }t        ||      }|j                  |       ddlm} t        t        |            }| rd| v r| j                  d      }	|	d   t        v r|	d   n|}
t        |
| g|      }|j                  |       t        j                  |      }||_        t        ||j                         d   |j                  |j                         d         |       y 	 t!         |j"                  | g| d|	       y t        j                  |      }g }	 	 |j)                  dd|      }	 |D ]  \  }}t        ||||        y # t$        $ r t'        d
|  d| d      w xY w# t*        j,                  $ r%}|j/                  |j0                         Y d }~nd }~ww xY w)N)localerH   r   r   .)	providersrH   )r   r'   )endr    zNo faker found for "(z)"T)	with_argswith_defaultsr   )r+   r,   r   seed_instancefaker.providersr   listdirsplitr   r   r   already_generatedrC   get_providersget_provider_formattersr-   formatAttributeError
ValueErrorget_formattersr   UnsupportedFeatureappendname)rD   rE   rF   r   rG   rH   faker   base_provider_formatterspartsrJ   r   unsupportedr   er   fakerss                    rB   	print_docrg   >   s    |~x0Dt,#C$56##%++C0E"')/@"@U2YdF,=+>RDt$''-C$<C!""$Q'++D,>,>,@,CD	Vkdkk"3;d;&Q
 ##D)!# //$d]h/i
  * 	AHf3&@	A " V #78I7J!D6QS!TUUV 00 +""166**+ s$   6E /E= E:=F5F00F5c                   ,    e Zd Zddee   ddfdZddZy)CommandNargvr   c                     |xs t         j                  d d  | _        t        | j                  d         j                  | _        y )Nr   )r+   rj   r   r`   	prog_name)selfrj   s     rB   __init__zCommand.__init__v   s0    'CHHQK	diil+00    c           	      :   t         j                  j                  dd      j                  d      d   }|t        vrt
        }ddj                  t        t                     d| dt
         d	}t        j                  }t        j                  | j                  | j                   d
t         ||      }|j                  dddt                |j                  dddd       |j                  ddt        j                  d      t        j                   d       |j                  ddt        |dd       |j                  dd d!t"        d"#       |j                  d$d%d&d'(       |j                  d)d*t"        d+,       |j                  d-d.t$        d/d01       |j                  d2d3d4d56       |j                  d7d8d3d/d9:       |j'                  | j(                  d!d;       }|j*                  r%t-        j.                  t,        j0                  <       n$t-        j.                  t,        j2                  <       t5        j6                  |j6                         t9        |j:                        D cg c]  }t5        j4                          }}t9        |j:                        D ]w  }t=        |j>                  |j@                  |jB                  |jD                  ||   |jF                  =       tI        |jJ                  |jD                  >       |j>                  rw y; y;c c}w )?z{
        Given the command-line arguments, this creates a parser appropriate
        to that command, and runs it.
        LANGen_USrK   r   zsupported 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 )actionrw   z-vz	--verbose
store_truezshow INFO logging events instead of CRITICAL, which is the default. These logging events provide insight into localization of specific providers.)rx   helpz-or   wzredirect output to a file)metavartypedefaultrz   z-lz--langLOCALEz:specify the language for a localized provider (e.g. de_DE))choicesr~   r|   rz   z-rz--repeatr   z(generate the specified number of outputs)r~   r}   rz   z-sz--sep
z-use the specified separator after each output)r~   rz   z--seedSEEDzlspecify a seed for the random generator so that results are repeatable. Also compatible with 'repeat' option)r|   r}   rz   z-iz	--include*zlist of additional custom providers to user, given as the import path of the module containing your Provider class (not the provider class itself))r~   nargsrz   ra   store?z6name of the fake to generate output for (e.g. profile))rx   r   rz   	fake_argszfake argumentzoptional arguments to pass to the fake (e.g. the profile fake takes an optional list of comma separated field names as the first argument))r|   rx   r   rz   N)level)rF   r   rG   rH   r   )&osenvirongetrV   r   r   joinsortedargparseRawDescriptionHelpFormatterArgumentParserrl   r   add_argumentFileTyper+   r,   intr   
parse_argsrj   verboseloggingbasicConfigDEBUGCRITICALrandomrG   rangerepeatrg   ra   r   rF   oincluder-   sep)	rm   default_localeru   rv   parser	arguments_seedsis	            rB   executezCommand.executez   s    8>>sCAF!22+N99V%&'( )-
 .<,< =  B #>>((>>*)G9=+	
 	K	YwiCXY"	 	 	
 	""3'JJ, 	 	
 	%"P 	 	
 	; 	 	
 	C	 	 	
 	#	 	 	
 	* 	 		
 	L	 	 	
 	# 	 		
 %%diim4	gmm4g&6&67INN#*/	0@0@*ABQBBy''( 	A##^^ {{1X"** )--ikk2>>	 Cs   +LN)r   N)__name__
__module____qualname__r   r4   rn   r    ro   rB   ri   ri   u   s    1Xc] 1d 1[ro   ri   rj   c                     t         j                  j                  &t        dt         j                         t        d       t        |       }|j                          y)z$A simple method that runs a Command.Nzlplease set python env PYTHONIOENCODING=UTF-8, example: export PYTHONIOENCODING=UTF-8, when writing to stdoutr   r   )r+   r,   encodingr-   stderrexitri   r   )rj   commands     rB   execute_from_command_liner     sC    
zz"D	

 	QdmGOOro   __main__)NNr   )'r   r9   r   r   r   r+   r2   ior   pathlibr   typingr   r   r   r   r	   r
   r'   r   r   r   r   configr   r   r   r   rM   r   
__author__r   r4   rC   floatrg   ri   r   r   r   ro   rB   <module>r      sh      	  
    ? ? 4 4 M M " #
CL %)#$?	$?$? S!V$? tCy!	$?
 V$? 
$?P (,"59 $(4A}4A
47
4A 4A U6=012	4A
 5/4A tCy!4A 
4An` `FHSM T  z ro   