Coverage for src/birdplan/yaml/base.py: 83%
12 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-04 10:19 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-03-04 10:19 +0000
1#
2# SPDX-License-Identifier: GPL-3.0-or-later
3#
4# Copyright (C) 2019-2025, AllWorldIT.
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <https://www.gnu.org/licenses/>.
19"""BirdPlan YAML handling."""
21import abc
22import io
23import pathlib
24from typing import Any
26__all__ = ["YAMLBase"]
29class YAMLBase(abc.ABC):
30 """YAML class."""
32 @abc.abstractmethod
33 def load(self, yaml: str | pathlib.Path | io.IOBase) -> Any: # noqa: ANN401
34 """Load YAML string."""
35 raise NotImplementedError
37 @abc.abstractmethod
38 def dump(self, data: Any, stream: pathlib.Path | io.IOBase | None = None) -> Any: # noqa: ANN401
39 """Dump to YAML."""
40 raise NotImplementedError