Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
apozharski committed Sep 5, 2024
1 parent f722baa commit c929b54
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
15 changes: 7 additions & 8 deletions sphinxcontrib/mat_documenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,9 @@ def member_is_friend_of(member, friends):

def member_is_enum(member):
return isinstance(member, MatEnumeration)

ret = []

# search for members in source code too
namespace = ".".join(self.objpath) # will be empty for modules

Expand Down Expand Up @@ -1242,7 +1242,9 @@ def document_members(self, all_members=False):
other_names = [
membername
for (membername, member) in filtered_members
if not isinstance(member, MatMethod) and not isinstance(member, MatProperty) and not isinstance(member, MatEnumeration)
if not isinstance(member, MatMethod)
and not isinstance(member, MatProperty)
and not isinstance(member, MatEnumeration)
# exclude parent modules with names matching members (as in Myclass.Myclass)
and not (hasattr(member, "module") and member.name == member.module)
]
Expand Down Expand Up @@ -1295,12 +1297,10 @@ def document_members(self, all_members=False):
self.document_member_section(
"Property Summary", non_properties, all_members
)

# enumss
if enum_names:
self.document_member_section(
"Enumeration Values", non_enums, all_members
)
self.document_member_section("Enumeration Values", non_enums, all_members)

# methods
if meth_names:
Expand Down Expand Up @@ -1549,7 +1549,6 @@ def can_document_member(cls, member, membername, isattr, parent):
# self._datadescriptor = False
# return True


def add_content(self, more_content, no_docstring=False):
"""Never try to get a docstring from the object."""
# MatAttributeDocumenter.add_content(self, more_content,
Expand Down
1 change: 0 additions & 1 deletion sphinxcontrib/mat_tree_sitter_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@
(source_file
(comment)? @docstring
)
"""
)

Expand Down
8 changes: 6 additions & 2 deletions sphinxcontrib/mat_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,9 @@ def getter(self, name, *defargs):
elif name == "__dict__":
objdict = dict([(pn, self.getter(pn)) for pn in self.properties.keys()])
objdict.update(self.methods)
objdict.update(dict([(en, self.getter(en)) for en in self.enumerations.keys()]))
objdict.update(
dict([(en, self.getter(en)) for en in self.enumerations.keys()])
)
return objdict
else:
super(MatClass, self).getter(name, *defargs)
Expand All @@ -904,12 +906,13 @@ def __module__(self):
def __doc__(self):
return self.docstring


class MatEnumeration(MatObject):
def __init__(self, name, cls, attrs):
super(MatEnumeration, self).__init__(name)
self.cls = cls
self.docstring = attrs["docstring"]

def ref_role(self):
"""Returns role to use for references to this object (e.g. when generating auto-links)"""
return "enum"
Expand All @@ -922,6 +925,7 @@ def __module__(self):
def __doc__(self):
return self.docstring


class MatMethod(MatFunction):
def __init__(self, name, parsed_function, modname, cls):
self.name = name
Expand Down
7 changes: 3 additions & 4 deletions sphinxcontrib/matlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,13 @@ def _object_hierarchy_parts(self, sig):
This method must not be used outwith table of contents generation.
"""
parts = sig.attributes.get('module').split('.')
parts.append(sig.attributes.get('fullname'))
#import pdb;pdb.set_trace()
parts = sig.attributes.get("module").split(".")
parts.append(sig.attributes.get("fullname"))
return tuple(parts)

def _toc_entry_name(self, sig):
# TODO respecting the configuration setting ``toc_object_entries_show_parents``
return sig.attributes.get('fullname')
return sig.attributes.get("fullname")

def get_signature_prefix(self, sig):
return self.objtype + " "
Expand Down

0 comments on commit c929b54

Please sign in to comment.