Skip to content

Commit f784df6

Browse files
committed
Fix regression in #81
It seems #81 introduced some kind of bug: I have the following rst file documenting MyClass object from ottemplate module: ``` .. currentmodule:: ottemplate .. autosummary:: :toctree: _generated/ :template: class.rst_t MyClass ``` with class.rst_t: ``` {{ objname }} {{ underline }} .. currentmodule:: {{ module }} .. autoclass:: {{ objname }} {% block methods %} .. automethod:: __init__ {% endblock %} ``` results in the following error: ``` following exception was raised: Traceback (most recent call last): File "/home/schueller/.local/lib/python3.5/site-packages/sphinx/ext/autodoc.py", line 551, in import_object __import__(self.modname) ImportError: No module named 'ottemplate.ottemplate.MyClass'; 'ottemplate.ottemplate' is not a package ``` What do you think @sirno ?
1 parent 6df5c12 commit f784df6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

numpydoc/docscrape_sphinx.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import pydoc
88
import collections
99
import os
10+
from types import ModuleType
1011

1112
from jinja2 import FileSystemLoader
1213
from jinja2.sandbox import SandboxedEnvironment
@@ -137,9 +138,6 @@ def _str_member_list(self, name):
137138
others.append((param, param_type, desc))
138139

139140
if autosum:
140-
out += ['.. currentmodule:: '
141-
+ self._obj.__module__ + '.' + self._obj.__name__]
142-
out += []
143141
out += ['.. autosummary::']
144142
if self.class_members_toctree:
145143
out += [' :toctree:']

0 commit comments

Comments
 (0)