app package

Submodules

app.app module

app.app.generate_cycles()[source]
app.app.get_subcycle()[source]

app.routes module

app.routes.visualize_cycles_route()[source]
app.routes.generated_cycle_route()[source]

app.services module

app.services.generate_cycles(signature)[source]

Generate the cycle structure for a given signature.

Parameters:

signature (tuple[int, ...]) – The input signature to process.

Returns:

The generated cycle structure.

Return type:

list[list[tuple[int, …]]]

app.services.get_end_tuple_order(signature)[source]

Get the order of end tuples in the cycle cover.

Parameters:

signature (tuple[int, ...]) – The input signature to process.

Returns:

The order of end tuples.

Return type:

list[tuple[int, …]]

app.services.cross_edges_service(signature)[source]

Service to get cross edges for a given signature.

Parameters:

signature (tuple[int, ...]) – The input signature to process.

Returns:

A tuple containing a list of cross edges and a list of trailing numbers (end tuples), or None if the signature does not match any cases.

Return type:

tuple[list[tuple[tuple[tuple[int, …], tuple[int, …]], tuple[tuple[tuple[int, …], tuple[int, …]]]]], list[tuple[int, …]]] | None

app.utils module

app.utils.validate_signature(signature)[source]

Validate the input signature.

Parameters:

signature (tuple[int, ...]) – The input signature to validate.

Returns:

(only raises ValueError)

Return type:

None

Raises:

ValueError – If the signature is not a list or tuple, or if it contains non-negative integers.

app.utils.case_one_to_eight_cross_edges(signature)[source]

For certain signatures, return True if the signature matches any of the specified cases.

Parameters:

signature (tuple[int, ...]) – The input signature to check.

Returns:

True if the signature matches any of the specified cases (1 up to and including 8), False otherwise.

Return type:

bool

app.utils.get_cross_edges_per_signature(signature)[source]

Get the cross edges for a given signature.

Parameters:

signature (tuple[int, ...]) – The input signature to process.

Returns:

If the signature matches any of the cases from 1 to 8.

Return type:

tuple[list[tuple[tuple[tuple[int, …], tuple[int, …]], tuple[tuple[tuple[int, …], tuple[int, …]]]]], list[tuple[int, …]]] | None

Module contents

app.create_app(allow_cors=False)[source]

Creates the flask app

Parameters:

allow_cors (bool, optional) – Whether to allow CORS for the app. Defaults to False.

Returns:

The created Flask app.

Return type:

Flask