gpf_entrepot_toolbelt.utils.strings_utils module

Utils for string

gpf_entrepot_toolbelt.utils.strings_utils.generate_temp_name(prefix: str | None = 'tmp_', suffix: str | None = '', length: int | None = 10) str

Génère une chaîne de caractères d’une longueur de len(prefix) + length + len(suffix).

Paramètres:
  • prefix (Optional[str], optional) – _description_. Defaults to « tmp_ ».

  • suffix (Optional[str], optional) – _description_. Defaults to « « .

  • length (Optional[int], optional) – _description_. Defaults to 10.

Renvoie:

_description_

Type renvoyé:

str

gpf_entrepot_toolbelt.utils.strings_utils.get_schema_name_from_id(ch: str) str

Retourne le nom de schema en concatenant le paramètre ch après slugification par le préfix “schema_” Slugification simple : remplace - par _ , supprime les espaces et retourne en minuscule.

gpf_entrepot_toolbelt.utils.strings_utils.load_json_file(json_file_path: str | Path) dict

Retourne le fichier json_file sous forme de dictionnaire.

Paramètres:

json_file_path (Union[str, Path]) – path to the input JSON path

Renvoie:

JSON loaded as dictionary

Type renvoyé:

dict

gpf_entrepot_toolbelt.utils.strings_utils.split_gpkg_string(gpkg_path: str) tuple[str, str] | None

Découpe une chaîne geopackage de type chemin|layername=abc en (chemin, abc).

Paramètres:

gpkg_path (str) – path to the Geopackage file

Renvoie:

tuple (path, layername)

Type renvoyé:

Optional[Tuple[str, str]]