loader module

Loader module for NGPASM.

This module have a functional for reading config files.

class loader.ConfigReader(config_file: str, configtype: ConfigType = None)[source]

Bases: object

Project configuration reader.

__init__(config_file: str, configtype: ConfigType = None)[source]

Constructs new instance.

Parameters:
  • config_file – Path to configuration file

  • configtype – Explicit config type (auto-detected if None)

_load_data_from_config() dict[source]

Load configuration data from file.

Returns:

loaded data as dictionary

Return type:

dict

class loader.ConfigType(*values)[source]

Bases: Enum

Project configuration types.

JSON = 2
TOML = 0
YAML = 1
loader.detect_config_type_by_extension(extension: str) ConfigType[source]

Detect config type by file extension.

Parameters:

extension – File extension string

Returns:

Detected config type (defaults to JSON)

Return type:

ConfigType

loader.detect_config_type_by_filename(filename: str) ConfigType[source]

Detect config type by filename.

Parameters:

filename – Full filename or path

Returns:

Detected config type

Return type:

ConfigType