summaryrefslogtreecommitdiff
path: root/lib/sly/docparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sly/docparse.py')
-rw-r--r--lib/sly/docparse.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/sly/docparse.py b/lib/sly/docparse.py
index d5a83ce..0f35c97 100644
--- a/lib/sly/docparse.py
+++ b/lib/sly/docparse.py
@@ -2,7 +2,8 @@
#
# Support doc-string parsing classes
-__all__ = [ 'DocParseMeta' ]
+__all__ = ["DocParseMeta"]
+
class DocParseMeta(type):
'''
@@ -44,17 +45,17 @@ class DocParseMeta(type):
@staticmethod
def __new__(meta, clsname, bases, clsdict):
- if '__doc__' in clsdict:
+ if "__doc__" in clsdict:
lexer = meta.lexer()
parser = meta.parser()
lexer.cls_name = parser.cls_name = clsname
- lexer.cls_qualname = parser.cls_qualname = clsdict['__qualname__']
- lexer.cls_module = parser.cls_module = clsdict['__module__']
- parsedict = parser.parse(lexer.tokenize(clsdict['__doc__']))
- assert isinstance(parsedict, dict), 'Parser must return a dictionary'
+ lexer.cls_qualname = parser.cls_qualname = clsdict["__qualname__"]
+ lexer.cls_module = parser.cls_module = clsdict["__module__"]
+ parsedict = parser.parse(lexer.tokenize(clsdict["__doc__"]))
+ assert isinstance(parsedict, dict), "Parser must return a dictionary"
clsdict.update(parsedict)
return super().__new__(meta, clsname, bases, clsdict)
@classmethod
def __init_subclass__(cls):
- assert hasattr(cls, 'parser') and hasattr(cls, 'lexer')
+ assert hasattr(cls, "parser") and hasattr(cls, "lexer")