kaiju_files.abc module¶
- class AbstractFileTransportInterface[source]¶
Bases:
ABCConnector to an external file storage.
- abstract async has_new_files()[source]¶
Return True if new downloadable files found in shared folders.
- Return type:
bool
- abstract async list()[source]¶
List all files in shared folders.
- Return type:
AsyncGenerator[Path, None]
- abstract async download(uri)[source]¶
Download a file to a local temp dir and return the location.
- Parameters:
uri (Path) –
- Return type:
NamedTemporaryFile
- abstract async delete(uri)[source]¶
Remove a downloaded file from a shared directory.
- Parameters:
uri (Path) –
- abstract async mark_failed(uri, reason, message='')[source]¶
Mark a shared file as failed and (optionally) move it to another shared location.
- Parameters:
uri (Path) –
reason (ErrorCodes) –
message (str) –
- class AbstractFileLoader[source]¶
Bases:
AbstractFileOperation,Service,ABCFile uploading and metadata interface.
- class AbstractFileConverter[source]¶
Bases:
AbstractFileOperation,ABCFile converter/normalizer which is supposed to be run in a thread / process.
- class Settings[source]¶
Bases:
SettingsFile converter settings.
- filename_mask¶
- directory_mask¶
- ext¶
- meta¶
- output_extension¶
- READ_MODE = 'rb'¶
- WRITE_MODE = 'wb'¶
- MAX_PROCESSING_TIME = 300¶
- __init__(dir='.', read_mode='rb', write_mode='wb', max_processing_time=300, settings=None)[source]¶
Initialize.
- Parameters:
dir (str) – path to a temp local data storage
read_mode – read mode for opening original files
write_mode – write mode for writing new (converted) files
max_processing_time – maximum file processing time in seconds
settings (dict | List[dict] | None) – converter specific settings