/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__/extract.cpython-36.pyc (10868B)
3 <%Eg*@sZddlZddlZddlZddlZddlZddlZddlZddlZddlm Z m Z ddl m Z m Z mZddlmZddlmZe rddlZGdd d ZGd d d e ZGd d d ee ZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGd d!d!Z dS)"N)ABCabstractmethod) TYPE_CHECKINGOptionalUnion)config)FileLockc@sVeZdZdeedddZeedddZeeedd d Zdeeed d dZ dS)ExtractManagerN) cache_dircCs&|rtjj|tjntj|_t|_dS)N) ospathjoinrZEXTRACTED_DATASETS_DIRZEXTRACTED_DATASETS_PATH extract_dir Extractor extractor)selfr r@/usr/local/lib/python3.6/site-packages/datasets/utils/extract.py__init__szExtractManager.__init__)rreturncCs,ddlm}tjj|}tjj|j||S)Nr )hash_url_to_filename)Z file_utilsrr rabspathrr)rrrabs_pathrrr_get_output_paths  zExtractManager._get_output_path) output_path force_extractrcCs*|p(tjj| o(tjj|o&tj| S)N)r risfileisdirlistdir)rrrrrr _do_extract#szExtractManager._do_extractF) input_pathrrcCs>|jj|}|s|S|j|}|j||r:|jj||||S)N)rinfer_extractor_formatrr!extract)rr"rextractor_formatrrrrr$(s   zExtractManager.extract)N)F) __name__ __module__ __qualname__rstrrrboolr!r$rrrrr sr c@sVeZdZeeedefedddZe eedefedefddddZ dS) BaseExtractorz pathlib.Path)rrcKsdS)Nr)clsrkwargsrrris_extractable3szBaseExtractor.is_extractableN)r"rrcCsdS)Nr)r"rrrrr$8szBaseExtractor.extract) r&r'r( classmethodrrr)r*r. staticmethodr$rrrrr+2s r+c@sLeZdZdZeedefedddZe d edefe e dddZ d S) MagicNumberBaseExtractorz pathlib.Path)rmagic_number_lengthc Cs t|d }|j|SQRXdS)Nrb)openread)rr3frrrread_magic_numberAs z*MagicNumberBaseExtractor.read_magic_number)r magic_numberrc Cs<|s0y|j|t|j}Wntk r.dSX|j|jS)NF)r8lenr9OSError startswith)r,rr9rrrr.Fs z'MagicNumberBaseExtractor.is_extractableN)r2) r&r'r(r9r0rr)intr8r/bytesr*r.rrrrr1>s r1c@sNeZdZeedefedddZeedefedefddddZ dS) TarExtractorz pathlib.Path)rrcKs tj|S)N)tarfile is_tarfile)r,rr-rrrr.QszTarExtractor.is_extractableN)r"rrcCs.tj|ddtj|}|j||jdS)NT)exist_ok)r makedirsr@r5 extractallclose)r"rZtar_filerrrr$Us  zTarExtractor.extract) r&r'r(r/rr)r*r.r0r$rrrrr?Psr?c@s6eZdZdZeedefedefddddZdS) GzipExtractorsz pathlib.PathN)r"rrcCs>tj|d(}t|d}tj||WdQRXWdQRXdS)Nr4wb)gzipr5shutil copyfileobj)r"rZ gzip_fileextracted_filerrrr$`s zGzipExtractor.extract)r&r'r(r9r0rr)r$rrrrrF]srFc@sNeZdZeedefedddZeedefedefddddZ dS) ZipExtractorz pathlib.Path)rrcKs tj|S)N)zipfile is_zipfile)r,rr-rrrr.hszZipExtractor.is_extractableN)r"rrc Cs<tj|ddtj|d}|j||jWdQRXdS)NT)rBr)r rCrMZipFilerDrE)r"rzip_filerrrr$ls zZipExtractor.extract) r&r'r(r/rr)r*r.r0r$rrrrrLgsrLc@s6eZdZdZeedefedefddddZdS) XzExtractors7zXZz pathlib.PathN)r"rrcCs<tj|(}t|d}tj||WdQRXWdQRXdS)NrG)lzmar5rIrJ)r"rcompressed_filerKrrrr$ws  zXzExtractor.extract)r&r'r(r9r0rr)r$rrrrrRtsrRc@sVeZdZdZdZeedefedddZ e edefedefddd d Z dS) RarExtractorsRar!sRar!z pathlib.Path)rrc Ks<t|d}|jt|j}WdQRX||jkp:|j|jS)z9https://github.com/markokr/rarfile/blob/master/rarfile.pyr4N)r5r6r:RAR5_IDr<RAR_ID)r,rr-r7r9rrrr.s zRarExtractor.is_extractableN)r"rrcCsDtjstdddl}tj|dd|j|}|j||jdS)NzPlease pip install rarfilerT)rB) rZRARFILE_AVAILABLEr;rarfiler rCZRarFilerDrE)r"rrXrfrrrr$s  zRarExtractor.extract) r&r'r(rWrVr/rr)r*r.r0r$rrrrrU~s rUc@s6eZdZdZeedefedefddddZdS) ZstdExtractors(/z pathlib.PathN)r"rrcCsZtjstdddl}|j}t|d(}t|d}|j||WdQRXWdQRXdS)NzPlease pip install zstandardrr4rG)rZZSTANDARD_AVAILABLEr;Z zstandardZZstdDecompressorr5 copy_stream)r"rzstdZdctxZifhZofhrrrr$s zZstdExtractor.extract)r&r'r(r9r0rr)r$rrrrrZsrZc@s6eZdZdZeedefedefddddZdS)Bzip2ExtractorsBZhz pathlib.PathN)r"rrcCs>tj|d(}t|d}tj||WdQRXWdQRXdS)Nr4rG)bz2r5rIrJ)r"rrTrKrrrr$s zBzip2Extractor.extract)r&r'r(r9r0rr)r$rrrrr]sr]c@s6eZdZdZeedefedefddddZdS)SevenZipExtractors7z'z pathlib.PathN)r"rrc CsJtjstdddl}tj|dd|j|d}|j|WdQRXdS)NzPlease pip install py7zrrT)rBrO)rZPY7ZR_AVAILABLEr;py7zrr rCZ SevenZipFilerD)r"rr`archiverrrr$s zSevenZipExtractor.extract)r&r'r(r9r0rr)r$rrrrr_sr_c@s6eZdZdZeedefedefddddZdS) Lz4Extractors"Mz pathlib.PathN)r"rrcCsVtjstdddl}|jj|d(}t|d}tj||WdQRXWdQRXdS)NzPlease pip install lz4rr4rG)rZ LZ4_AVAILABLEr;Z lz4.frameframer5rIrJ)r"rlz4rTrKrrrr$s  zLz4Extractor.extract)r&r'r(r9r0rr)r$rrrrrbsrbc @seZdZeeeeeee e e d Z e ddZeedefedddZe dedefeed d d Ze edefed d dZe dedefedefeeeeddddZdS)r) tarrHzipxzZrarr\r^Z7zrdcCs@d}x6|jjD](}t|drt|j}||kr4|n|}qW|S)Nrr9) extractorsvalueshasattrr:r9)r,magic_number_max_lengthrr3rrr_get_magic_number_max_lengths   z&Extractor._get_magic_number_max_lengthz pathlib.Path)rr3c Cs(ytj||dStk r"dSXdS)N)r3r2)r1r8r;)rr3rrr_read_magic_numberszExtractor._read_magic_numberF)rreturn_extractorrcCs>tjdtd|j|}|r2|s$dSd|j|fS|s:dSdS)Nz{Method 'is_extractable' was deprecated in version 2.4.0 and will be removed in 3.0.0. Use 'infer_extractor_format' instead.)categoryTF)FN)warningswarn FutureWarningr#rh)r,rrnr%rrrr.s zExtractor.is_extractable)rrcCsB|j}|j||}x(|jjD]\}}|j||dr |Sq WdS)N)r9)rlrmrhitemsr.)r,rrkr9r%rrrrr#s  z Extractor.infer_extractor_formatN deprecated)r"rr%rrc Cst|d}t|tj|ddtjtjj|dd|sF|dkr|dksZt|t rzt j dt d|dkrt|n|}n |j |}|j ||St j dt dx(|j jD]}|j|r|j ||SqWWdQRXdS) Nz.lockT) ignore_errors)rBrtzsParameter 'extractor' was deprecated in version 2.4.0 and will be removed in 3.0.0. Use 'extractor_format' instead.)roztParameter 'extractor_format' was made required in version 2.4.0 and not passing it will raise an exception in 3.0.0.)r)r rIrmtreer rCrdirname isinstancerprqrrrhr$rir.)r,r"rr%rZ lock_pathrrrr$s$      zExtractor.extract)F)Nrt)r&r'r(r?rFrLrRrUrZr]r_rbrhr/rlr0rr)r=rmr*r.r#rr+r$rrrrrs(  "r)!r^rHrSr rIr@rprMabcrrtypingrrrrZfilelockr pathlibr r+r1r?rFrLrRrUrZr]r_rbrrrrrs4