35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
|
#!/usr/bin/env python3
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
# IMPORTS
|
||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
|
||
|
from src.thirdparty.code import *;
|
||
|
|
||
|
from models.generated.commands import *;
|
||
|
from src.core.calls import *;
|
||
|
from src.setup import config;
|
||
|
from src.algorithms.euklid import *;
|
||
|
|
||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
# EXPORTS
|
||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
|
||
|
__all__ = [
|
||
|
'endpoint_euklid',
|
||
|
];
|
||
|
|
||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
# ENDPOINT
|
||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||
|
|
||
|
@run_safely()
|
||
|
def endpoint_euklid(command: CommandEuklid) -> Result[CallResult, CallError]:
|
||
|
result = euklidean_algorithm(
|
||
|
a = command.numbers[0],
|
||
|
b = command.numbers[1],
|
||
|
verbose = config.OPTIONS.tsp.verbose,
|
||
|
);
|
||
|
return Ok(CallResult(action_taken=True, message=result));
|