
    Vg3                     N    d dl Z d dlmZ d dlmZmZ ddlmZmZ  G d de      Z	y)    N)OrderedDict)DictOptional   )BaseProviderElementsTypec                      e Zd ZU dZdZee   ed<   dZee   ed<   dZ	ee   ed<   dZ
ee   ed	<   d
Zee   ed<   dZee   ed<   dZee   ed<   dZee   ed<    edefdefde	fde
fdefdefdefdeff      Zeeee   f   ed<   dZee   ed<   dZee   ed<   dZee   ed <   d!Zee   ed"<   d#Zee   ed$<    edefdefd%efdefdeff      Zeeee   f   ed&<   d'Zee   ed(<   d6d*ee   d+efd,Zd7d*ee   d-ee   d+efd.Zd6d*ee   d+efd/Z	 	 	 	 d8d0ed*ee   d-ee   d1ee   d+ef
d2Zd6d3ee   d+efd4Z d6d3ee   d+efd5Z!y))9Providerz*Implement default file provider for Faker.)zapplication/atom+xmlzapplication/ecmascriptzapplication/EDI-X12zapplication/EDIFACTzapplication/jsonzapplication/javascriptzapplication/octet-streamzapplication/oggzapplication/pdfzapplication/postscriptzapplication/rdf+xmlzapplication/rss+xmlzapplication/soap+xmlzapplication/font-woffzapplication/xhtml+xmlzapplication/xml-dtdzapplication/xop+xmlzapplication/zipzapplication/gzipapplication_mime_types)	zaudio/basicz	audio/L24z	audio/mp4z
audio/mpegz	audio/oggzaudio/vorbiszaudio/vnd.rn-realaudiozaudio/vnd.wavez
audio/webmaudio_mime_types)z	image/gifz
image/jpegzimage/pjpegz	image/pngzimage/svg+xmlz
image/tiffzimage/vnd.microsoft.iconimage_mime_types)zmessage/httpzmessage/imdn+xmlzmessage/partialzmessage/rfc822message_mime_types)zmodel/examplez
model/igesz
model/meshz
model/vrmlzmodel/x3d+binaryzmodel/x3d+vrmlzmodel/x3d+xmlmodel_mime_types)zmultipart/mixedzmultipart/alternativezmultipart/relatedzmultipart/form-datazmultipart/signedzmultipart/encryptedmultipart_mime_types)ztext/cmdztext/cssztext/csvz	text/htmlztext/javascriptz
text/plainz
text/vcardztext/xmltext_mime_types)z
video/mpegz	video/mp4z	video/oggzvideo/quicktimez
video/webmzvideo/x-matroskazvideo/x-ms-wmvzvideo/x-flvvideo_mime_typesapplicationaudioimagemessagemodel	multiparttextvideo
mime_types)flacmp3wavaudio_file_extensions)bmpgifjpegjpgpngtiffimage_file_extensions)csscsvhtmljsjsontxttext_file_extensions)mp4avimovwebmvideo_file_extensions)docdocxxlsxlsxpptpptxodtodsodppagesnumberskeypdfoffice_file_extensionsofficefile_extensions)sdvdxvdunix_device_prefixesNcategoryreturnc                     |r|n1| j                  t        | j                  j                                     }| j                  | j                  |         S )as  Generate a mime type under the specified ``category``.

        If ``category`` is ``None``, a random category will be used. The list of
        valid categories include ``'application'``, ``'audio'``, ``'image'``,
        ``'message'``, ``'model'``, ``'multipart'``, ``'text'``, and
        ``'video'``.

        :sample:
        :sample: category='application'
        )random_elementlistr   keysselfrG   s     ^/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/faker/providers/file/__init__.py	mime_typezProvider.mime_type   sD      (8T-@-@dooFZFZF\A]-^""4??8#<==    	extensionc                 j    || j                  |      }| j                  j                         }| d| S )a  Generate a random file name with extension.

        If ``extension`` is ``None``, a random extension will be created under
        the hood using |file_extension| with the specified ``category``. If a
        value for ``extension`` is provided, the value will be used instead,
        and ``category`` will be ignored. The actual name part itself is
        generated using |word|.

        :sample: size=10
        :sample: category='audio'
        :sample: extension='abcdef'
        :sample: category='audio', extension='abcdef'
        .)file_extension	generatorword)rN   rG   rR   filenames       rO   	file_namezProvider.file_name   s=     ++H5I++-1YK((rQ   c                     |2| j                  t        | j                  j                                     }| j                  | j                  |         S )a9  Generate a file extension under the specified ``category``.

        If ``category`` is ``None``, a random category will be used. The list of
        valid categories include: ``'audio'``, ``'image'``, ``'office'``,
        ``'text'``, and ``'video'``.

        :sample:
        :sample: category='image'
        )rJ   rK   rB   rL   rM   s     rO   rU   zProvider.file_extension   sJ     **40D0D0I0I0K+LMH""4#7#7#ABBrQ   depthabsolutec                     | j                  ||      }d| }t        d|      D ]!  }d| j                  j                          | }# |r|S |dd S )aJ  Generate an pathname to a file.

        This method uses |file_name| under the hood to generate the file name
        itself, and ``depth`` controls the depth of the directory path, and
        |word| is used under the hood to generate the different directory names.

        If ``absolute`` is ``True`` (default), the generated path starts with
        ``/`` and is absolute. Otherwise, the generated path is relative.

        :sample: size=10
        :sample: depth=3
        :sample: depth=5, category='video'
        :sample: depth=5, category='video', extension='abcdef'
        /r      N)rY   rangerV   rW   )rN   r[   rG   rR   r\   filepath_s           rO   	file_pathzProvider.file_path   se    * NN8Y7vJq% 	5At~~**,-dV4D	5t-T!"X-rQ   prefixc                     || j                  | j                        }| j                  t        j                        }d||}|S )zGenerate a Unix device file name.

        If ``prefix`` is ``None``, a random prefix will be used. The list of
        valid prefixes include: ``'sd'``, ``'vd'``, and ``'xvd'``.

        :sample:
        :sample: prefix='mmcblk'
        z/dev/)rJ   rF   stringascii_lowercase)rN   re   suffixrb   s       rO   unix_devicezProvider.unix_device  sD     >(()B)BCF))&*@*@A$f-rQ   c                 b    | j                  |      }|t        | j                               z  }|S )zGenerate a Unix partition name.

        This method uses |unix_device| under the hood to create a device file
        name with the specified ``prefix``.

        :sample:
        :sample: prefix='mmcblk'
        )re   )rj   strrandom_digit)rN   re   rb   s      rO   unix_partitionzProvider.unix_partition*  s4     $$F$3D%%'((rQ   )N)NN)r_   NNT)"__name__
__module____qualname____doc__r   r   rl   __annotations__r   r   r   r   r   r   r   r   r   r   r   r&   r-   r2   r@   rB   rF   r   rP   rY   rU   intboolrd   rj   rn    rQ   rO   r
   r
   	   s   4&1L- &P+l3' +l3' -S) 
+l3' 
/,s+ *O\#&  
+l3' 
 0;23&'&'*+&'./_%&'		
0JS,s++, 0<, 0<, /,s+ 0<, 1L-   5@+,+,-.)*+,	
5OT#|C001  /B,s+A>(3- >3 >)(3- )8C= )\_ )&Cx} C C  "&#'#'.. 3-. C=	.
 4.. 
.6(3- 3 Xc] c rQ   r
   )
rg   collectionsr   typingr   r    r   r   r
   rv   rQ   rO   <module>rz      s     # ! )l| lrQ   