Source code for httk.core.register

#
#    The high-throughput toolkit (httk)
#    Copyright (C) 2012-2024 the httk AUTHORS
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

from pathlib import Path
from typing import Any

from ._plugins import PluginRegistry

[docs] loaders = PluginRegistry()
[docs] def register_loader(*, name: str, loader: str, extensions: tuple[str, ...]) -> None: for ext in extensions: loaders.register(key=ext.lower(), handler=loader, name=name)
[docs] def known_extensions() -> list[str]: return loaders.keys()