Input Output core module¶
DataObjectModelProtocol
¶
Bases: Protocol
Empty protocol just to be able to classify other classes as a DataObjectModelProtocol
Instance.
KoswatImporterProtocol
¶
Bases: Protocol
import_from(from_path: Path) -> Union[DataObjectModelProtocol, List[DataObjectModelProtocol]]
¶
Generates a valid instance of a DataObjectModelProtocol
based on the contents from the provided path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
from_path |
Path
|
Path containing data to be read. |
required |
Returns:
Type | Description |
---|---|
Union[DataObjectModelProtocol, List[DataObjectModelProtocol]]
|
Union[DataObjectModelProtocol, List[DataObjectModelProtocol]]: Either a single valid instance of a |
FileObjectModelProtocol
¶
Bases: Protocol
is_valid() -> bool
¶
Verifies if the current object is valid for import / export.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of the validation. |
KoswatReaderProtocol
¶
Bases: Protocol
read(file_path: Path) -> FileObjectModelProtocol
¶
Imports the data from the file_path
into a concrete implementation of a FileObjectModelProtocol
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
Path to a file that should be imported. |
required |
Returns:
Name | Type | Description |
---|---|---|
FileObjectModelProtocol |
FileObjectModelProtocol
|
Model representing the data in the file. |
supports_file(file_path: Path) -> bool
¶
Validates whether the current reader is capable of importing data from the provided file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
Path to a file that should be imported. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of validation. |
FileObjectModelProtocol
¶
Bases: Protocol
is_valid() -> bool
¶
Verifies if the current object is valid for import / export.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of the validation. |
KoswatWriterProtocol
¶
Bases: Protocol
write(fom_instance: FileObjectModelProtocol, to_path: Path) -> None
¶
Writes the data from the instance of a FileObjectModelProtocol
to the to_path
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fom_instance |
FileObjectModelProtocol
|
Instance with data to write. |
required |
to_path |
Path
|
Path to file (or directory) where to write the data. |
required |
CSV module¶
FileObjectModelProtocol
¶
Bases: Protocol
is_valid() -> bool
¶
Verifies if the current object is valid for import / export.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of the validation. |
KoswatCsvFomProtocol
¶
Bases: FileObjectModelProtocol
, Protocol
is_valid() -> bool
¶
Validates the current structure of this KoswatCsvFomProtocol
instance.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True when is a valid FOM. |
KoswatCsvFomProtocol
¶
Bases: FileObjectModelProtocol
, Protocol
is_valid() -> bool
¶
Validates the current structure of this KoswatCsvFomProtocol
instance.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True when is a valid FOM. |
KoswatReaderProtocol
¶
Bases: Protocol
read(file_path: Path) -> FileObjectModelProtocol
¶
Imports the data from the file_path
into a concrete implementation of a FileObjectModelProtocol
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
Path to a file that should be imported. |
required |
Returns:
Name | Type | Description |
---|---|---|
FileObjectModelProtocol |
FileObjectModelProtocol
|
Model representing the data in the file. |
supports_file(file_path: Path) -> bool
¶
Validates whether the current reader is capable of importing data from the provided file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
Path to a file that should be imported. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of validation. |
KoswatCsvFomProtocol
¶
Bases: FileObjectModelProtocol
, Protocol
is_valid() -> bool
¶
Validates the current structure of this KoswatCsvFomProtocol
instance.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True when is a valid FOM. |
KoswatWriterProtocol
¶
Bases: Protocol
write(fom_instance: FileObjectModelProtocol, to_path: Path) -> None
¶
Writes the data from the instance of a FileObjectModelProtocol
to the to_path
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fom_instance |
FileObjectModelProtocol
|
Instance with data to write. |
required |
to_path |
Path
|
Path to file (or directory) where to write the data. |
required |
INI module¶
FileObjectModelProtocol
¶
Bases: Protocol
is_valid() -> bool
¶
Verifies if the current object is valid for import / export.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of the validation. |
KoswatIniFomProtocol
¶
Bases: FileObjectModelProtocol
, Protocol
from_config(ini_config: ConfigParser) -> KoswatIniFomProtocol
classmethod
¶
Imports all the data stored in an dictionary into a KoswatIniFomProtocol
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ini_config |
ConfigParser
|
Dictionary containing Ini values (section - properties, property - value) to be parsed. |
required |
Returns:
Name | Type | Description |
---|---|---|
KoswatIniFomProtocol |
KoswatIniFomProtocol
|
Valid instance of a |
KoswatIniFomProtocol
¶
Bases: FileObjectModelProtocol
, Protocol
from_config(ini_config: ConfigParser) -> KoswatIniFomProtocol
classmethod
¶
Imports all the data stored in an dictionary into a KoswatIniFomProtocol
instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ini_config |
ConfigParser
|
Dictionary containing Ini values (section - properties, property - value) to be parsed. |
required |
Returns:
Name | Type | Description |
---|---|---|
KoswatIniFomProtocol |
KoswatIniFomProtocol
|
Valid instance of a |
KoswatReaderProtocol
¶
Bases: Protocol
read(file_path: Path) -> FileObjectModelProtocol
¶
Imports the data from the file_path
into a concrete implementation of a FileObjectModelProtocol
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
Path to a file that should be imported. |
required |
Returns:
Name | Type | Description |
---|---|---|
FileObjectModelProtocol |
FileObjectModelProtocol
|
Model representing the data in the file. |
supports_file(file_path: Path) -> bool
¶
Validates whether the current reader is capable of importing data from the provided file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
Path to a file that should be imported. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of validation. |
TXT module¶
FileObjectModelProtocol
¶
Bases: Protocol
is_valid() -> bool
¶
Verifies if the current object is valid for import / export.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of the validation. |
KoswatTxtFomProtocol
¶
Bases: FileObjectModelProtocol
, Protocol
from_text(file_text: str) -> KoswatTxtFomProtocol
classmethod
¶
Imports all the data stored in text form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_text |
str
|
Raw data in string format. |
required |
Returns:
Name | Type | Description |
---|---|---|
KoswatTxtFomProtocol |
KoswatTxtFomProtocol
|
Valid instance of a |
KoswatReaderProtocol
¶
Bases: Protocol
read(file_path: Path) -> FileObjectModelProtocol
¶
Imports the data from the file_path
into a concrete implementation of a FileObjectModelProtocol
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
Path to a file that should be imported. |
required |
Returns:
Name | Type | Description |
---|---|---|
FileObjectModelProtocol |
FileObjectModelProtocol
|
Model representing the data in the file. |
supports_file(file_path: Path) -> bool
¶
Validates whether the current reader is capable of importing data from the provided file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
Path to a file that should be imported. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Result of validation. |
KoswatTxtFomProtocol
¶
Bases: FileObjectModelProtocol
, Protocol
from_text(file_text: str) -> KoswatTxtFomProtocol
classmethod
¶
Imports all the data stored in text form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_text |
str
|
Raw data in string format. |
required |
Returns:
Name | Type | Description |
---|---|---|
KoswatTxtFomProtocol |
KoswatTxtFomProtocol
|
Valid instance of a |