switchmng package

Submodules

switchmng.config module

switchmng.config.parse_arguments(arguments)

Apply configuration from command line arguments.

Parameters

arguments (List[str]) – List of command line arguments.

Return type

None

switchmng.config.parse_config(content)

Apply configuration from configuration file content.

Parameters

content (str) – Content of the configuration file.

Return type

None

switchmng.config.parse_config_file(path)

Apply configuration from configuration file.

Parameters

path (str) – Path to configuration file.

Return type

None

switchmng.importer module

switchmng.importer.import_from_path(db, path, resource_type)

Add resource(s) from json file(s) to database.

Given path can be one of the following:

  1. A file. In this case the resource_type parameter has to be set indicating what type of resource this file contains.

  2. A directory named like a resource type containing multiple resources of that type. In this case no resource_type has to be given.

  3. A directory with any name containing multiple resources of the same type. In this case resource_type parameter has to be set indicating what type of resources files in this directory contain.

  4. A directory with any name containing multiple directories which are named like resource types containing only resources of those types. In this case resource_type must not be given.

Note: If path is a directory files in this directory starting with . will not be imported!

Parameters
  • db (DatabaseConnection) – Connection to the database

  • path (str) – The path to the file or directory containing the resource(s) in json format.

  • resource_type (Optional[Type[BaseResource]]) – The type of resource the file or directory contains or None for autodetection.

Return type

None

switchmng.importer.sort_import_dirs(paths)

Sort list of directories named like resource identifiers.

Sort list of directories in order to make sure they can be imported correctly so that every resource type gets imported after resource types it relies on have been imported.

Return type

List[str]

Parameters

paths (List[str]) –

switchmng.typing module

switchmng.wsgi module

switchmng.wsgi.app(*args, **kwargs)

Entry point for wsgi server like gunicorn serving this application.

Parse all command line arguments, initialize application then start this application.

Module contents