file_handler module

class file_handler.FileHandler[source]

Bases: object

Class container for static methods responsible for file load and validate operations.

static get_sequence_code(filename, sequence_search)[source]

Extract the sequence code from the filename.

Parameters:
  • filename (str) – File name.

  • sequence_search (str) – Which sequence to look for. Default is “auto”.

Returns:

Sequence if available. Else None.

Return type:

str|None

static load_project_file(file_path)[source]

Loads the project rvp file.

Parameters:

file_path (str) – File path to the rvp project file.

Returns:

Returns the Dictionary from the project file on loading the rvp File.Else False.

Return type:

dict|bool

static save_project_file(project_data: dict, output_path: str)[source]

Saves the project dictionary as a .rvp (pickle) file.

Parameters:
  • project_data (dict) – Dictionary containing the project data.

  • output_path (str) – Output path to save the project file.

Returns:

True if saved successfully, else False.

static validate_image(image: str)[source]

Checks if the image files are supported.

Parameters:

image (str) – Path to the image file.

Returns:

True on file validation. Else False.

Return type:

bool

static validate_project_file(project_file_path)[source]

Checks if the project json file matches the format of the app.

Parameters:

project_file_path (str) – Path to the project file.

Returns:

True on file validation.Else False.

Return type:

bool

static validate_user_settings_file(json_data)[source]

Validates the user settings json file by checking keys and value types.

Parameters:

json_data

Json file containing the user settings.

Returns:

bool: True on Validation, False on fail.