psykoda.io.labeled package

Submodules

psykoda.io.labeled.file module

File-based Previous Log Loader and Saver

class psykoda.io.labeled.file.FileLoader(base_config: FileStorageBaseConfig, config: Config)[source]

Bases: psykoda.io.labeled.loader.Loader

File-based Loader

class Config[source]

Bases: object

Configuration of FileLoader

load_previous_log(entries: pandas.core.indexes.multi.MultiIndex)pandas.core.frame.DataFrame[source]

Load previous log from storage.

Parameters

entries – collection of (datetime_rounded, src_ip)s to load log corresponding to

class psykoda.io.labeled.file.FileSaver(base_config: FileStorageConfig, config: Config)[source]

Bases: psykoda.io.labeled.saver.Saver

File-based Saver

class Config(all: bool = False, compression: bool = False)[source]

Bases: object

Configuration of FileSaver

all: bool = False
compression: bool = False
save_previous_log(df: pandas.core.frame.DataFrame, entries: pandas.core.indexes.multi.MultiIndex)[source]

Save log to storage for future use.

Parameters
  • df – log

  • entries – collection of (datetime_rounded, src_ip)s to save log corresponding to

class psykoda.io.labeled.file.FileStorageBaseConfig(dir: str, labeled_basename_format_datetime: str = '%Y-%m-%d-%H')[source]

Bases: object

Common configuration for FileLoader and FileSaver

dir: str
labeled_basename_format_datetime: str = '%Y-%m-%d-%H'
class psykoda.io.labeled.file.FileStorageConfig(base: psykoda.io.labeled.file.FileStorageBaseConfig, load: psykoda.io.labeled.file.FileLoader.Config, save: psykoda.io.labeled.file.FileSaver.Config)[source]

Bases: object

Configuration fed to factory

base: psykoda.io.labeled.file.FileStorageBaseConfig
load: psykoda.io.labeled.file.FileLoader.Config
save: psykoda.io.labeled.file.FileSaver.Config

psykoda.io.labeled.loader module

Previous Log Loader API

class psykoda.io.labeled.loader.Loader[source]

Bases: abc.ABC

Previous Log Loader

abstract load_previous_log(entries: pandas.core.indexes.multi.MultiIndex)pandas.core.frame.DataFrame[source]

Load previous log from storage.

Parameters

entries – collection of (datetime_rounded, src_ip)s to load log corresponding to

psykoda.io.labeled.saver module

Previous Log Saver API

class psykoda.io.labeled.saver.Saver[source]

Bases: abc.ABC

Previous Log Saver

abstract save_previous_log(df: pandas.core.frame.DataFrame, entries: pandas.core.indexes.multi.MultiIndex)[source]

Save log to storage for future use.

Parameters
  • df – log

  • entries – collection of (datetime_rounded, src_ip)s to save log corresponding to

Module contents

IO functionalities for labeled log

psykoda.io.labeled.factory(config: psykoda.io.labeled.file.FileStorageConfig)Tuple[psykoda.io.labeled.loader.Loader, psykoda.io.labeled.saver.Saver][source]