Type Hints, Structures and Errors

MatrixCtl is strictly typed to avoid some bugs and help contributors in the future to easily identify what they are dealing with. They can be used by third party tools such as type checkers, IDEs, linters, etc.

In addition we make use of TypedDict to create typed structures (add type hints to e.g. the configuration).

MatrixCtl specifies some additional errors. Those errors are informing the user that, getting a traceback is a bug in this application. They are giving the person instructions, how to hand in a bug report.

Type Hints

Use this module for custom type definitions.

Structures

Use this module for structures.

class matrixctl.structures.Config[source]

Bases: TypedDict

Cast the YAML config to a typed dict.

server: ConfigServer
servers: dict[str, ConfigServer]
class matrixctl.structures.ConfigServer[source]

Bases: TypedDict

Add a server to the YAML config structure.

ansible: ConfigServerAnsible
api: ConfigServerAPI
maintenance: ConfigServerMaintenance
ssh: ConfigServerSSH
synapse: ConfigServerSynapse
class matrixctl.structures.ConfigServerAPI[source]

Bases: TypedDict

Add api to server in the YAML config structure.

concurrent_limit: int
domain: str
token: str
username: str
class matrixctl.structures.ConfigServerAnsible[source]

Bases: TypedDict

Add ansible to server in the YAML config structure.

playbook: str
class matrixctl.structures.ConfigServerMaintenance[source]

Bases: TypedDict

Add maintenance to server in the YAML config structure.

tasks: list[str]
class matrixctl.structures.ConfigServerSSH[source]

Bases: TypedDict

Add ssh to server in the YAML config structure.

address: str
port: int
user: str
class matrixctl.structures.ConfigServerSynapse[source]

Bases: TypedDict

Add synapse to server in the YAML config structure.

playbook: str

Errors

Use the exceptions of this module for the application.

exception matrixctl.errors.ConfigFileError(message=None, payload=None)[source]

Bases: Error

Use this exception class for everything related to the config file.

exception matrixctl.errors.Error(message=None, payload=None)[source]

Bases: Exception

Use this exception class as base error for the project.

BUGMSG: str = 'If you discover this message, please try updating MatrixCtl. If you see this message again, we would be glad, if you would run the same command again in debug-mode (matrixctl -d [...]) and hand in a "Bug report" at https://github.com/MichaelSasser/matrixctl/issues with the complete output.\n\nPython version: 3.10.8 final\nMatrixCtl version: 0.12.0b2 \n'
exception matrixctl.errors.ExitQWorker[source]

Bases: Exception

Use this exception when you want to exit an Queue worker.

exception matrixctl.errors.InternalResponseError(message=None, payload=None)[source]

Bases: Error

Use this exception class for everything else.