mirror of
https://github.com/readthedocs/sphinx-autoapi
synced 2024-11-19 15:25:31 +00:00
Fixed lint errors
This commit is contained in:
parent
ae1e4f556d
commit
86a9ffdd60
@ -196,7 +196,7 @@ class SphinxMapperBase(object):
|
|||||||
# Mapping of {namespace id -> Python Object}
|
# Mapping of {namespace id -> Python Object}
|
||||||
self.top_level_objects = OrderedDict()
|
self.top_level_objects = OrderedDict()
|
||||||
|
|
||||||
def load(self, patterns, dirs, ignore=None, **kwargs):
|
def load(self, patterns, dirs, ignore=None):
|
||||||
'''
|
'''
|
||||||
Load objects from the filesystem into the ``paths`` dictionary.
|
Load objects from the filesystem into the ``paths`` dictionary.
|
||||||
|
|
||||||
@ -270,11 +270,11 @@ class SphinxMapperBase(object):
|
|||||||
for obj in self.create_class(data, options=options, path=path):
|
for obj in self.create_class(data, options=options, path=path):
|
||||||
self.add_object(obj)
|
self.add_object(obj)
|
||||||
|
|
||||||
def create_class(self, obj, options=None, path=None, **kwargs):
|
def create_class(self, data, options=None, path=None, **kwargs):
|
||||||
'''
|
'''
|
||||||
Create class object.
|
Create class object.
|
||||||
|
|
||||||
:param obj: Instance of a AutoAPI object
|
:param data: Instance of a AutoAPI object
|
||||||
'''
|
'''
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class DotNetSphinxMapper(SphinxMapperBase):
|
|||||||
|
|
||||||
DOCFX_OUTPUT_PATH = '_api'
|
DOCFX_OUTPUT_PATH = '_api'
|
||||||
|
|
||||||
|
# pylint: disable=arguments-differ
|
||||||
def load(self, patterns, dirs, ignore=None, **kwargs):
|
def load(self, patterns, dirs, ignore=None, **kwargs):
|
||||||
'''Load objects from the filesystem into the ``paths`` dictionary.
|
'''Load objects from the filesystem into the ``paths`` dictionary.
|
||||||
|
|
||||||
@ -124,7 +125,7 @@ class DotNetSphinxMapper(SphinxMapperBase):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# Subclassed to iterate over items
|
# Subclassed to iterate over items
|
||||||
def map(self, options=None, **kwargs):
|
def map(self, options=None):
|
||||||
'''Trigger find of serialized sources and build objects'''
|
'''Trigger find of serialized sources and build objects'''
|
||||||
for path, data in self.paths.items():
|
for path, data in self.paths.items():
|
||||||
references = data.get('references', [])
|
references = data.get('references', [])
|
||||||
@ -135,7 +136,7 @@ class DotNetSphinxMapper(SphinxMapperBase):
|
|||||||
|
|
||||||
self.organize_objects()
|
self.organize_objects()
|
||||||
|
|
||||||
def create_class(self, data, options=None, **kwargs):
|
def create_class(self, data, options=None, path=None, **kwargs):
|
||||||
'''
|
'''
|
||||||
Return instance of class based on Roslyn type property
|
Return instance of class based on Roslyn type property
|
||||||
|
|
||||||
@ -211,15 +212,15 @@ class DotNetSphinxMapper(SphinxMapperBase):
|
|||||||
|
|
||||||
# Clean out dead namespaces
|
# Clean out dead namespaces
|
||||||
for key, ns in self.top_namespaces.copy().items():
|
for key, ns in self.top_namespaces.copy().items():
|
||||||
if len(ns.children) == 0:
|
if not ns.children:
|
||||||
del self.top_namespaces[key]
|
del self.top_namespaces[key]
|
||||||
|
|
||||||
for key, ns in self.namespaces.items():
|
for key, ns in self.namespaces.items():
|
||||||
if len(ns.children) == 0:
|
if not ns.children:
|
||||||
del self.namespaces[key]
|
del self.namespaces[key]
|
||||||
|
|
||||||
def output_rst(self, root, source_suffix):
|
def output_rst(self, root, source_suffix):
|
||||||
if not len(self.objects):
|
if not self.objects:
|
||||||
raise ExtensionError("No API objects exist. Can't continue")
|
raise ExtensionError("No API objects exist. Can't continue")
|
||||||
for id, obj in self.objects.items():
|
for id, obj in self.objects.items():
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class GoSphinxMapper(SphinxMapperBase):
|
|||||||
self.app.warn('Error reading file: {0}'.format(path))
|
self.app.warn('Error reading file: {0}'.format(path))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def create_class(self, data, options=None, **kwargs):
|
def create_class(self, data, options=None, path=None, **kwargs):
|
||||||
'''Return instance of class based on Go data
|
'''Return instance of class based on Go data
|
||||||
|
|
||||||
Data keys handled here:
|
Data keys handled here:
|
||||||
|
@ -32,7 +32,7 @@ class JavaScriptSphinxMapper(SphinxMapperBase):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# Subclassed to iterate over items
|
# Subclassed to iterate over items
|
||||||
def map(self, options=None, **kwargs):
|
def map(self, options=None):
|
||||||
'''Trigger find of serialized sources and build objects'''
|
'''Trigger find of serialized sources and build objects'''
|
||||||
for path, data in self.paths.items():
|
for path, data in self.paths.items():
|
||||||
for item in data:
|
for item in data:
|
||||||
@ -40,7 +40,7 @@ class JavaScriptSphinxMapper(SphinxMapperBase):
|
|||||||
obj.jinja_env = self.jinja_env
|
obj.jinja_env = self.jinja_env
|
||||||
self.add_object(obj)
|
self.add_object(obj)
|
||||||
|
|
||||||
def create_class(self, data, options=None, **kwargs):
|
def create_class(self, data, options=None, path=None, **kwargs):
|
||||||
'''Return instance of class based on Javascript data
|
'''Return instance of class based on Javascript data
|
||||||
|
|
||||||
Data keys handled here:
|
Data keys handled here:
|
||||||
|
@ -25,14 +25,14 @@ class PythonSphinxMapper(SphinxMapperBase):
|
|||||||
:param app: Sphinx application passed in as part of the extension
|
:param app: Sphinx application passed in as part of the extension
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def load(self, patterns, dirs, **kwargs):
|
def load(self, patterns, dirs, ignore=None):
|
||||||
"""Load objects from the filesystem into the ``paths`` dictionary
|
"""Load objects from the filesystem into the ``paths`` dictionary
|
||||||
|
|
||||||
Also include an attribute on the object, ``relative_path`` which is the
|
Also include an attribute on the object, ``relative_path`` which is the
|
||||||
shortened, relative path the package/module
|
shortened, relative path the package/module
|
||||||
"""
|
"""
|
||||||
for dir_ in dirs:
|
for dir_ in dirs:
|
||||||
for path in self.find_files(patterns=patterns, dirs=[dir_], **kwargs):
|
for path in self.find_files(patterns=patterns, dirs=[dir_], ignore=ignore):
|
||||||
data = self.read_file(path=path)
|
data = self.read_file(path=path)
|
||||||
data.relative_path = os.path.relpath(path, dir_)
|
data.relative_path = os.path.relpath(path, dir_)
|
||||||
if data:
|
if data:
|
||||||
|
@ -21,10 +21,8 @@ def _build_toc_node(docname, anchor='anchor', text='test text', bullet=False):
|
|||||||
anchorname='#' + anchor, *[nodes.Text(text, text)])
|
anchorname='#' + anchor, *[nodes.Text(text, text)])
|
||||||
para = addnodes.compact_paragraph('', '', reference)
|
para = addnodes.compact_paragraph('', '', reference)
|
||||||
ret_list = nodes.list_item('', para)
|
ret_list = nodes.list_item('', para)
|
||||||
if not bullet:
|
|
||||||
return ret_list
|
return nodes.bullet_list('', ret_list) if bullet else ret_list
|
||||||
else:
|
|
||||||
return nodes.bullet_list('', ret_list)
|
|
||||||
|
|
||||||
|
|
||||||
def _traverse_parent(node, objtypes):
|
def _traverse_parent(node, objtypes):
|
||||||
|
Loading…
Reference in New Issue
Block a user