Files
oxipy/oxi/interfaces/__init__.py
IluaAir 2cfcc41e58 Enhance device interface structure and update dependencies
- Added `.idea` to `.gitignore` to exclude IDE configuration files.
- Introduced `pydantic` version `2.12.5` as a dependency in `pyproject.toml` and `uv.lock`.
- Added `annotated-types` as a new dependency in `uv.lock`.
- Refactored `BaseDevice` class to include abstract methods for device properties and loading templates.
- Created `Interfaces`, `System`, `Vlans`, and `Device` models in a new `contract.py` file for structured data handling.
- Updated `Mikrotik` class to implement the new `BaseDevice` structure and added a template loading method.
2026-02-16 00:57:09 +03:00

27 lines
557 B
Python

from typing import Callable, Type
from .base import BaseDevice
device_registry = {}
def register_parser(
name: list[str],
) -> Callable[[Type[BaseDevice]], Type[BaseDevice]]:
def wrapper(cls):
name_list = []
if isinstance(name, str):
name_list.append(name)
else:
name_list.extend(name)
for item in name_list:
device_registry[item.lower()] = cls
return cls
return wrapper
from . import models # noqa: E402, F401
__all__ = ["register_parser", "device_registry"]