Skip to content

Commit

Permalink
Fix parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper authored Jan 18, 2024
1 parent 9df8542 commit 64af481
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/ElunaDoc/parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from types import FileType
import typing
import markdown
from typedecorator import params, returns, Nullable

Expand All @@ -23,7 +23,7 @@ class ParameterDoc(object):
'ObjectGuid': ('0', '18,446,744,073,709,551,615'),
}

@params(self=object, name=Nullable(unicode), data_type=str, description=unicode, default_value=Nullable(unicode))
@params(self=object, name=Nullable(str), data_type=str, description=str, default_value=Nullable(str))
def __init__(self, name, data_type, description, default_value=None):
"""If `name` is not provided, the Parameter is a returned value instead of a parameter."""
self.name = name
Expand Down Expand Up @@ -59,12 +59,12 @@ def __init__(self, name, data_type, description, default_value=None):
self.data_type = '[' + self.data_type + ']'

elif not self.data_type in ['nil', 'boolean', 'number', 'string', 'table', 'function', '...'] and self.data_type[:1] != '[':
print "Missing angle brackets [] around the data type name: `" + self.data_type + "`"
print(f"Missing angle brackets [] around the data type name: `{self.data_type}`")


class MethodDoc(object):
"""The documentation data of an Eluna method."""
@params(self=object, name=unicode, description=unicode, prototypes=[unicode], parameters=[ParameterDoc], returned=[ParameterDoc])
@params(self=object, name=str, description=str, prototypes=[str], parameters=[ParameterDoc], returned=[ParameterDoc])
def __init__(self, name, description, prototypes, parameters, returned):
self.name = name
self.prototypes = prototypes
Expand All @@ -81,7 +81,7 @@ def __init__(self, name, description, prototypes, parameters, returned):

class MangosClassDoc(object):
"""The documentation of a MaNGOS class that has Lua methods."""
@params(self=object, name=unicode, description=unicode, methods=[MethodDoc])
@params(self=object, name=str, description=str, methods=[MethodDoc])
def __init__(self, name, description, methods):
self.name = name
# Parse the description as Markdown.
Expand Down Expand Up @@ -317,7 +317,7 @@ def to_class_doc(self):

@staticmethod
@returns(MangosClassDoc)
@params(file=FileType)
@params(file=typing.IO)
def parse_file(file):
"""Parse the file `file` into a documented class."""
# Get the class name from "ClassMethods.h" by stripping off "Methods.h".
Expand Down

0 comments on commit 64af481

Please sign in to comment.