summaryrefslogtreecommitdiff
path: root/rtemsspec/content.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-07 06:57:26 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-07 07:09:08 +0200
commitc4e460d8ba1fb0539371963fcfa6c2113538c5dd (patch)
tree6e305dd5c9f34c47e0fe82fb7ce9863d3220f0e6 /rtemsspec/content.py
parentaae12a99aeb2fcc3e6420244bd3bd68d7b2660bd (diff)
content: Add Content.comment_block()
Diffstat (limited to 'rtemsspec/content.py')
-rw-r--r--rtemsspec/content.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/rtemsspec/content.py b/rtemsspec/content.py
index 1015424c..7b99928b 100644
--- a/rtemsspec/content.py
+++ b/rtemsspec/content.py
@@ -163,6 +163,7 @@ class Content:
""" This class builds content. """
# pylint: disable=too-many-instance-attributes
+ # pylint: disable=too-many-public-methods
def __init__(self, the_license: str, pop_indent_gap: bool):
self._lines = [] # type: List[str]
self._license = the_license
@@ -392,6 +393,22 @@ class Content:
for statement in item["copyrights"]:
self.register_copyright(statement)
+ def open_comment_block(self) -> None:
+ """ Opens a comment block. """
+ self.push_indent("# ", "#")
+
+ def close_comment_block(self) -> None:
+ """ Closes a comment block. """
+ self.pop_indent()
+ self.gap = True
+
+ @contextmanager
+ def comment_block(self) -> Iterator[None]:
+ """ Opens a comment block context. """
+ self.open_comment_block()
+ yield
+ self.close_comment_block()
+
def write(self, path: str) -> None:
""" Writes the content to the file specified by the path. """
directory = os.path.dirname(path)
@@ -635,13 +652,6 @@ class CContent(Content):
self.gap = True
@contextmanager
- def comment_block(self) -> Iterator[None]:
- """ Opens a comment block context. """
- self.open_comment_block()
- yield
- self.close_comment_block()
-
- @contextmanager
def doxygen_block(self) -> Iterator[None]:
""" Opens a Doxygen comment block context. """
self.open_doxygen_block()