summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-01-03 11:09:27 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-01-03 13:36:14 +0100
commitc1a4100861ac5eee66465c949b4e78566644d869 (patch)
tree7a24c0f8406f1604c7e90c396aa7a547545e2abe
parentAdd Github CI (diff)
downloadrtems-central-c1a4100861ac5eee66465c949b4e78566644d869.tar.bz2
Format with yapf version 0.32.0
-rw-r--r--rtemsspec/applconfig.py2
-rw-r--r--rtemsspec/content.py4
-rw-r--r--rtemsspec/glossary.py1
-rw-r--r--rtemsspec/interface.py5
-rw-r--r--rtemsspec/interfacedoc.py1
-rw-r--r--rtemsspec/items.py8
-rw-r--r--rtemsspec/specdoc.py1
-rwxr-xr-xrtemsspec/specverify.py6
-rw-r--r--rtemsspec/sphinxcontent.py4
-rw-r--r--rtemsspec/transitionmap.py1
-rw-r--r--rtemsspec/util.py1
-rw-r--r--rtemsspec/validation.py7
12 files changed, 41 insertions, 0 deletions
diff --git a/rtemsspec/applconfig.py b/rtemsspec/applconfig.py
index a2f22d2a..efa1d776 100644
--- a/rtemsspec/applconfig.py
+++ b/rtemsspec/applconfig.py
@@ -61,6 +61,7 @@ class _ContentAdaptor:
By default, Sphinx content is generated.
"""
+
def __init__(self, mapper: ItemMapper, content: Any) -> None:
self.mapper = mapper
self.content = content
@@ -137,6 +138,7 @@ class _ContentAdaptor:
class _SphinxContentAdaptor(_ContentAdaptor):
+
def __init__(self, mapper: ItemMapper) -> None:
super().__init__(mapper, SphinxContent())
diff --git a/rtemsspec/content.py b/rtemsspec/content.py
index 24dafc64..eaab2873 100644
--- a/rtemsspec/content.py
+++ b/rtemsspec/content.py
@@ -50,6 +50,7 @@ class Copyright:
This class represents a copyright holder with its years of substantial
contributions.
"""
+
def __init__(self, holder):
self._holder = holder
self._years = set()
@@ -88,6 +89,7 @@ class Copyright:
class Copyrights:
""" This class represents a set of copyright holders. """
+
def __init__(self):
self.copyrights = {}
@@ -659,8 +661,10 @@ class CContent(Content):
self.add(["#ifdef HAVE_CONFIG_H", "#include \"config.h\"", "#endif"])
def _add_includes(self, includes: Set[str], local: bool) -> None:
+
class IncludeKey: # pylint: disable=too-few-public-methods
""" Provides a key to sort includes. """
+
def __init__(self, inc: str):
self._inc = inc
diff --git a/rtemsspec/glossary.py b/rtemsspec/glossary.py
index b3a3e7b7..c2387e7b 100644
--- a/rtemsspec/glossary.py
+++ b/rtemsspec/glossary.py
@@ -85,6 +85,7 @@ def _find_glossary_terms(path: str, document_terms: ItemMap,
class _GlossaryMapper(ItemMapper):
+
def __init__(self, item: Item, document_terms: ItemMap):
super().__init__(item)
self._document_terms = document_terms
diff --git a/rtemsspec/interface.py b/rtemsspec/interface.py
index 87fb3662..1162f81c 100644
--- a/rtemsspec/interface.py
+++ b/rtemsspec/interface.py
@@ -56,6 +56,7 @@ def _get_group_identifiers(groups: ItemMap) -> List[str]:
class _InterfaceMapper(ItemMapper):
+
def __init__(self, node: "Node"):
super().__init__(node.item)
self._node = node
@@ -119,6 +120,7 @@ class _InterfaceMapper(ItemMapper):
class _InterfaceExpressionMapper(ExpressionMapper):
+
def __init__(self, mapper: _InterfaceMapper):
super().__init__()
self._mapper = mapper
@@ -129,6 +131,7 @@ class _InterfaceExpressionMapper(ExpressionMapper):
class _ItemLevelExpressionMapper(ExpressionMapper):
+
def __init__(self, mapper: _InterfaceMapper):
super().__init__()
self._mapper = mapper
@@ -140,6 +143,7 @@ class _ItemLevelExpressionMapper(ExpressionMapper):
class _HeaderExpressionMapper(ExpressionMapper):
+
def __init__(self, item: Item, enabled_by_defined: Dict[str, str]):
super().__init__()
self._mapper = ItemMapper(item)
@@ -710,6 +714,7 @@ def _bubble_sort(nodes: List[Node]) -> List[Node]:
class _HeaderFile:
""" A header file. """
+
def __init__(self, item: Item, enabled_by_defined: Dict[str, str],
enabled: List[str]):
self._item = item
diff --git a/rtemsspec/interfacedoc.py b/rtemsspec/interfacedoc.py
index fe0a7f67..b4507789 100644
--- a/rtemsspec/interfacedoc.py
+++ b/rtemsspec/interfacedoc.py
@@ -48,6 +48,7 @@ def _get_code_param(ctx: ItemGetValueContext) -> Any:
class _CodeMapper(ItemMapper):
+
def __init__(self, item: Item):
super().__init__(item)
self.add_get_value("interface/forward-declaration:/name",
diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index 904ab14d..0aec25c7 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -109,6 +109,7 @@ yaml.add_representer(str, _str_representer)
class Link:
""" A link to an item. """
+
def __init__(self, item: "Item", data: Any):
self._item = item
self._data = data
@@ -450,6 +451,7 @@ class ItemTemplate(string.Template):
class _ItemMapperContext(dict):
""" Context to map identifiers to items and attribute values. """
+
def __init__(self, mapper: "ItemMapper", item: Optional[Item],
prefix: Optional[str], recursive: bool):
super().__init__()
@@ -468,6 +470,7 @@ class _ItemMapperContext(dict):
class _GetValueDictionary(dict):
+
def __init__(self, get_value: ItemGetValue):
super().__init__()
self._get_value = get_value
@@ -478,6 +481,7 @@ class _GetValueDictionary(dict):
class ItemMapper:
""" Maps identifiers to items and attribute values. """
+
def __init__(self, item: Item, recursive: bool = False):
self._item = item
self._recursive = recursive
@@ -658,6 +662,7 @@ def _load_json_data(path: str, uid: str) -> Any:
class ItemCache:
""" This class provides a cache of specification items. """
+
def __init__(self,
config: Any,
post_process_load: Optional[Callable[[ItemMap],
@@ -814,6 +819,7 @@ class ItemCache:
class EmptyItemCache(ItemCache):
""" This class provides a empty cache of specification items. """
+
def __init__(self):
super().__init__({
"cache-directory": ".",
@@ -824,6 +830,7 @@ class EmptyItemCache(ItemCache):
class JSONItemCache(ItemCache):
""" This class provides a cache of specification items using JSON. """
+
def _load_json_items(self, base: str, path: str) -> None:
for name in os.listdir(path):
path2 = os.path.join(path, name)
@@ -848,5 +855,6 @@ class JSONItemCache(ItemCache):
class EmptyItem(Item):
""" Objects of this class represent empty items. """
+
def __init__(self):
super().__init__(EmptyItemCache(), "", {})
diff --git a/rtemsspec/specdoc.py b/rtemsspec/specdoc.py
index c6d484c9..59f34d9e 100644
--- a/rtemsspec/specdoc.py
+++ b/rtemsspec/specdoc.py
@@ -68,6 +68,7 @@ def _a_or_an(value: str) -> str:
class _AssertContext:
""" This class provides a context to document assert expressions. """
+
def __init__(self, content: SphinxContent, ops: Dict[str, Any]):
self.content = content
self.ops = ops
diff --git a/rtemsspec/specverify.py b/rtemsspec/specverify.py
index 2f8f058c..0cf05c3c 100755
--- a/rtemsspec/specverify.py
+++ b/rtemsspec/specverify.py
@@ -44,6 +44,7 @@ class VerifyStatus(NamedTuple):
class _Filter(logging.Filter):
+
def __init__(self):
super().__init__()
self._counts = {} # type: Dict[int, int]
@@ -221,6 +222,7 @@ def _prefix(prefix: _Path) -> str:
class _Verifier:
+
def __init__(self, name: str, verifier_map: _VerifierMap):
self._name = name
self._verifier_map = verifier_map
@@ -242,6 +244,7 @@ class _Verifier:
class _AnyVerifier(_Verifier):
+
def verify(self, path: _Path, _value: Any) -> Set[str]:
""" Does not verify the value. """
self.verify_info(path)
@@ -249,6 +252,7 @@ class _AnyVerifier(_Verifier):
class _NameVerifier(_Verifier):
+
def verify(self, path: _Path, value: Any) -> Set[str]:
""" Verifies a name. """
self.verify_info(path)
@@ -258,6 +262,7 @@ class _NameVerifier(_Verifier):
class _UIDVerifier(_Verifier):
+
def verify(self, path: _Path, value: Any) -> Set[str]:
""" Verifies an attribute key. """
self.verify_info(path)
@@ -271,6 +276,7 @@ class _UIDVerifier(_Verifier):
class _ItemVerifier(_Verifier):
+
def __init__(self, name: str, verifier_map: _VerifierMap,
info_map: Dict[str, Any], item: Item):
super().__init__(name, verifier_map)
diff --git a/rtemsspec/sphinxcontent.py b/rtemsspec/sphinxcontent.py
index d9a73564..307bb837 100644
--- a/rtemsspec/sphinxcontent.py
+++ b/rtemsspec/sphinxcontent.py
@@ -62,6 +62,7 @@ def _simple_row(row: Iterable[str], maxi: Iterable[int]) -> str:
class SphinxContent(Content):
""" This class builds Sphinx content. """
+
def __init__(self, section_level: int = 2):
super().__init__("CC-BY-SA-4.0", True)
self._tab = " "
@@ -100,6 +101,7 @@ class SphinxContent(Content):
definition: GenericContent,
wrap: bool = False) -> None:
""" Adds a definition item the content. """
+
@contextmanager
def _definition_item_context(content: Content) -> Iterator[None]:
content.append(name)
@@ -266,6 +268,7 @@ def _get_value_sphinx_unspecified_type(ctx: ItemGetValueContext) -> Any:
class SphinxMapper(ItemMapper):
""" Sphinx item mapper. """
+
def __init__(self, item: Item, recursive: bool = False):
super().__init__(item, recursive)
self.add_get_value("glossary/term:/term", _get_ref_term)
@@ -317,6 +320,7 @@ def _get_param(ctx: ItemGetValueContext) -> Any:
class SphinxInterfaceMapper(SphinxMapper):
""" Sphinx item mapper for the interface documentation. """
+
def __init__(self,
item: Item,
group_uids: List[str],
diff --git a/rtemsspec/transitionmap.py b/rtemsspec/transitionmap.py
index f3ad3988..cdb8d27a 100644
--- a/rtemsspec/transitionmap.py
+++ b/rtemsspec/transitionmap.py
@@ -53,6 +53,7 @@ def _variant_to_key(variant: Transition) -> str:
class _TransitionEntry:
+
def __init__(self):
self.key = ""
self.variants = [] # type: List[Transition]
diff --git a/rtemsspec/util.py b/rtemsspec/util.py
index a92a1eff..ab9e90f6 100644
--- a/rtemsspec/util.py
+++ b/rtemsspec/util.py
@@ -47,6 +47,7 @@ def copy_files(src_dir: str, dst_dir: str, files: List[str]) -> None:
def load_config(config_filename: str) -> Any:
""" Loads the configuration file with recursive includes. """
+
class IncludeLoader(yaml.SafeLoader): # pylint: disable=too-many-ancestors
""" YAML loader customization to process custom include tags. """
_filenames = [config_filename]
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 6c72856f..37dba747 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -58,6 +58,7 @@ def _get_test_run(ctx: ItemGetValueContext) -> Any:
class _Mapper(ItemMapper):
+
def __init__(self, item: Item):
super().__init__(item)
self._step = 0
@@ -493,6 +494,7 @@ class _TestItem:
class _TestSuiteItem(_TestItem):
""" A test suite item. """
+
@property
def group_identifier(self) -> str:
return f"RTEMSTestSuite{self.ident}"
@@ -529,6 +531,7 @@ def _add_condition_enum(content: CContent, co_idx_to_enum: _IdxToX) -> None:
class _ActionRequirementTestItem(_TestItem):
""" An action requirement test item. """
+
def __init__(self, item: Item):
super().__init__(item)
self._mapper.add_get_value(("requirement/functional/action:"
@@ -876,6 +879,7 @@ class _ActionRequirementTestItem(_TestItem):
class _RuntimeMeasurementRequestItem(_TestItem):
""" A runtime measurement request item. """
+
def __init__(self, item: Item, context: str):
super().__init__(item)
self._context = context
@@ -889,6 +893,7 @@ def _add_call_method(content: CContent, name: str) -> None:
class _RuntimeMeasurementTestItem(_TestItem):
""" A runtime measurement test item. """
+
def add_test_case_action_description(self, _content: CContent) -> None:
pass
@@ -1017,6 +1022,7 @@ class _RuntimeMeasurementTestItem(_TestItem):
class _SourceFile:
""" A test source file. """
+
def __init__(self, filename: str):
""" Initializes a test source file. """
self._file = filename
@@ -1086,6 +1092,7 @@ def _gather_build_source_files(item: Item, files: List[str]):
class _TestProgram:
""" A test program. """
+
def __init__(self, item: Item):
""" Initializes a test program. """
self._item = item