/usr/local/lib/python3.6/site-packages/datasets/__pycache__
Edit: /usr/local/lib/python3.6/site-packages/datasets/__pycache__/streaming.cpython-36.pyc (4119B)
3
<%Eg @ s d dl Z d dlZd dlmZ d dlmZmZmZ ddlm Z m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddl m!Z! ee"Z#erdd l$m%Z% deee&e'f d
ddZ(d
dddZ)dS ) N)wraps)
TYPE_CHECKINGOptionalUnion ) xbasenamexdirname xet_parsexgetsizexglobxisdirxisfilexjoinxlistdirxopenxpandas_read_csvxpandas_read_excelxPathxrelpathxsio_loadmatxsplit xsplitextxwalkxxml_dom_minidom_parse)
get_logger)patch_submodule)get_imports)DatasetBuilder)use_auth_tokenc s t j| }t|dr|jrdS fdd}t|d|tj t|d|tj t|d|tj t|d|t j t|d t
j t|d
tj t|dtj t|dt
j t|d
tj t|dtj t|d|tj t|d|tj t|d|tj t|dtj t|d|tdgdj t|dtdgdj t|d|tdgdj t|d|tj t|d|tj d|_dS )a Extend the module to support streaming.
We patch some functions in the module to use `fsspec` to support data streaming:
- We use `fsspec.open` to open and read remote files. We patch the module function:
- `open`
- We use the "::" hop separator to join paths and navigate remote compressed/archive files. We patch the module
functions:
- `os.path.join`
- `pathlib.Path.joinpath` and `pathlib.Path.__truediv__` (called when using the "/" operator)
The patched functions are replaced with custom functions defined to work with the
:class:`~download.streaming_download_manager.StreamingDownloadManager`.
Args:
module_path: Path to the module to be extended.
use_auth_token: Whether to use authentication token.
_patched_for_streamingNc s t fdd}d|_|S )Nc s | di|S )Nr )argskwargs)functionr r