Produce HTML documentation for a module object.
(self, object, name=None, mod=None, *ignored)
| 773 | return '<dl>\n%s</dl>\n' % result |
| 774 | |
| 775 | def docmodule(self, object, name=None, mod=None, *ignored): |
| 776 | """Produce HTML documentation for a module object.""" |
| 777 | name = object.__name__ # ignore the passed-in name |
| 778 | try: |
| 779 | all = object.__all__ |
| 780 | except AttributeError: |
| 781 | all = None |
| 782 | parts = name.split('.') |
| 783 | links = [] |
| 784 | for i in range(len(parts)-1): |
| 785 | links.append( |
| 786 | '<a href="%s.html" class="white">%s</a>' % |
| 787 | ('.'.join(parts[:i+1]), parts[i])) |
| 788 | linkedname = '.'.join(links + parts[-1:]) |
| 789 | head = '<strong class="title">%s</strong>' % linkedname |
| 790 | try: |
| 791 | path = inspect.getabsfile(object) |
| 792 | url = urllib.parse.quote(path) |
| 793 | filelink = self.filelink(url, path) |
| 794 | except TypeError: |
| 795 | filelink = '(built-in)' |
| 796 | info = [] |
| 797 | if hasattr(object, '__version__'): |
| 798 | version = str(object.__version__) |
| 799 | if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': |
| 800 | version = version[11:-1].strip() |
| 801 | info.append('version %s' % self.escape(version)) |
| 802 | if hasattr(object, '__date__'): |
| 803 | info.append(self.escape(str(object.__date__))) |
| 804 | if info: |
| 805 | head = head + ' (%s)' % ', '.join(info) |
| 806 | docloc = self.getdocloc(object) |
| 807 | if docloc is not None: |
| 808 | docloc = '<br><a href="%(docloc)s">Module Reference</a>' % locals() |
| 809 | else: |
| 810 | docloc = '' |
| 811 | result = self.heading(head, '<a href=".">index</a><br>' + filelink + docloc) |
| 812 | |
| 813 | modules = inspect.getmembers(object, inspect.ismodule) |
| 814 | |
| 815 | classes, cdict = [], {} |
| 816 | for key, value in inspect.getmembers(object, inspect.isclass): |
| 817 | # if __all__ exists, believe it. Otherwise use old heuristic. |
| 818 | if (all is not None or |
| 819 | (inspect.getmodule(value) or object) is object): |
| 820 | if visiblename(key, all, object): |
| 821 | classes.append((key, value)) |
| 822 | cdict[key] = cdict[value] = '#' + key |
| 823 | for key, value in classes: |
| 824 | for base in value.__bases__: |
| 825 | key, modname = base.__name__, base.__module__ |
| 826 | module = sys.modules.get(modname) |
| 827 | if modname != name and module and hasattr(module, key): |
| 828 | if getattr(module, key) is base: |
| 829 | if not key in cdict: |
| 830 | cdict[key] = cdict[base] = modname + '.html#' + key |
| 831 | funcs, fdict = [], {} |
| 832 | for key, value in inspect.getmembers(object, inspect.isroutine): |
no test coverage detected