mirror of
https://github.com/readthedocs/sphinx-autoapi
synced 2024-11-17 21:25:35 +00:00
Clean up warnings and move jinja_env onto base
This commit is contained in:
parent
2dcb0ca200
commit
a94e3d8c60
@ -16,8 +16,10 @@ class AutoAPIBase(object):
|
||||
language = 'base'
|
||||
type = 'base'
|
||||
|
||||
def __init__(self, obj):
|
||||
def __init__(self, obj, jinja_env=None):
|
||||
self.obj = obj
|
||||
if jinja_env:
|
||||
self.jinja_env = jinja_env
|
||||
|
||||
def render(self, ctx=None):
|
||||
if not ctx:
|
||||
|
@ -27,9 +27,9 @@ class JavaScriptDomain(AutoAPIDomain):
|
||||
parsed_data = json.loads(subprocess.check_output(['jsdoc', '-X', path]))
|
||||
return parsed_data
|
||||
except IOError:
|
||||
print Warning('Error reading file: {0}'.format(path))
|
||||
self.app.warn('Error reading file: {0}'.format(path))
|
||||
except TypeError:
|
||||
print Warning('Error reading file: {0}'.format(path))
|
||||
self.app.warn('Error reading file: {0}'.format(path))
|
||||
return None
|
||||
|
||||
def map(self):
|
||||
|
@ -26,9 +26,9 @@ class PythonDomain(AutoAPIDomain):
|
||||
parsed_data = parsed(path)
|
||||
return parsed_data
|
||||
except IOError:
|
||||
print Warning('Error reading file: {0}'.format(path))
|
||||
self.app.warn('Error reading file: {0}'.format(path))
|
||||
except TypeError:
|
||||
print Warning('Error reading file: {0}'.format(path))
|
||||
self.app.warn('Error reading file: {0}'.format(path))
|
||||
return None
|
||||
|
||||
def create_class(self, data):
|
||||
@ -64,10 +64,9 @@ class PythonBase(AutoAPIBase):
|
||||
|
||||
language = 'python'
|
||||
|
||||
def __init__(self, obj, jinja_env):
|
||||
super(PythonBase, self).__init__(obj)
|
||||
def __init__(self, obj, **kwargs):
|
||||
super(PythonBase, self).__init__(obj, **kwargs)
|
||||
|
||||
self.jinja_env = jinja_env
|
||||
# Always exist
|
||||
self.id = obj['fullname']
|
||||
self.name = self.obj.get('fullname', self.id)
|
||||
|
Loading…
Reference in New Issue
Block a user