Skip to content
Snippets Groups Projects
Commit 2808c2e4 authored by Ladislav Lhotka's avatar Ladislav Lhotka
Browse files

Move class documentation to the docstring.

parent 4ab56f66
No related branches found
No related tags found
No related merge requests found
......@@ -15,17 +15,11 @@ Data Model
This module provides the :class:`DataModel` class that provides the basic
user-level API to the *Yangson* library.
.. class:: DataModel(yltxt: str, mod_path: List[str] )
This class represents a high-level view of the YANG data model. Its
constructor has two arguments:
- **yltxt** – JSON text with YANG library data;
- **mod_path** – list of filesystem paths from which the YANG modules
that are listed in the YANG library data can be retrieved.
.. autoclass:: DataModel(yltxt: str, mod_path: List[str] )
It is a *singleton* class which means that only one instance can be
created.
created. This limitation corresponds to the fact that it is not
possible to work with multiple data models at the same time.
:class:`DataModel` is also re-exported by the main package, so it
can also be imported directly from there:
......
......@@ -10,16 +10,14 @@ from .schema import (BadSchemaNodeType, DataNode, GroupNode,
from .typealiases import *
class DataModel(metaclass=Singleton):
"""Singleton class representing the entry point to the YANG data model."""
"""The basic entry point to the YANG data model.
def __init__(self, yltxt: str, mod_path: List[str]) -> None:
"""Initialize the class instance.
:param yltxt: JSON text with YANG library data
:param mod_path: list of directories where to look for YANG modules
"""
:param yltxt: JSON text containing YANG library data
:param mod_path: list of filesystem paths from which
YANG modules listed in YANG library
can be retrieved.
"""
def __init__(self, yltxt: str, mod_path: List[str]) -> None:
"""Initialize the class instance."""
Context.schema = GroupNode()
try:
yl = json.loads(yltxt)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment