text stringlengths 24 253k | type stringclasses 1
value | start int64 67 146k | end int64 223 278k | depth int64 0 1 | filepath stringlengths 74 128 | parent_class stringclasses 1
value | class_index int64 0 271 |
|---|---|---|---|---|---|---|---|
class TableBlock(Table):
"""
`TableBlock` is the allowed class inside a `ConcanetationTable`.
Only `MemoryMappedTable` and `InMemoryTable` are `TableBlock`.
This is because we don't want a `ConcanetationTable` made out of other `ConcanetationTables`.
"""
pass | class_definition | 21,461 | 21,745 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/table.py | null | 100 |
class InMemoryTable(TableBlock):
"""
The table is said in-memory when it is loaded into the user's RAM.
Pickling it does copy all the data using memory.
Its implementation is simple and uses the underlying pyarrow Table methods directly.
This is different from the `MemoryMapped` table, for which p... | class_definition | 21,748 | 34,336 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/table.py | null | 101 |
class MemoryMappedTable(TableBlock):
"""
The table is said memory mapped when it doesn't use the user's RAM but loads the data
from the disk instead.
Pickling it doesn't copy the data into memory.
Instead, only the path to the memory mapped arrow file is pickled, as well as the list
of transfor... | class_definition | 34,452 | 44,969 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/table.py | null | 102 |
class ConcatenationTable(Table):
"""
The table comes from the concatenation of several tables called blocks.
It enables concatenation on both axis 0 (append rows) and axis 1 (append columns).
The underlying tables are called "blocks" and can be either `InMemoryTable`
or `MemoryMappedTable` objects.... | class_definition | 45,365 | 64,709 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/table.py | null | 103 |
class CastError(ValueError):
"""When it's not possible to cast an Arrow table to a specific schema or set of features"""
def __init__(self, *args, table_column_names: List[str], requested_column_names: List[str]) -> None:
super().__init__(*args)
self.table_column_names = table_column_names
... | class_definition | 86,502 | 87,847 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/table.py | null | 104 |
class _InitializeConfiguredDatasetBuilder:
"""
From https://stackoverflow.com/questions/4647566/pickle-a-dynamically-parameterized-sub-class
See also ConfiguredDatasetBuilder.__reduce__
When called with the param value as the only argument, returns an
un-initialized instance of the parameterized cla... | class_definition | 7,037 | 7,817 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 105 |
class ConfiguredDatasetBuilder(builder_cls):
BUILDER_CONFIGS = builder_configs
DEFAULT_CONFIG_NAME = default_config_name
__module__ = builder_cls.__module__ # so that the actual packaged builder can be imported
def __reduce__(self): # to make dynamically created class pickable, see _... | class_definition | 8,223 | 8,971 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 106 |
class BuilderConfigsParameters:
"""Dataclass containing objects related to creation of builder configurations from yaml's metadata content.
Attributes:
metadata_configs (`MetadataConfigs`, *optional*):
Configs parsed from yaml's metadata.
builder_configs (`list[BuilderConfig]`, *opt... | class_definition | 29,329 | 30,004 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 107 |
class DatasetModule:
module_path: str
hash: str
builder_kwargs: dict
builder_configs_parameters: BuilderConfigsParameters = field(default_factory=BuilderConfigsParameters)
dataset_infos: Optional[DatasetInfosDict] = None
importable_file_path: Optional[str] = None | class_definition | 30,018 | 30,305 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 108 |
class _DatasetModuleFactory:
def get_module(self) -> DatasetModule:
raise NotImplementedError | class_definition | 30,308 | 30,413 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 109 |
class LocalDatasetModuleFactoryWithScript(_DatasetModuleFactory):
"""Get the module of a local dataset. The dataset script is loaded from a local script."""
def __init__(
self,
path: str,
download_config: Optional[DownloadConfig] = None,
download_mode: Optional[Union[DownloadMod... | class_definition | 30,416 | 34,631 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 110 |
class LocalDatasetModuleFactoryWithoutScript(_DatasetModuleFactory):
"""Get the module of a dataset loaded from the user's data files. The dataset builder module to use is inferred
from the data files extensions."""
def __init__(
self,
path: str,
data_dir: Optional[str] = None,
... | class_definition | 34,634 | 40,725 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 111 |
class PackagedDatasetModuleFactory(_DatasetModuleFactory):
"""Get the dataset builder module from the ones that are packaged with the library: csv, json, etc."""
def __init__(
self,
name: str,
data_dir: Optional[str] = None,
data_files: Optional[Union[str, List, Dict]] = None,
... | class_definition | 40,728 | 43,057 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 112 |
class HubDatasetModuleFactoryWithoutScript(_DatasetModuleFactory):
"""
Get the module of a dataset loaded from data files of a dataset repository.
The dataset builder module to use is inferred from the data files extensions.
"""
def __init__(
self,
name: str,
commit_hash: st... | class_definition | 43,060 | 51,810 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 113 |
class HubDatasetModuleFactoryWithParquetExport(_DatasetModuleFactory):
"""
Get the module of a dataset loaded from parquet files of a dataset repository parquet export.
"""
def __init__(
self,
name: str,
commit_hash: str,
download_config: Optional[DownloadConfig] = None,... | class_definition | 51,813 | 54,668 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 114 |
class HubDatasetModuleFactoryWithScript(_DatasetModuleFactory):
"""
Get the module of a dataset from a dataset repository.
The dataset script comes from the script inside the dataset repository.
"""
def __init__(
self,
name: str,
commit_hash: str,
download_config: Op... | class_definition | 54,671 | 60,740 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 115 |
class CachedDatasetModuleFactory(_DatasetModuleFactory):
"""
Get the module of a dataset that has been loaded once already and cached.
The script that is loaded from the cache is the most recent one with a matching name.
"""
def __init__(
self,
name: str,
cache_dir: Optional... | class_definition | 60,743 | 64,770 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/load.py | null | 116 |
class SupervisedKeysData:
input: str = ""
output: str = "" | class_definition | 1,571 | 1,637 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/info.py | null | 117 |
class DownloadChecksumsEntryData:
key: str = ""
value: str = "" | class_definition | 1,651 | 1,722 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/info.py | null | 118 |
class MissingCachedSizesConfigError(Exception):
"""The expected cached sizes of the download file are missing.""" | class_definition | 1,725 | 1,842 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/info.py | null | 119 |
class NonMatchingCachedSizesError(Exception):
"""The prepared split doesn't have expected sizes.""" | class_definition | 1,845 | 1,948 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/info.py | null | 120 |
class PostProcessedInfo:
features: Optional[Features] = None
resources_checksums: Optional[dict] = None
def __post_init__(self):
# Convert back to the correct classes when we reload from dict
if self.features is not None and not isinstance(self.features, Features):
self.features... | class_definition | 1,962 | 2,573 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/info.py | null | 121 |
class DatasetInfo:
"""Information about a dataset.
`DatasetInfo` documents datasets, including its name, version, and features.
See the constructor arguments and properties for a full list.
Not all fields are known on construction and may be updated later.
Attributes:
description (`str`):... | class_definition | 2,587 | 13,544 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/info.py | null | 122 |
class DatasetInfosDict(Dict[str, DatasetInfo]):
def write_to_directory(self, dataset_infos_dir, overwrite=False, pretty_print=False) -> None:
total_dataset_infos = {}
dataset_infos_path = os.path.join(dataset_infos_dir, config.DATASETDICT_INFOS_FILENAME)
dataset_readme_path = os.path.join(da... | class_definition | 13,547 | 19,674 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/info.py | null | 123 |
class InvalidKeyError(Exception):
"""Raises an error when given key is of invalid datatype."""
def __init__(self, hash_data):
self.prefix = "\nFAILURE TO GENERATE DATASET: Invalid key type detected"
self.err_msg = f"\nFound Key {hash_data} of type {type(hash_data)}"
self.suffix = "\nKey... | class_definition | 2,026 | 2,458 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/keyhash.py | null | 124 |
class DuplicatedKeysError(Exception):
"""Raise an error when duplicate key found."""
def __init__(self, key, duplicate_key_indices, fix_msg=""):
self.key = key
self.duplicate_key_indices = duplicate_key_indices
self.fix_msg = fix_msg
self.prefix = "Found multiple examples genera... | class_definition | 2,461 | 3,253 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/keyhash.py | null | 125 |
class KeyHasher:
"""KeyHasher class for providing hash using md5"""
def __init__(self, hash_salt: str):
self._split_md5 = insecure_hashlib.md5(_as_bytes(hash_salt))
def hash(self, key: Union[str, int, bytes]) -> int:
"""Returns 128-bits unique hash of input key
Args:
key: ... | class_definition | 3,256 | 3,871 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/keyhash.py | null | 126 |
class ParallelBackendConfig:
backend_name = None | class_definition | 171 | 223 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/parallel/parallel.py | null | 127 |
class ParquetDatasetReader(AbstractDatasetReader):
def __init__(
self,
path_or_paths: NestedDataStructureLike[PathLike],
split: Optional[NamedSplit] = None,
features: Optional[Features] = None,
cache_dir: str = None,
keep_in_memory: bool = False,
streaming: bo... | class_definition | 490 | 2,336 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/parquet.py | null | 128 |
class ParquetDatasetWriter:
def __init__(
self,
dataset: Dataset,
path_or_buf: Union[PathLike, BinaryIO],
batch_size: Optional[int] = None,
storage_options: Optional[dict] = None,
**parquet_writer_kwargs,
):
self.dataset = dataset
self.path_or_buf ... | class_definition | 2,339 | 4,353 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/parquet.py | null | 129 |
class GeneratorDatasetInputStream(AbstractDatasetInputStream):
def __init__(
self,
generator: Callable,
features: Optional[Features] = None,
cache_dir: str = None,
keep_in_memory: bool = False,
streaming: bool = False,
gen_kwargs: Optional[dict] = None,
... | class_definition | 189 | 1,908 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/generator.py | null | 130 |
class CsvDatasetReader(AbstractDatasetReader):
def __init__(
self,
path_or_paths: NestedDataStructureLike[PathLike],
split: Optional[NamedSplit] = None,
features: Optional[Features] = None,
cache_dir: str = None,
keep_in_memory: bool = False,
streaming: bool =... | class_definition | 365 | 2,124 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/csv.py | null | 131 |
class CsvDatasetWriter:
def __init__(
self,
dataset: Dataset,
path_or_buf: Union[PathLike, BinaryIO],
batch_size: Optional[int] = None,
num_proc: Optional[int] = None,
storage_options: Optional[dict] = None,
**to_csv_kwargs,
):
if num_proc is not N... | class_definition | 2,127 | 5,264 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/csv.py | null | 132 |
class TextDatasetReader(AbstractDatasetReader):
def __init__(
self,
path_or_paths: NestedDataStructureLike[PathLike],
split: Optional[NamedSplit] = None,
features: Optional[Features] = None,
cache_dir: str = None,
keep_in_memory: bool = False,
streaming: bool ... | class_definition | 213 | 1,974 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/text.py | null | 133 |
class SparkDatasetReader(AbstractDatasetReader):
"""A dataset reader that reads from a Spark DataFrame.
When caching, cache materialization is parallelized over Spark; an NFS that is accessible to the driver must be
provided. Streaming is not currently supported.
"""
def __init__(
self,
... | class_definition | 207 | 1,796 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/spark.py | null | 134 |
class SqlDatasetReader(AbstractDatasetInputStream):
def __init__(
self,
sql: Union[str, "sqlalchemy.sql.Selectable"],
con: Union[str, "sqlalchemy.engine.Connection", "sqlalchemy.engine.Engine", "sqlite3.Connection"],
features: Optional[Features] = None,
cache_dir: str = None,... | class_definition | 339 | 1,561 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/sql.py | null | 135 |
class SqlDatasetWriter:
def __init__(
self,
dataset: Dataset,
name: str,
con: Union[str, "sqlalchemy.engine.Connection", "sqlalchemy.engine.Engine", "sqlite3.Connection"],
batch_size: Optional[int] = None,
num_proc: Optional[int] = None,
**to_sql_kwargs,
)... | class_definition | 1,564 | 4,233 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/sql.py | null | 136 |
class JsonDatasetReader(AbstractDatasetReader):
def __init__(
self,
path_or_paths: NestedDataStructureLike[PathLike],
split: Optional[NamedSplit] = None,
features: Optional[Features] = None,
cache_dir: str = None,
keep_in_memory: bool = False,
streaming: bool ... | class_definition | 368 | 2,218 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/json.py | null | 137 |
class JsonDatasetWriter:
def __init__(
self,
dataset: Dataset,
path_or_buf: Union[PathLike, BinaryIO],
batch_size: Optional[int] = None,
num_proc: Optional[int] = None,
storage_options: Optional[dict] = None,
**to_json_kwargs,
):
if num_proc is not... | class_definition | 2,221 | 6,696 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/json.py | null | 138 |
class AbstractDatasetReader(ABC):
def __init__(
self,
path_or_paths: Optional[NestedDataStructureLike[PathLike]] = None,
split: Optional[NamedSplit] = None,
features: Optional[Features] = None,
cache_dir: str = None,
keep_in_memory: bool = False,
streaming: bo... | class_definition | 231 | 1,087 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/abc.py | null | 139 |
class AbstractDatasetInputStream(ABC):
def __init__(
self,
features: Optional[Features] = None,
cache_dir: str = None,
keep_in_memory: bool = False,
streaming: bool = False,
num_proc: Optional[int] = None,
**kwargs,
):
self.features = features
... | class_definition | 1,090 | 1,671 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/io/abc.py | null | 140 |
class Value:
"""
Scalar feature value of a particular data type.
The possible dtypes of `Value` are as follows:
- `null`
- `bool`
- `int8`
- `int16`
- `int32`
- `int64`
- `uint8`
- `uint16`
- `uint32`
- `uint64`
- `float16`
- `float32` (alias float)
- `fl... | class_definition | 19,984 | 21,809 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 141 |
class _ArrayXD:
def __post_init__(self):
self.shape = tuple(self.shape)
def __call__(self):
pa_type = globals()[self.__class__.__name__ + "ExtensionType"](self.shape, self.dtype)
return pa_type
def encode_example(self, value):
return value | class_definition | 21,812 | 22,097 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 142 |
class Array2D(_ArrayXD):
"""Create a two-dimensional array.
Args:
shape (`tuple`):
Size of each dimension.
dtype (`str`):
Name of the data type.
Example:
```py
>>> from datasets import Features
>>> features = Features({'x': Array2D(shape=(1, 3), dtype='... | class_definition | 22,111 | 22,616 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 143 |
class Array3D(_ArrayXD):
"""Create a three-dimensional array.
Args:
shape (`tuple`):
Size of each dimension.
dtype (`str`):
Name of the data type.
Example:
```py
>>> from datasets import Features
>>> features = Features({'x': Array3D(shape=(1, 2, 3), dt... | class_definition | 22,630 | 23,140 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 144 |
class Array4D(_ArrayXD):
"""Create a four-dimensional array.
Args:
shape (`tuple`):
Size of each dimension.
dtype (`str`):
Name of the data type.
Example:
```py
>>> from datasets import Features
>>> features = Features({'x': Array4D(shape=(1, 2, 2, 3), ... | class_definition | 23,154 | 23,666 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 145 |
class Array5D(_ArrayXD):
"""Create a five-dimensional array.
Args:
shape (`tuple`):
Size of each dimension.
dtype (`str`):
Name of the data type.
Example:
```py
>>> from datasets import Features
>>> features = Features({'x': Array5D(shape=(1, 2, 2, 3, 3... | class_definition | 23,680 | 24,195 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 146 |
class _ArrayXDExtensionType(pa.ExtensionType):
ndims: Optional[int] = None
def __init__(self, shape: tuple, dtype: str):
if self.ndims is None or self.ndims <= 1:
raise ValueError("You must instantiate an array type with a value for dim that is > 1")
if len(shape) != self.ndims:
... | class_definition | 24,198 | 26,043 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 147 |
class Array2DExtensionType(_ArrayXDExtensionType):
ndims = 2 | class_definition | 26,046 | 26,110 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 148 |
class Array3DExtensionType(_ArrayXDExtensionType):
ndims = 3 | class_definition | 26,113 | 26,177 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 149 |
class Array4DExtensionType(_ArrayXDExtensionType):
ndims = 4 | class_definition | 26,180 | 26,244 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 150 |
class Array5DExtensionType(_ArrayXDExtensionType):
ndims = 5 | class_definition | 26,247 | 26,311 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 151 |
class ArrayExtensionArray(pa.ExtensionArray):
def __array__(self):
zero_copy_only = _is_zero_copy_only(self.storage.type, unnest=True)
return self.to_numpy(zero_copy_only=zero_copy_only)
def __getitem__(self, i):
return self.storage[i]
def to_numpy(self, zero_copy_only=True):
... | class_definition | 27,874 | 30,290 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 152 |
class PandasArrayExtensionDtype(PandasExtensionDtype):
_metadata = "value_type"
def __init__(self, value_type: Union["PandasArrayExtensionDtype", np.dtype]):
self._value_type = value_type
def __from_arrow__(self, array: Union[pa.Array, pa.ChunkedArray]):
if isinstance(array, pa.ChunkedArra... | class_definition | 30,293 | 31,308 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 153 |
class PandasArrayExtensionArray(PandasExtensionArray):
def __init__(self, data: np.ndarray, copy: bool = False):
self._data = data if not copy else np.array(data)
self._dtype = PandasArrayExtensionDtype(data.dtype)
def __array__(self, dtype=None):
"""
Convert to NumPy Array.
... | class_definition | 31,311 | 35,659 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 154 |
class ClassLabel:
"""Feature type for integer class labels.
There are 3 ways to define a `ClassLabel`, which correspond to the 3 arguments:
* `num_classes`: Create 0 to (num_classes-1) labels.
* `names`: List of label strings.
* `names_file`: File containing the list of labels.
Under the h... | class_definition | 35,815 | 43,786 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 155 |
class Sequence:
"""Construct a list of feature from a single type or a dict of types.
Mostly here for compatiblity with tfds.
Args:
feature ([`FeatureType`]):
A list of features of a single type or a dictionary of types.
length (`int`):
Length of the sequence.
E... | class_definition | 43,800 | 44,842 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 156 |
class LargeList:
"""Feature type for large list data composed of child feature data type.
It is backed by `pyarrow.LargeListType`, which is like `pyarrow.ListType` but with 64-bit rather than 32-bit offsets.
Args:
feature ([`FeatureType`]):
Child feature data type of each item within t... | class_definition | 44,856 | 45,379 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 157 |
class Features(dict):
"""A special dictionary that defines the internal structure of a dataset.
Instantiated with a dictionary of type `dict[str, FieldType]`, where keys are the desired column names,
and values are the type of that column.
`FieldType` can be one of the following:
- [`Value`] f... | class_definition | 66,382 | 90,660 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/features.py | null | 158 |
class Translation:
"""`Feature` for translations with fixed languages per example.
Here for compatiblity with tfds.
Args:
languages (`dict`):
A dictionary for each example mapping string language codes to string translations.
Example:
```python
>>> # At construction time:
... | class_definition | 211 | 1,349 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/translation.py | null | 159 |
class TranslationVariableLanguages:
"""`Feature` for translations with variable languages per example.
Here for compatiblity with tfds.
Args:
languages (`dict`):
A dictionary for each example mapping string language codes to one or more string translations.
The languages pre... | class_definition | 1,363 | 4,457 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/translation.py | null | 160 |
class Audio:
"""Audio [`Feature`] to extract audio data from an audio file.
Input: The Audio feature accepts as input:
- A `str`: Absolute path to the audio file (i.e. random access is allowed).
- A `dict` with the keys:
- `path`: String with relative path of the audio file to the archive file... | class_definition | 481 | 12,224 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/audio.py | null | 161 |
class Video:
"""
**Experimental.** Video [`Feature`] to read video data from a video file.
Input: The Video feature accepts as input:
- A `str`: Absolute path to the video file (i.e. random access is allowed).
- A `dict` with the keys:
- `path`: String with relative path of the video file ... | class_definition | 497 | 9,194 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/video.py | null | 162 |
class Image:
"""Image [`Feature`] to read image data from an image file.
Input: The Image feature accepts as input:
- A `str`: Absolute path to the image file (i.e. random access is allowed).
- A `dict` with the keys:
- `path`: String with relative path of the image file to the archive file.
... | class_definition | 1,212 | 11,520 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/features/image.py | null | 163 |
class WebDataset(datasets.GeneratorBasedBuilder):
DEFAULT_WRITER_BATCH_SIZE = 100
IMAGE_EXTENSIONS: List[str] # definition at the bottom of the script
AUDIO_EXTENSIONS: List[str] # definition at the bottom of the script
VIDEO_EXTENSIONS: List[str] # definition at the bottom of the script
DECODERS... | class_definition | 392 | 6,421 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/webdataset/webdataset.py | null | 164 |
class FolderBasedBuilderConfig(datasets.BuilderConfig):
"""BuilderConfig for AutoFolder."""
features: Optional[datasets.Features] = None
drop_labels: bool = None
drop_metadata: bool = None
def __post_init__(self):
super().__post_init__() | class_definition | 411 | 678 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py | null | 165 |
class FolderBasedBuilder(datasets.GeneratorBasedBuilder):
"""
Base class for generic data loaders for vision and image data.
Abstract class attributes to be overridden by a child class:
BASE_FEATURE: feature object to decode data (i.e. datasets.Image, datasets.Audio, ...)
BASE_COLUMN_NAME:... | class_definition | 681 | 22,272 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/folder_based_builder/folder_based_builder.py | null | 166 |
class Cache(datasets.ArrowBasedBuilder):
def __init__(
self,
cache_dir: Optional[str] = None,
dataset_name: Optional[str] = None,
config_name: Optional[str] = None,
version: Optional[str] = "0.0.0",
hash: Optional[str] = None,
base_path: Optional[str] = None,
... | class_definition | 3,991 | 8,208 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/cache/cache.py | null | 167 |
class ArrowConfig(datasets.BuilderConfig):
"""BuilderConfig for Arrow."""
features: Optional[datasets.Features] = None
def __post_init__(self):
super().__post_init__() | class_definition | 224 | 413 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/arrow/arrow.py | null | 168 |
class Arrow(datasets.ArrowBasedBuilder):
BUILDER_CONFIG_CLASS = ArrowConfig
def _info(self):
return datasets.DatasetInfo(features=self.config.features)
def _split_generators(self, dl_manager):
"""We handle string, list and dicts in datafiles"""
if not self.config.data_files:
... | class_definition | 416 | 3,493 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/arrow/arrow.py | null | 169 |
class ImageFolderConfig(folder_based_builder.FolderBasedBuilderConfig):
"""BuilderConfig for ImageFolder."""
drop_labels: bool = None
drop_metadata: bool = None
def __post_init__(self):
super().__post_init__() | class_definition | 155 | 390 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/imagefolder/imagefolder.py | null | 170 |
class ImageFolder(folder_based_builder.FolderBasedBuilder):
BASE_FEATURE = datasets.Image
BASE_COLUMN_NAME = "image"
BUILDER_CONFIG_CLASS = ImageFolderConfig
EXTENSIONS: List[str] # definition at the bottom of the script | class_definition | 393 | 630 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/imagefolder/imagefolder.py | null | 171 |
class XmlConfig(datasets.BuilderConfig):
"""BuilderConfig for xml files."""
features: Optional[datasets.Features] = None
encoding: str = "utf-8"
encoding_errors: Optional[str] = None | class_definition | 284 | 483 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/xml/xml.py | null | 172 |
class Xml(datasets.ArrowBasedBuilder):
BUILDER_CONFIG_CLASS = XmlConfig
def _info(self):
return datasets.DatasetInfo(features=self.config.features)
def _split_generators(self, dl_manager):
"""The `data_files` kwarg in load_dataset() can be a str, List[str], Dict[str,str], or Dict[str,List[... | class_definition | 486 | 2,821 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/xml/xml.py | null | 173 |
class GeneratorConfig(datasets.BuilderConfig):
generator: Optional[Callable] = None
gen_kwargs: Optional[dict] = None
features: Optional[datasets.Features] = None
split: datasets.NamedSplit = datasets.Split.TRAIN
def __post_init__(self):
super().__post_init__()
if self.generator is ... | class_definition | 102 | 557 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/generator/generator.py | null | 174 |
class Generator(datasets.GeneratorBasedBuilder):
BUILDER_CONFIG_CLASS = GeneratorConfig
def _info(self):
return datasets.DatasetInfo(features=self.config.features)
def _split_generators(self, dl_manager):
return [datasets.SplitGenerator(name=self.config.split, gen_kwargs=self.config.gen_kw... | class_definition | 560 | 1,032 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/generator/generator.py | null | 175 |
class JsonConfig(datasets.BuilderConfig):
"""BuilderConfig for JSON."""
features: Optional[datasets.Features] = None
encoding: str = "utf-8"
encoding_errors: Optional[str] = None
field: Optional[str] = None
use_threads: bool = True # deprecated
block_size: Optional[int] = None # deprecate... | class_definition | 1,077 | 1,544 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/json/json.py | null | 176 |
class Json(datasets.ArrowBasedBuilder):
BUILDER_CONFIG_CLASS = JsonConfig
def _info(self):
if self.config.block_size is not None:
logger.warning("The JSON loader parameter `block_size` is deprecated. Please use `chunksize` instead")
self.config.chunksize = self.config.block_size... | class_definition | 1,547 | 8,697 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/json/json.py | null | 177 |
class CsvConfig(datasets.BuilderConfig):
"""BuilderConfig for CSV."""
sep: str = ","
delimiter: Optional[str] = None
header: Optional[Union[int, List[int], str]] = "infer"
names: Optional[List[str]] = None
column_names: Optional[List[str]] = None
index_col: Optional[Union[int, str, List[int... | class_definition | 757 | 5,745 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/csv/csv.py | null | 178 |
class Csv(datasets.ArrowBasedBuilder):
BUILDER_CONFIG_CLASS = CsvConfig
def _info(self):
return datasets.DatasetInfo(features=self.config.features)
def _split_generators(self, dl_manager):
"""We handle string, list and dicts in datafiles"""
if not self.config.data_files:
... | class_definition | 5,748 | 8,579 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/csv/csv.py | null | 179 |
class TextConfig(datasets.BuilderConfig):
"""BuilderConfig for text files."""
features: Optional[datasets.Features] = None
encoding: str = "utf-8"
encoding_errors: Optional[str] = None
chunksize: int = 10 << 20 # 10MB
keep_linebreaks: bool = False
sample_by: str = "line" | class_definition | 308 | 609 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/text/text.py | null | 180 |
class Text(datasets.ArrowBasedBuilder):
BUILDER_CONFIG_CLASS = TextConfig
def _info(self):
return datasets.DatasetInfo(features=self.config.features)
def _split_generators(self, dl_manager):
"""The `data_files` kwarg in load_dataset() can be a str, List[str], Dict[str,str], or Dict[str,Lis... | class_definition | 612 | 5,515 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/text/text.py | null | 181 |
class ParquetConfig(datasets.BuilderConfig):
"""BuilderConfig for Parquet."""
batch_size: Optional[int] = None
columns: Optional[List[str]] = None
features: Optional[datasets.Features] = None
filters: Optional[Union[ds.Expression, List[tuple], List[List[tuple]]]] = None
def __post_init__(self)... | class_definition | 295 | 648 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/parquet/parquet.py | null | 182 |
class Parquet(datasets.ArrowBasedBuilder):
BUILDER_CONFIG_CLASS = ParquetConfig
def _info(self):
if (
self.config.columns is not None
and self.config.features is not None
and set(self.config.columns) != set(self.config.features)
):
raise ValueErro... | class_definition | 651 | 5,104 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/parquet/parquet.py | null | 183 |
class VideoFolderConfig(folder_based_builder.FolderBasedBuilderConfig):
"""BuilderConfig for ImageFolder."""
drop_labels: bool = None
drop_metadata: bool = None
def __post_init__(self):
super().__post_init__() | class_definition | 155 | 390 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/videofolder/videofolder.py | null | 184 |
class VideoFolder(folder_based_builder.FolderBasedBuilder):
BASE_FEATURE = datasets.Video
BASE_COLUMN_NAME = "video"
BUILDER_CONFIG_CLASS = VideoFolderConfig
EXTENSIONS: List[str] # definition at the bottom of the script | class_definition | 393 | 630 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/videofolder/videofolder.py | null | 185 |
class AudioFolderConfig(folder_based_builder.FolderBasedBuilderConfig):
"""Builder Config for AudioFolder."""
drop_labels: bool = None
drop_metadata: bool = None
def __post_init__(self):
super().__post_init__() | class_definition | 155 | 391 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/audiofolder/audiofolder.py | null | 186 |
class AudioFolder(folder_based_builder.FolderBasedBuilder):
BASE_FEATURE = datasets.Audio
BASE_COLUMN_NAME = "audio"
BUILDER_CONFIG_CLASS = AudioFolderConfig
EXTENSIONS: List[str] # definition at the bottom of the script | class_definition | 394 | 631 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/audiofolder/audiofolder.py | null | 187 |
class SparkConfig(datasets.BuilderConfig):
"""BuilderConfig for Spark."""
features: Optional[datasets.Features] = None
def __post_init__(self):
super().__post_init__() | class_definition | 702 | 891 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/spark/spark.py | null | 188 |
class SparkExamplesIterable(_BaseExamplesIterable):
def __init__(
self,
df: "pyspark.sql.DataFrame",
partition_order=None,
):
super().__init__()
self.df = df
self.partition_order = partition_order or range(self.df.rdd.getNumPartitions())
def _init_state_dict(... | class_definition | 2,454 | 3,828 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/spark/spark.py | null | 189 |
class Spark(datasets.DatasetBuilder):
BUILDER_CONFIG_CLASS = SparkConfig
def __init__(
self,
df: "pyspark.sql.DataFrame",
cache_dir: str = None,
working_dir: str = None,
**config_kwargs,
):
import pyspark
self._spark = pyspark.sql.SparkSession.builde... | class_definition | 3,831 | 14,674 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/spark/spark.py | null | 190 |
class PandasConfig(datasets.BuilderConfig):
"""BuilderConfig for Pandas."""
features: Optional[datasets.Features] = None
def __post_init__(self):
super().__post_init__() | class_definition | 205 | 396 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/pandas/pandas.py | null | 191 |
class Pandas(datasets.ArrowBasedBuilder):
BUILDER_CONFIG_CLASS = PandasConfig
def _info(self):
warnings.warn(
"The Pandas builder is deprecated and will be removed in the next major version of datasets.",
FutureWarning,
)
return datasets.DatasetInfo(features=self... | class_definition | 399 | 2,546 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/pandas/pandas.py | null | 192 |
class SqlConfig(datasets.BuilderConfig):
"""BuilderConfig for SQL."""
sql: Union[str, "sqlalchemy.sql.Selectable"] = None
con: Union[str, "sqlalchemy.engine.Connection", "sqlalchemy.engine.Engine", "sqlite3.Connection"] = None
index_col: Optional[Union[str, List[str]]] = None
coerce_float: bool = T... | class_definition | 424 | 3,183 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/sql/sql.py | null | 193 |
class Sql(datasets.ArrowBasedBuilder):
BUILDER_CONFIG_CLASS = SqlConfig
def _info(self):
return datasets.DatasetInfo(features=self.config.features)
def _split_generators(self, dl_manager):
return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={})]
def _cast_table(self,... | class_definition | 3,186 | 4,513 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/packaged_modules/sql/sql.py | null | 194 |
class DatasetViewerError(DatasetsError):
"""Dataset viewer error.
Raised when trying to use the dataset viewer HTTP API and when trying to access:
- a missing dataset, or
- a private/gated dataset and the user is not authenticated.
- unavailable /parquet or /info responses
""" | class_definition | 295 | 597 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/utils/_dataset_viewer.py | null | 195 |
class _NoDuplicateSafeLoader(yaml.SafeLoader):
def _check_no_duplicates_on_constructed_node(self, node):
keys = [self.constructed_objects[key_node] for key_node, _ in node.value]
keys = [tuple(key) if isinstance(key, list) else key for key in keys]
counter = Counter(keys)
duplicate_k... | class_definition | 469 | 1,136 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/utils/metadata.py | null | 196 |
class MetadataConfigs(Dict[str, Dict[str, Any]]):
"""Should be in format {config_name: {**config_params}}."""
FIELD_NAME: ClassVar[str] = METADATA_CONFIGS_FIELD
@staticmethod
def _raise_if_data_files_field_not_valid(metadata_config: dict):
yaml_data_files = metadata_config.get("data_files")
... | class_definition | 1,567 | 7,999 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/utils/metadata.py | null | 197 |
class Version:
"""Dataset version `MAJOR.MINOR.PATCH`.
Args:
version_str (`str`):
The dataset version.
description (`str`):
A description of what is new in this version.
major (`str`):
minor (`str`):
patch (`str`):
Example:
```py
>>>... | class_definition | 928 | 2,716 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/utils/version.py | null | 198 |
class tracked_str(str):
origins = {}
def set_origin(self, origin: str):
if super().__repr__() not in self.origins:
self.origins[super().__repr__()] = origin
def get_origin(self):
return self.origins.get(super().__repr__(), str(self))
def __repr__(self) -> str:
if s... | class_definition | 67 | 599 | 0 | /Users/nielsrogge/Documents/python_projecten/datasets/src/datasets/utils/track.py | null | 199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.