From 2183f3f860af34e45058ef078045322062b51f42 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 17 Apr 2016 00:49:33 +0300 Subject: rearrange source files * Add a useful `algorithms` package to provide convinient access to the implemented algorithms. * This allows to e.g. dynamically list available algorithms, which greatly simplifies a lot of things. --- algorithms/registry.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 algorithms/registry.py (limited to 'algorithms/registry.py') diff --git a/algorithms/registry.py b/algorithms/registry.py new file mode 100644 index 0000000..8f0469d --- /dev/null +++ b/algorithms/registry.py @@ -0,0 +1,17 @@ +# Copyright 2016 Egor Tensin +# This file is licensed under the terms of the MIT License. +# See LICENSE.txt for details. + +import algorithms.impl + +def refresh_algorithms(): + algorithms.impl._refresh_algorithms() + +def get_codenames(): + return algorithms.impl._ALL_ALGORITHMS.keys() + +def iter_algorithms(): + return iter(algorithms.impl._ALL_ALGORITHMS.values()) + +def get(codename): + return algorithms.impl._ALL_ALGORITHMS[codename] -- cgit v1.2.3