/usr/local/lib/python3.6/site-packages/datasets/utils/__pycache__
NameSizeModeActions
beam_utils.cpython-36.pyc20170644editdlrm
deprecation_utils.cpython-36.pyc33470644editdlrm
doc_utils.cpython-36.pyc6540644editdlrm
download_manager.cpython-36.pyc1560644editdlrm
extract.cpython-36.pyc108680644editdlrm
filelock.cpython-36.pyc104840644editdlrm
file_utils.cpython-36.pyc179040644editdlrm
info_utils.cpython-36.pyc45360644editdlrm
logging.cpython-36.pyc72580644editdlrm
metadata.cpython-36.pyc179400644editdlrm
patching.cpython-36.pyc34380644editdlrm
py_utils.cpython-36.pyc263160644editdlrm
readme.cpython-36.pyc89000644editdlrm
stratify.cpython-36.pyc31290644editdlrm
tf_utils.cpython-36.pyc18000644editdlrm
typing.cpython-36.pyc3550644editdlrm
version.cpython-36.pyc45390644editdlrm
_hf_hub_fixes.cpython-36.pyc32630644editdlrm
__init__.cpython-36.pyc3810644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/datasets/utils/__pycache__/readme.cpython-36.pyc (8900B)
3 <%Eg1 @s0ddlZddlmZddlmZmZmZddlZyddlj Z Wne k rZddl Z YnXddl m Z dZedeZejeZeeeefdd d Zed \ZZd d dgZeeeeeefZGdddZGdddeZedkr,ddlmZeddZej dej!Z"ee"j#Z#ej$e#Z%dS)N)Path)AnyListTuple) resourceszDhttps://github.com/huggingface/datasets/tree/main/src/datasets/utils/)resourcereturncCs$tjt|}tj|td|fS)Nz /resources/) pkg_resources read_textryamlZ safe_load BASE_REF_URL)r contentr?/usr/local/lib/python3.6/site-packages/datasets/utils/readme.pyload_yaml_resources rzreadme_structure.yamlz[Needs More Information]z[More Information Needed]zj(https://github.com/huggingface/datasets/blob/main/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)c@sTeZdZdeeeeedddZdedddZee d d d Z ed d dZ dS)SectionNF)namelevellinessuppress_parsing_errorscCsJ||_||_||_d|_d|_i|_g|_g|_|jdk rF|j|ddS)NT)r) rrrtext is_empty_textrparsing_error_listparsing_warning_listparse)selfrrrrrrr__init__)s zSection.__init__)rcCsd}g}d}xj|jD]}|jddkr,qq|jddddkrJ| }q|jd|jdkr| r|dkrt||jd||j|<g}n>|gkr|jdj|j7_|jdkr|jtkrd|_ g}dj|jd djd}q|j |qW|dkr:||jkr |j j d |d t||jd||j|<n@|gkrz|jdj|j7_|jdkrz|jtkrzd|_ |jdkr| r|j gks|j gkrd jd d|j |j D}}d|j d|}t|dS)NrFz z```r# rz)Multiple sections with the same heading `z:` have been found. Please keep only one of these sections. css|]}d|VqdS)z- Nr).0xrrr [sz Section.parse..z=The following issues were found while parsing the README at `z`: )rstripsplitrrrrjoin FILLER_TEXTrappendrrr ValueError)rrZcurrent_sub_levelZ current_linesZ code_startlineerrors error_stringrrrr5sB    z Section.parse) structurer c Csg}g}|ddkr8|jr8|jikr8|jd|jd|ddkr^|jr^|jd|jd|dd k r|jikrd d |dD}|jd |jd djdd |Ddndd |dD}d}x~t|D]r\}}||jkr|jd |jd|dd}q|jdkrqn|j|j|d|\} } } || 7}|| 7}qW|rx4|jD]*}||krX|jd|jd|dqXW|ri||fS|j||fSd S)aCValidates a Section class object recursively using the structure provided as a dictionary. Args: structute (:obj: `dict`): The dictionary representing expected structure. Returns: :obj: `ReadmeValidatorOutput`: The dictionary representation of the section, and the errors. Z allow_emptyFz"Expected some content in section `z` but it is empty.Zallow_empty_textzExpected some text in section `z4` but it is empty (text in subsections are ignored). subsectionsNcSsg|] }|dqS)rr)r$ subsectionrrr }sz$Section.validate..z Section `z&` expected the following subsections: z, cSsg|]}d|dqS)`r)r$r%rrrr3sz. Found 'None'.cSsg|] }|dqS)rr)r$r2rrrr3sz` is missing subsection: `z`.Tz###r4z` has an extra subsection: `z[`. Skipping further validation checks for this subsection as expected structure is unknown.) rrr+rr) enumeratervalidateto_dict) rr0 error_list warning_listvaluesZstructure_namesZhas_missing_subsectionsidxr_Zsubsec_error_listZsubsec_warning_listrrrr6_sD    (       zSection.validate)r cCs$|j|j|jdd|jjDdS)z3Returns the dictionary representation of a section.cSsg|] }|jqSr)r7)r$valuerrrr3sz#Section.to_dict..)rrrr1)rrrrr:)rrrrr7szSection.to_dict)NF)F) __name__ __module__ __qualname__strrboolrrdictReadmeValidatorOutputr6r7rrrrr(s *GrcseZdZdeeeeedfdd ZddZe de eedd d Z e deeeed d dZ dedfdd Z ddZddZZS)ReadMeNF)rrr0rcsBtj|dd||_d|_d|_||_|jdk r>|j|ddS)Nr)rrr)r)superrr0yaml_tags_line_count tag_countrr)rrrr0r) __class__rrrs zReadMe.__init__cCsx|jdkr|jt\}}}n|j|j\}}}|gks>|gkrtdjttdd||}d|jd|}t|dS)Nr#cSsd|S)Nz- r)r%rrrsz!ReadMe.validate..z3The following issues were found for the README at `z`: )r0 _validatereadme_structurer)listmaprr,)rrr8r9r.r/rrrr6s zReadMe.validate)pathr0rc Cs0t|dd}|j}WdQRX|||||dS)Nzutf-8)encoding)r)open readlines)clsrQr0rfrrrr from_readmeszReadMe.from_readmeroot)stringr0 root_namercCs|jd}|||||dS)Nr#)r)r()rUrYr0rZrrrrr from_strings zReadMe.from_string)rcsd}xL|jD]B}|jd7_|jddkrF|jd7_|jdkrFP|d7}q W|jdkrr|j|dd|_n|j|jd|_tj|ddS)Nrrz z---rF)r)rrIr'rJrHr)rr line_countr-)rKrrrs    z ReadMe.parsecCs t|jS)z>Returns the string of dictionary representation of the ReadMe.)rAr7)rrrr__str__szReadMe.__str__c Csg}g}|jdkr|jdn*|jdkr4|jdn|jdkrH|jdt|jj}|dkr|jddjdd t|jjDd nj|dkr|jd nVt|jjd}|jd r|j|j |d d\}}}||7}||7}n |jd|ri||fS|j ||fSdS)Nrz-Empty YAML markers are present in the README.z*No YAML markers are present in the README.rz2Only the start of YAML tags present in the README.z-The README has several first-level headings: z, cSsg|]}d|dqS)r4r)r$r%rrrr3sz$ReadMe._validate..zL. Only one heading is expected. Skipping further validation for this README.zmThe README has no first-level headings. One heading is expected. Skipping further validation for this README.zDataset Card forr1zuNo first-level heading starting with `Dataset Card for` found in README. Skipping further validation for this README.) rIr+rJlenrkeysr)rO startswithr6r7) rrNr8r9Znum_first_level_keysZ start_keyr<Zsec_error_listZsec_warning_listrrrrMs4      *    zReadMe._validate)NF)NF)NrXF)F)r>r?r@rArrCrBrr6 classmethodrrWr[rr]rM __classcell__rr)rKrrEs  rE__main__)ArgumentParserz?Validate the content (excluding YAML tags) of a README.md file.)usagereadme_filepath)&loggingpathlibrtypingrrrr Zimportlib.resourcesrr ImportErrorZimportlib_resourcesrr__file__Zthis_url getLoggerr>loggerrArrNZknown_readme_structure_urlr*rCrDrrEargparserdZap add_argument parse_argsargsrfrWZreadmerrrrs6     c