def print_warnings(): """ Register a logger that will print warnings & errors. """ from epydoc import log del log._loggers[:] log.register_logger(log.SimpleLogger(log.DOCSTRING_WARNING))
def __init__(self): self._afterid = 0 self._progress = [None] self._cancel = [0] self._filename = None self._init_dir = None # Store a copy of sys.modules, so that we can restore it # later. This is useful for making sure that we reload # everything when we re-build its documentation. This will # *not* reload the modules that are present when the EpydocGUI # is created, but that should only contain some builtins, some # epydoc modules, Tkinter, pickle, and thread.. self._old_modules = sys.modules.keys() # Create the main window. self._root = Tk() self._root['background'] = BG_COLOR self._root.bind('<Control-q>', self.destroy) self._root.bind('<Alt-q>', self.destroy) self._root.bind('<Alt-x>', self.destroy) self._root.bind('<Control-x>', self.destroy) #self._root.bind('<Control-d>', self.destroy) self._root.title('Epydoc') self._rootframe = Frame(self._root, background=BG_COLOR, border=2, relief='raised') self._rootframe.pack(expand=1, fill='both', padx=2, pady=2) # Set up the basic frames. Do not pack the options frame or # the messages frame; the GUI has buttons to expand them. leftframe = Frame(self._rootframe, background=BG_COLOR) leftframe.pack(expand=1, fill='both', side='left') optsframe = Frame(self._rootframe, background=BG_COLOR) mainframe = Frame(leftframe, background=BG_COLOR) mainframe.pack(expand=1, fill='both', side='top') ctrlframe = Frame(mainframe, background=BG_COLOR) ctrlframe.pack(side="bottom", fill='x', expand=0) msgsframe = Frame(leftframe, background=BG_COLOR) self._optsframe = optsframe self._msgsframe = msgsframe # Initialize all the frames, etc. self._init_menubar() self._init_progress_bar(mainframe) self._init_module_list(mainframe) self._init_options(optsframe, ctrlframe) self._init_messages(msgsframe, ctrlframe) self._init_bindings() # Set up logging self._logger = GUILogger(self._progress, self._cancel) log.register_logger(self._logger) # Open the messages pane by default. self._messages_toggle()
def __init__(self): self._afterid = 0 self._progress = [None] self._cancel = [0] self._filename = None self._init_dir = None # Store a copy of sys.modules, so that we can restore it # later. This is useful for making sure that we reload # everything when we re-build its documentation. This will # *not* reload the modules that are present when the EpydocGUI # is created, but that should only contain some builtins, some # epydoc modules, Tkinter, pickle, and thread.. self._old_modules = list(sys.modules.keys()) # Create the main window. self._root = Tk() self._root['background']=BG_COLOR self._root.bind('<Control-q>', self.destroy) self._root.bind('<Alt-q>', self.destroy) self._root.bind('<Alt-x>', self.destroy) self._root.bind('<Control-x>', self.destroy) #self._root.bind('<Control-d>', self.destroy) self._root.title('Epydoc') self._rootframe = Frame(self._root, background=BG_COLOR, border=2, relief='raised') self._rootframe.pack(expand=1, fill='both', padx=2, pady=2) # Set up the basic frames. Do not pack the options frame or # the messages frame; the GUI has buttons to expand them. leftframe = Frame(self._rootframe, background=BG_COLOR) leftframe.pack(expand=1, fill='both', side='left') optsframe = Frame(self._rootframe, background=BG_COLOR) mainframe = Frame(leftframe, background=BG_COLOR) mainframe.pack(expand=1, fill='both', side='top') ctrlframe = Frame(mainframe, background=BG_COLOR) ctrlframe.pack(side="bottom", fill='x', expand=0) msgsframe = Frame(leftframe, background=BG_COLOR) self._optsframe = optsframe self._msgsframe = msgsframe # Initialize all the frames, etc. self._init_menubar() self._init_progress_bar(mainframe) self._init_module_list(mainframe) self._init_options(optsframe, ctrlframe) self._init_messages(msgsframe, ctrlframe) self._init_bindings() # Set up logging self._logger = GUILogger(self._progress, self._cancel) log.register_logger(self._logger) # Open the messages pane by default. self._messages_toggle()
from __future__ import print_statement import re, sys import nltk import epydoc.docbuilder, epydoc.cli from epydoc import log STOPLIST = '../../tools/nltk_term_index.stoplist' FILENAMES = ['ch%02d.xml' % n for n in range(13)] TARGET_DIR = 'nlp/' #FILENAMES = ['../doc/book/ll.xml'] logger = epydoc.cli.ConsoleLogger(0) logger._verbosity = 5 log.register_logger(logger) def find_all_names(stoplist): ROOT = ['nltk'] logger._verbosity = 0 docindex = epydoc.docbuilder.build_doc_index(ROOT, add_submodules=True) valdocs = sorted(docindex.reachable_valdocs( imports=False, #packages=False, bases=False, submodules=False, #subclasses=False, private=False)) logger._verbosity = 5 names = nltk.defaultdict(list) n = 0 for valdoc in valdocs: name = valdoc.canonical_name if (name is not epydoc.apidoc.UNKNOWN and
STOPLIST = '../../tools/nltk_term_index.stoplist' FILENAMES = ['ch%02d.xml' % n for n in range(13)] TARGET_DIR = 'nlp/' #FILENAMES = ['../doc/book/ll.xml'] import re, sys import nltk import epydoc.docbuilder, epydoc.cli from epydoc import log logger = epydoc.cli.ConsoleLogger(0) logger._verbosity = 5 log.register_logger(logger) def find_all_names(stoplist): ROOT = ['nltk'] logger._verbosity = 0 docindex = epydoc.docbuilder.build_doc_index(ROOT, add_submodules=True) valdocs = sorted( docindex.reachable_valdocs( imports=False, #packages=False, bases=False, submodules=False, #subclasses=False, private=False)) logger._verbosity = 5 names = nltk.defaultdict(list) n = 0 for valdoc in valdocs: name = valdoc.canonical_name if (name is not epydoc.apidoc.UNKNOWN and name is not None
def main(options, names): if options.action == 'text': if options.parse and options.introspect: options.parse = False # Set up the logger if options.action == 'text': logger = None # no logger for text output. elif options.verbosity > 1: logger = ConsoleLogger(options.verbosity) log.register_logger(logger) else: # Each number is a rough approximation of how long we spend on # that task, used to divide up the unified progress bar. stages = [40, # Building documentation 7, # Merging parsed & introspected information 1, # Linking imported variables 3, # Indexing documentation 30, # Parsing Docstrings 1, # Inheriting documentation 2] # Sorting & Grouping if options.action == 'html': stages += [100] elif options.action == 'text': stages += [30] elif options.action == 'latex': stages += [60] elif options.action == 'dvi': stages += [60,30] elif options.action == 'ps': stages += [60,40] elif options.action == 'pdf': stages += [60,50] elif options.action == 'check': stages += [10] else: raise ValueError, '%r not supported' % options.action if options.parse and not options.introspect: del stages[1] # no merging if options.introspect and not options.parse: del stages[1:3] # no merging or linking logger = UnifiedProgressConsoleLogger(options.verbosity, stages) log.register_logger(logger) # check the output directory. if options.action != 'text': if os.path.exists(options.target): if not os.path.isdir(options.target): return log.error("%s is not a directory" % options.target) # Set the default docformat from epydoc import docstringparser docstringparser.DEFAULT_DOCFORMAT = options.docformat # Set the dot path if options.dotpath: from epydoc import dotgraph dotgraph.DOT_PATH = options.dotpath # Build docs for the named values. from epydoc.docbuilder import build_doc_index docindex = build_doc_index(names, options.introspect, options.parse, add_submodules=(options.action!='text')) if docindex is None: return # docbuilder already logged an error. # Load profile information, if it was given. if options.pstat_files: try: profile_stats = pstats.Stats(options.pstat_files[0]) for filename in options.pstat_files[1:]: profile_stats.add(filename) except KeyboardInterrupt: raise except Exception, e: log.error("Error reading pstat file: %s" % e) profile_stats = None if profile_stats is not None: docindex.read_profiling_info(profile_stats)
def main(options, names): if options.action == 'text': if options.parse and options.introspect: options.parse = False # Set up the logger if options.action == 'text': logger = None # no logger for text output. elif options.verbosity > 1: logger = ConsoleLogger(options.verbosity) log.register_logger(logger) else: # Each number is a rough approximation of how long we spend on # that task, used to divide up the unified progress bar. stages = [ 40, # Building documentation 7, # Merging parsed & introspected information 1, # Linking imported variables 3, # Indexing documentation 30, # Parsing Docstrings 1, # Inheriting documentation 2 ] # Sorting & Grouping if options.action == 'html': stages += [100] elif options.action == 'text': stages += [30] elif options.action == 'latex': stages += [60] elif options.action == 'dvi': stages += [60, 30] elif options.action == 'ps': stages += [60, 40] elif options.action == 'pdf': stages += [60, 50] elif options.action == 'check': stages += [10] else: raise ValueError, '%r not supported' % options.action if options.parse and not options.introspect: del stages[1] # no merging if options.introspect and not options.parse: del stages[1:3] # no merging or linking logger = UnifiedProgressConsoleLogger(options.verbosity, stages) log.register_logger(logger) # check the output directory. if options.action != 'text': if os.path.exists(options.target): if not os.path.isdir(options.target): return log.error("%s is not a directory" % options.target) # Set the default docformat from epydoc import docstringparser docstringparser.DEFAULT_DOCFORMAT = options.docformat # Set the dot path if options.dotpath: from epydoc import dotgraph dotgraph.DOT_PATH = options.dotpath # Build docs for the named values. from epydoc.docbuilder import build_doc_index docindex = build_doc_index(names, options.introspect, options.parse, add_submodules=(options.action != 'text')) if docindex is None: return # docbuilder already logged an error. # Load profile information, if it was given. if options.pstat_files: try: profile_stats = pstats.Stats(options.pstat_files[0]) for filename in options.pstat_files[1:]: profile_stats.add(filename) except KeyboardInterrupt: raise except Exception, e: log.error("Error reading pstat file: %s" % e) profile_stats = None if profile_stats is not None: docindex.read_profiling_info(profile_stats)