drepr.models.preprocessing#

Classes

Context()

A special instance that is accessible when user defined function is called to allow access to other information such as the index of the current item, or the nearby items.

PFilter(resource_id, path, code[, output])

PMap(resource_id, path, code[, output, ...])

POutput(resource_id, attr, attr_path)

PSplit(resource_id, path, code[, output])

Preprocessing(type, value)

PreprocessingType(value[, names, module, ...])

RMap(resource_id, path, func_id[, output])

RMapFunc(value[, names, module, qualname, ...])

class POutput(resource_id: Optional[str], attr: Optional[str], attr_path: Optional[drepr.models.path.Path])[source]#

Bases: object

Parameters:
resource_id: Optional[str]#
attr: Optional[str]#
attr_path: Optional[Path]#
class PMap(resource_id: str, path: drepr.models.path.Path, code: str, output: Optional[drepr.models.preprocessing.POutput] = None, change_structure: Optional[bool] = None)[source]#

Bases: object

Parameters:
resource_id: str#
path: Path#
code: str#
output: Optional[POutput] = None#
change_structure: Optional[bool] = None#
class PFilter(resource_id: str, path: drepr.models.path.Path, code: str, output: Optional[drepr.models.preprocessing.POutput] = None)[source]#

Bases: object

Parameters:
resource_id: str#
path: Path#
code: str#
output: Optional[POutput] = None#
class PSplit(resource_id: str, path: drepr.models.path.Path, code: str, output: Optional[drepr.models.preprocessing.POutput] = None)[source]#

Bases: object

Parameters:
resource_id: str#
path: Path#
code: str#
output: Optional[POutput] = None#
class RMapFunc(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

Dict2Items = 'dict2items'#
class RMap(resource_id: str, path: drepr.models.path.Path, func_id: drepr.models.preprocessing.RMapFunc, output: Optional[drepr.models.preprocessing.POutput] = None)[source]#

Bases: object

Parameters:
resource_id: str#
path: Path#
func_id: RMapFunc#
output: Optional[POutput] = None#
class PreprocessingType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

pmap = 'pmap'#
pfilter = 'pfilter'#
psplit = 'psplit'#
rmap = 'rmap'#
class Preprocessing(type: drepr.models.preprocessing.PreprocessingType, value: Union[drepr.models.preprocessing.PMap, drepr.models.preprocessing.PFilter, drepr.models.preprocessing.PSplit, drepr.models.preprocessing.RMap])[source]#

Bases: object

Parameters:
type: PreprocessingType#
value: Union[PMap, PFilter, PSplit, RMap]#
static deserialize(raw: dict)[source]#
Parameters:

raw (dict) –

set_output(output: POutput)[source]#
Parameters:

output (POutput) –

get_output() Optional[POutput][source]#
Return type:

Optional[POutput]

is_output_new_data() bool[source]#

Check if the preprocessing will generate new data. The new data is stored in a new variable

Return type:

bool

get_resource_id()[source]#
class Context[source]#

Bases: object

A special instance that is accessible when user defined function is called to allow access to other information such as the index of the current item, or the nearby items.

get_index() tuple[source]#

Get the index of the current item

Return type:

tuple

get_value(index: tuple)[source]#

Get the value of an item at a specific index

Parameters:

index (tuple) –