utils

Description

Supporting functions

Modules

class bpf90tools.utils.CheckMixin[source]

Bases: object

A mixin class that is used to validate data, files, and directories. Used to refine the behavior of other classes, not intended to spawn self-usable objects.

static is_dir(path_dir: str | Path) bool[source]

Method that checks if the passed path points to a directory.

Parameters:

path_dir – Path to the directory to be checked for existence.

Returns:

Return true if the directory exist and false if the dir does not exist.

static is_empty(obj: str | list | dict | set | tuple) bool[source]

The method checks if the passed object is empty.

Parameters:

obj – A object of the standard type to checked if is empty or not.

Returns:

Return true if of the object empty and false if not empty.

static is_file(pth_file: str | Path) bool[source]

Method that checks if the passed path points to a file.

Parameters:

pth_file – Path to the file to be checked for existence.

Returns:

Return true if the file exists and false if the file does not exist.

bpf90tools.utils.run_app(app_file: Path, param_file: Path, dir_cwd: Path = None) bool[source]

Running programs of the blupf90 family.

Parameters:
  • app_file – Application to run.

  • param_file – Parameter file that is needed to run the application.

  • dir_cwd – Directory where the application is located.

Returns:

Returns true if the method completed without errors, false if an error or exception occurred.

bpf90tools.utils.transform(string: str) str[source]

Converting a string with the name of the program for the operating system used.

Parameters:

string – Name line.

Returns:

Return the converting string.