def main(): """ Generate all pydoc documentation files within our "doc" directory. After generation, there will be an index.html file that displays all the modules. """ # Remove the existing documentation files, if any. if os.path.exists(DOC_DIR): shutil.rmtree(DOC_DIR) os.mkdir(DOC_DIR) # Create the new documentation files. filelist = buildFileList(SRC_DIR) + [SRC_DIR] for fName in filelist: f = filenameToDocname(fName) if not glob.glob(DOC_DIR + '/' + fName): pydoc.writedoc(filenameToPackagename(fName)) if glob.glob(fName): cmd = 'mv -f ' + f + ' ' + DOC_DIR + '/' os.system(cmd) else: filelist.remove(fName) # Finally, rename the top-level file to "index.html" so it can be accessed # easily. cmd = 'mv ' + DOC_DIR + '/threetaps.html ' + DOC_DIR + '/index.html' os.system(cmd)
def createPyDocs(self, filename, dir): """Create a HTML module documentation using pydoc.""" try: import pydoc except ImportError: from MiscUtils import pydoc package, module = os.path.split(filename) module = os.path.splitext(module)[0] if package: module = package + '.' + module targetName = '%s/%s.html' % (dir, module) self.printMsg('Creating %s...' % targetName) saveDir = os.getcwd() try: os.chdir(dir) targetName = '../' + targetName stdout = sys.stdout sys.stdout = StringIO() try: pydoc.writedoc(module) except Exception: pass msg = sys.stdout.getvalue() sys.stdout = stdout if msg: self.printMsg(msg) finally: os.chdir(saveDir)
def createPyDocs(self, filename, dir): """Create an HTML module documentation using pydoc.""" import pydoc package, module = os.path.split(filename) module = os.path.splitext(module)[0] if package: module = package.replace('/', '.') + '.' + module targetName = '%s/%s.html' % (dir, module) self.printMsg('Creating %s...' % targetName) saveDir = os.getcwd() os.chdir(dir) try: stdout = sys.stdout sys.stdout = StringIO() try: try: pydoc.writedoc(module) except Exception: pass msg = sys.stdout.getvalue() finally: sys.stdout = stdout finally: os.chdir(saveDir) if msg: self.printMsg(msg)
def get_modulo(name, attrib): modulo = False if len(name.split(".")) == 2: try: mod = __import__(name) modulo = mod.__getattribute__( name.replace("%s." % name.split(".")[0], '')) except: pass elif len(name.split(".")) == 1: try: modulo = __import__(name) except: pass else: pass if modulo: try: clase = getattr(modulo, attrib) archivo = os.path.join(BASEPATH, '%s.html' % attrib) ar = open(archivo, "w") ar.write("") ar.close() pydoc.writedoc(clase) except: sys.exit(0) else: sys.exit(0)
def writedoc(mn): #print mn try: exec("import %s as mod" % mn) except: print "WARNING: can't import %s" % mn raise return if modified(mod): pydoc.writedoc(mod) killnbs(mod) else: print "%s not modified" % mn if not '__init__' in mod.__file__: return #is a package - need to get subpackages d=os.path.split(mod.__file__)[0] dd=os.listdir(d) for fn in dd: fpn=os.path.join(d, fn) wd=False if fn.startswith("_"): pass elif os.path.isfile(fpn) and fn.endswith('.py'): #found a module if not fn in ['test.py', 'testme.py', 'setup.py']: wd=True elif os.path.isdir(fpn): if '__init__.py' in os.listdir(fpn): if not fn=='tools': wd=True if wd: nmn=os.path.splitext(fn)[0] nmn='.'.join([mn, nmn]) writedoc(nmn)
def writedocs(dir, pkgpath=''): """Write out HTML documentation for all modules in a directory tree.""" for importer, modname, ispkg in pkgutil.walk_packages([dir], pkgpath): # Ignore all debug modules if modname[-2:] != '_d': pydoc.writedoc(modname) return
def _GetHTMLDoc(): """ ################################################################# Write HTML documentation for this module. ################################################################# """ import pydoc pydoc.writedoc('geometric')
def _GetHTMLDoc(): """ ################################################################# Write HTML documentation for this module. ################################################################# """ import pydoc pydoc.writedoc('topology')
def _GetHTMLDoc(): """ ################################################################# Write HTML documentation for this module. ################################################################# """ import pydoc pydoc.writedoc('constitution')
def writedocs(dir, pkgpath='', done=None): """Write out HTML documentation for all modules in a directory tree.""" if done is None: done = {} for importer, modname, ispkg in pkgutil.walk_packages([dir], pkgpath): # Ignore all debug modules if modname[-2:] != '_d': pydoc.writedoc(modname) return
def _GetHTMLDoc(): """ ################################################################# Write HTML documentation for this module. ################################################################# """ import pydoc,os name = os.path.basename(__file__).replace('.py', '') pydoc.writedoc(name)
def ver_objeto(self, widget, objeto): os.chdir(DATOS) try: if objeto: pydoc.writedoc(objeto) archivo = os.path.join(DATOS, '%s.html' % (objeto.__name__)) self.descriptor.open(archivo) else: self.descriptor.open('') except: self.descriptor.open('')
def create_pydocs(): print "It's useful to use pydoc to generate docs." pydoc_dir = "pydoc" module = "recipe15_all" __import__(module) if not os.path.exists(pydoc_dir): os.mkdir(pydoc_dir) cur = os.getcwd() os.chdir(pydoc_dir) pydoc.writedoc("recipe15_all") os.chdir(cur)
def autodoc_html_cb(data, flags): import pydoc import os try: path = os.environ["TEMP"] except KeyError: # with os.tmpnam() we get a RuntimeWarning so fall back to path = "/tmp/" os.chdir(path) pydoc.writedoc(dia) dia.message(0, path + os.path.sep + "dia.html saved.")
def autodoc_html_cb (data, flags) : import pydoc import os try : path = os.environ["TEMP"] except KeyError : # with os.tmpnam() we get a RuntimeWarning so fall back to path = "/tmp/" os.chdir(path) pydoc.writedoc(dia) dia.message(0, path + os.path.sep + "dia.html saved.")
def main(): dir = sys.argv[1] lib_list = import_libs(dir) # generate pydoc here print(lib_list) for l in lib_list: try: module = __import__(l) pydoc.writedoc(l) except: pass
def generateDoc(moduleName): """ @param moduleName is the name of the module to document (example: robot) generates the HTML pydoc file for the given module then it moves the file to OUTFOLDER (this is necessary because pydoc does not allow user-defined destination path) """ pydoc.writedoc(moduleName) filename = moduleName+'.html' destination = OUTFOLDER+filename command = "mv %s %s"%(filename, destination) os.system(command)
def main(): dir = sys.argv[1] lib_list = import_libs(dir) # generate pydoc here print lib_list for l in lib_list: try: module = __import__(l) pydoc.writedoc(l) except: pass
def get_modulo(modulo, attrib): #pygi = __import__("gi.repository") #modulo = pygi.module.IntrospectionModule(modulo_name) try: mod = __import__("%s.%s" % ("gi.repository", modulo)) new = mod.importer.modules.get(modulo) clase = getattr(new, attrib) archivo = os.path.join(BASEPATH, '%s.html' % attrib) ar = open(archivo, "w") ar.write("") ar.close() pydoc.writedoc(clase) return os.path.join(BASEPATH, '%s.html' % attrib) except: sys.exit(0)
def _generate_docs(self): # FIXME: this is really hacky olddir = os.getcwd() html_dir = os.path.join('docs', 'html') if not os.path.exists(html_dir): os.makedirs(html_dir) os.chdir(html_dir) writedoc('osc2') os.rename('osc2.html', 'index.html') modules = ('build', 'core', 'httprequest', 'oscargs', 'remote', 'source', 'util', 'util.io', 'util.xml', 'wc', 'wc.base', 'wc.convert', 'wc.package', 'wc.project', 'wc.util') for mod in modules: writedoc('osc2.' + mod) os.chdir(olddir)
def main(): description="Convenience script to generate HTML documentation using pydoc" parser = argparse.ArgumentParser(description=description) parser.add_argument('--out', required=True, metavar="PATH", help="Directory in which to write HTML output files.") parser.add_argument('--recursive', action='store_true', default=False, help="Recursively import documentation for dependencies. If not recursive, zcall documents will contain broken links to standard modules. Recursive mode generates approximately 180 HTML files comprising 6 MB of data.") parser.add_argument('--verbose', action='store_true', default=False, help="Write pydoc information to stdout.") args = vars(parser.parse_args()) recursive = args['recursive'] verbose = args['verbose'] if not verbose: # suppress stdout chatter from pydoc.writedoc sys.stdout = open('/dev/null', 'w') localDir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.abspath(localDir+"/..")) # import from zcall dir zcallDir = os.path.abspath(localDir+"/../zcall") outDir = os.path.abspath(args['out']) if not (os.access(outDir, os.W_OK) and os.path.isdir(outDir)): msg = "ERROR: Output path "+outDir+" is not a writable directory.\n" sys.stderr.write(msg) sys.exit(1) os.chdir(outDir) import zcall pydoc.writedoc(zcall) modules = set() zcall = set() scripts = [] mf = ModuleFinder() for script in os.listdir(zcallDir): if re.search("\.py$", script) and script!="__init__.py": words = re.split("\.", script) words.pop() scriptName = (".".join(words)) # name without .py suffix modules.add("zcall."+scriptName) zcall.add(scriptName) scripts.append(script) if recursive: for script in scripts: mf.run_script(os.path.join(zcallDir, script)) for name, mod in mf.modules.iteritems(): if name not in zcall: modules.add(name) for module in modules: pydoc.writedoc(import_module(module))
def documentModules(moduleNames, exclude=[], destination=".", Path=None): """ Generates pydoc documentation for each module name given and outputs the HTML files into the destination directory. @input moduleNames - a list of names for the modules to document. @input exclude - a list of module and package names that should NOT be documented @input destination - a string indicating the directory path where the documentation HTML should be written. Defaults to "." @input Path - any specific PATH to use? @return - a list of the filenames of all html files which were written. """ # update the path variable with any special info sys.path.append(Path) writtenFiles = [] # list for all files that have been written # change to the appropriate directory os.chdir(destination) # loop through all the module names we were given for modName in moduleNames: # filter out any excluded modules for x in exclude: if modName.find(x) != -1: out.log("Skipping module " + modName) modName = "" # filter out bogus module names if modName == "": continue # import the module and write out the documentation for it. try: M = importModule(modName, Path=Path) out.log("",nl=False) pydoc.writedoc(M) writtenFiles.append(modName+".html") except ImportError as e: # print error msg and proceed to next object out.log("Could not import module " + modName + " - " + str(e), err=True) continue return writtenFiles
def _generate_docs(self): # FIXME: this is really hacky # Need to work in the modules directory. # Otherwise install with e.g. pip will not work. olddir = os.getcwd() module_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(module_dir) os.chdir(module_dir) html_dir = os.path.join('docs', 'html') if not os.path.exists(html_dir): os.makedirs(html_dir) os.chdir(html_dir) writedoc('osc2') os.rename('osc2.html', 'index.html') modules = ('build', 'core', 'httprequest', 'oscargs', 'remote', 'source', 'util', 'util.io', 'util.xml', 'wc', 'wc.base', 'wc.convert', 'wc.package', 'wc.project', 'wc.util') for mod in modules: writedoc('osc2.' + mod) os.chdir(olddir)
def myWritedocs(dir, pkgpath='', done=None): """Write out HTML documentation for all modules in a directory tree.""" if done is None: done = {} for file in os.listdir(dir): path = os.path.join(dir, file) if ispackage(path): writedocs(path, pkgpath + file + '.', done) elif os.path.isfile(path): modname = inspect.getmodulename(path) if modname: if modname == '__init__': modname = pkgpath[:-1] # remove trailing period else: modname = pkgpath + modname if modname not in done: done[modname] = 1 try: writedoc(modname) except: print 'failed to document', modname
def refresh_api_doc(): """Update and sanitize the API doc.""" pydoc.writedoc(remuco) patt_module_link = r'href="[^"]+\.html' repl_module_link = 'href="api.html' patt_file_link = r'<a href="[^"]+">index</a><br><a href="[^"]+">[^<]+</a>' repl_file_link = "" with open("remuco.html", "r") as api: content = api.read() os.remove("remuco.html") content = re.sub(patt_module_link, repl_module_link, content) content = re.sub(patt_file_link, repl_file_link, content) with open(cp.get("paths", "api"), "w") as api: api.write(content)
def generate_docs(): """ Generate all pydoc documentation files within a docs directory under ./topographica according to the constant DOCS. After generation, there is an index.html that displays all the modules. Note that if the documentation is being changed, it may be necessary to call 'make cleandocs' to force a regeneration of documentation. (We don't want to regenerate all the documentation each time a source file is changed.) """ # os.system('rm -rf ' + DOCS + '/*') # Force regeneration filelist = _file_list(TOPO) + [TOPO] for i in filelist: f = filename_to_docname(i) if not glob.glob(DOCS + '/' + f): pydoc.writedoc(filename_to_packagename(i)) if glob.glob(f): cline = 'mv -f ' + f + ' ' + DOCS + '/' os.system(cline) else: filelist.remove(i)
def create_pydocs(): """ create_pydocs() - generate pydoc inside a directory pydocs in the current directory :return: None """ pydoc_dir = 'pydoc' module = os.path.basename( __file__ )[:-3] # Get the current filename and take off the '.py' extension # module = os.path.basename(__file__) # Get the current filename print os.path.basename(__file__) # exit(1) __import__(module) if not os.path.exists(pydoc_dir): os.mkdir(pydoc_dir) # --- # Write out the pydoc of this module to the pydoc/<module>.py file cwd = os.getcwd() os.chdir(pydoc_dir) pydoc.writedoc(module) os.chdir(cwd)
__author__ = 'vasilev_is' import pydoc import os files = [f for f in os.listdir('.') if os.path.isfile(f)] files = [f.replace('.py','') for f in files if 'Fianora' in f and 'Estimator_Decorator' not in f] pydoc.writedoc('Fianora_Derivative') # for f in files: # #pydoc.help(f) # # pydoc.writedoc(f) import shutil #s = [f for f in os.listdir('.') if os.path.isfile(f) and 'html' in f] [print (f) for f in files] # for f in files: # shutil.move (f, 'pydocs/') # #
import os import site site.addsitedir("..") for name in ("pgu", "pgu.html", "pgu.gui", "pgu.gui.basic", "pgu.gui.app", "pgu.gui.area", "pgu.gui.basic", "pgu.gui.button", "pgu.gui.const", "pgu.gui.container", "pgu.gui.deprecated", "pgu.gui.dialog", "pgu.gui.document", "pgu.gui.form", "pgu.gui.group", "pgu.gui.__init__", "pgu.gui.input", "pgu.gui.keysym", "pgu.gui.layout", "pgu.gui.menus", "pgu.gui.misc", "pgu.gui.pguglobals", "pgu.gui.select", "pgu.gui.slider", "pgu.gui.style", "pgu.gui.surface", "pgu.gui.table", "pgu.gui.textarea", "pgu.gui.theme", "pgu.gui.widget", "pgu.algo", "pgu.ani", "pgu.engine", "pgu.fonts", "pgu.hexvid", "pgu.high", "pgu.html", "pgu.__init__", "pgu.isovid", "pgu.layout", "pgu.text", "pgu.tilevid", "pgu.timer", "pgu.vid"): pydoc.writedoc(name) # Write the index file fd = open("index.html", "w") fd.write(""" <html> <head> <meta http-equiv="refresh" content="0;pgu.html"> </head> </html> """) fd.close()
def generateDoc(): # Get the path to the FreeCAD module relative to this directory toolspath = os.path.dirname(__file__) homepath = toolspath + '/../../' homepath = os.path.realpath(homepath) binpath = os.path.join(homepath, 'bin') docpath = os.path.join(homepath, 'doc') modpath = os.path.join(homepath, 'Mod') # Change to the doc directory cwd = os.getcwd() print 'Change to ' + docpath os.chdir(homepath) if os.path.exists('doc') == False: os.mkdir('doc') os.chdir('doc') # Add the bin path to the system path if os.name == 'nt': os.environ['PATH'] = os.environ['PATH'] + ';' + binpath else: os.environ['PATH'] = os.environ['PATH'] + ':' + binpath # Import FreeCAD module sys.path.append(binpath) print 'Write documentation for module \'FreeCAD\'' pydoc.writedoc('FreeCAD') print '' # Module directory ModDirs = dircache.listdir(modpath) # Search for module paths and append them to Python path #for Dir in ModDirs: # if (Dir != '__init__.py'): # sys.path.append( os.path.join(modpath,Dir) ) # Walk through the module paths again and try loading the modules to create HTML files for Dir in ModDirs: dest = os.path.join(modpath, Dir) print 'Write documentation for module \'' + Dir + '\'' if (Dir != '__init__.py'): writedocs(dest) print '' # Now we must create a document and create instances of all Python classes which # cannot be directly created by a module. # Create a ZIP archive from all HTML files print 'Creating ZIP archive \'docs.zip\'...' zip = zipfile.ZipFile('docs.zip', 'w') for file in os.listdir('.'): if not os.path.isdir(file): if file.find('.html') > 0: print ' Adding file ' + file + ' to archive' zip.write(file) print 'done.' zip.close() # Remove all HTML files print 'Cleaning up HTML files...' for file in os.listdir('.'): if not os.path.isdir(file): if file.find('.html') > 0: print ' Removing ' + file os.remove(file) os.chdir(cwd) print 'done.'
from pydoc import writedoc import shutil modules = [ "pyenvi.pyenvi", "pyenvi.exceptions", "pyenvi.pyenvi_run", "test" ] for module in modules: writedoc(module) shutil.move(module+".html","docs/"+module+".html")
Array1DVariable6_string = "\n## Array(6) variables: \n" VectorComponentVariable_string = "\n## Vector (component) variables: \n" Array1DComponentVariable_string = "\n## Array (component) variables: \n" MatrixVariable_string = "\n## Matrix variables: \n" ConstitutuveLawVariable_string = "\n## Constitutive law variables: \n" ConvectionDiffusionSettingsVariable_string = "\n## ConvectionDiffusionSettingsVariable variables: \n" RadiationSettingsVariable_string = "\n## Radiation settings variables: \n" DoubleQuaternionVariable_string = "\n## Quaternion variables: \n" for name in dir(package): if not "__" in name: exec_string = "my_type = type(KratosMultiphysics" + "." + name + ")" exec(exec_string) my_type_string = str(my_type) name_class = "KratosMultiphysics" + "." + name pydoc.writedoc(name_class) html_text = open(name_class + ".html", "r").read() md_text = html2text.html2text(html_text) md_text = md_text.replace("Kratos.html#", "KratosMultiphysics.") if ("Variable" in my_type_string): directory_name = "Variables/" ensure_dir(directory_name) if ("StringVariable" in my_type_string): StringVariable_string += "* [**" + name + "**](" + name_class + ")\n" elif ("BoolVariable" in my_type_string): BoolVariable_string += "* [**" + name + "**](" + name_class + ")\n" elif ("IntegerVariable" in my_type_string): IntegerVariable_string += "* [**" + name + "**](" + name_class + ")\n" elif ("IntegerVectorVariable" in my_type_string): IntegerVectorVariable_string += "* [**" + name + "**](" + name_class + ")\n" elif ("DoubleVariable" in my_type_string):
def create_pydocs(): sys.path.append(os.getcwd() + "/src") import springpython if not os.path.exists("target/docs/pydoc"): os.makedirs("target/docs/pydoc") cur = os.getcwd() os.chdir("target/docs/pydoc") pydoc.writedoc("springpython") pydoc.writedoc("springpython.aop") pydoc.writedoc("springpython.aop.utils") pydoc.writedoc("springpython.config") pydoc.writedoc("springpython.config.decorator") pydoc.writedoc("springpython.container") pydoc.writedoc("springpython.context") pydoc.writedoc("springpython.context.scope") pydoc.writedoc("springpython.database") pydoc.writedoc("springpython.database.core") pydoc.writedoc("springpython.database.factory") pydoc.writedoc("springpython.database.transaction") pydoc.writedoc("springpython.factory") pydoc.writedoc("springpython.remoting") pydoc.writedoc("springpython.remoting.hessian") pydoc.writedoc("springpython.remoting.hessian.hessianlib") pydoc.writedoc("springpython.remoting.pyro") pydoc.writedoc("springpython.remoting.pyro.PyroDaemonHolder") pydoc.writedoc("springpython.security") pydoc.writedoc("springpython.security.cherrypy3") pydoc.writedoc("springpython.security.intercept") pydoc.writedoc("springpython.security.context") pydoc.writedoc("springpython.security.context.SecurityContextHolder") pydoc.writedoc("springpython.security.providers") pydoc.writedoc("springpython.security.providers.dao") pydoc.writedoc("springpython.security.providers.encoding") pydoc.writedoc("springpython.security.providers.Ldap") pydoc.writedoc("springpython.security.providers._Ldap_cpython") pydoc.writedoc("springpython.security.providers._Ldap_jython") pydoc.writedoc("springpython.security.userdetails") pydoc.writedoc("springpython.security.userdetails.dao") pydoc.writedoc("springpython.security.web") top_color = "#7799ee" pkg_color = "#aa55cc" class_color = "#ee77aa" class_highlight = "#ffc8d8" function_color = "#eeaa77" data_color = "#55aa55" for file in os.listdir("."): if "springpython" not in file: continue print "Altering appearance of %s" % file file_input = open(file).read() file_input = re.compile(top_color).sub("GREEN", file_input) file_input = re.compile(pkg_color).sub("GREEN", file_input) file_input = re.compile(class_color).sub("GREEN", file_input) file_input = re.compile(class_highlight).sub("LIGHTGREEN", file_input) file_input = re.compile(function_color).sub("LIGHTGREEN", file_input) file_input = re.compile(data_color).sub("LIGHTGREEN", file_input) file_output = open(file, "w") file_output.write(file_input) file_output.close() os.chdir(cur)
#!/usr/bin/env python import clingo, subprocess, pydoc for m in [clingo, clingo.ast]: pydoc.writedoc(m) subprocess.call(["sed", "-i", "-e", r"s/\<ffc8d8\>/88ff99/g", "-e", r"s/\<ee77aa\>/22bb33/g", "-e", r's/<a href=".">index<\/a>.*<\/font>/<a href=".">\«Potassco<\/a><\/font>/', "-e", r's/<a href="__builtin__.html#object">[^<]*object<\/a>/object/g', "-e", r's/{0}.html#/#/g', "{0}.html".format(m.__name__)])
return DeliciousAPI(user, passwd).posts_delete(url) def rename_tag(user, passwd, oldtag, newtag): return DeliciousAPI(user, passwd).tags_rename(oldtag, newtag) def get_tags(user, passwd): return DeliciousAPI(user, passwd).tags_get() ## ## not API conform functions for delicious def get_userposts(user): return DeliciousNOTAPI().get_posts_by_user(user) def get_tagposts(tag): return DeliciousNOTAPI().get_posts_by_tag(tag) ## ## main if __name__ == "__main__": import pydoc import delicious print "Read delicious.html for more informations about this script" pydoc.writedoc("delicious", 1)
import pydoc import os from sikuli import * # point to Sikuli folder on desktop starting_folder = os.environ['USERPROFILE']+'\\desktop\\Sikuli\\Test_It_All' folder_length = len(starting_folder) + 1 for x in os.walk(starting_folder): if x[0][-7:] == '.sikuli': stripped_folder = x[0][folder_length:] stripped_folder = stripped_folder[:-7] print(stripped_folder) pydoc.writedoc(stripped_folder)
# Namedtuples have public fields and methods with a single leading underscore if name.startswith('_') and hasattr(obj, '_fields'): return True if all is not None: # only document that which the programmer exported in __all__ return name in all else: return not name.startswith('_') """ This script generates a HTML doc from the pypylon installation """ if __name__ == '__main__': import pydoc pydoc.visiblename = visiblename from pypylon import pylon, genicam pydoc.writedoc(pylon) pydoc.writedoc(genicam)
#!/usr/bin/env python import gringo, subprocess, pydoc pydoc.writedoc(gringo) subprocess.call(["sed", "-i", "-e", r"s/\<ffc8d8\>/88ff99/g", "-e", r"s/\<ee77aa\>/22bb33/g", "-e", r's/<a href=".">index<\/a>.*<\/font>/<a href=".">\«Potassco<\/a><\/font>/', "-e", r's/<a href="__builtin__.html#object">[^<]*object<\/a>/object/g', "gringo.html"])
def test_htmlpage(self): # html.page does not choke on unicode with test.test_support.temp_cwd(): with captured_stdout() as output: pydoc.writedoc(self.Q) self.assertEqual(output.getvalue(), 'wrote Q.html\n')
assert not os.path.exists('test'+os.sep+'top_secret_xxx_file.txt') assert errored cleanup() # check volume number cleanup() rarc1 = UnRAR2.RarFile('tests/test_volumes.part1.rar') assert rarc1.get_volume() == 0 rarc2 = UnRAR2.RarFile('tests/test_volumes.part2.rar') assert rarc2.get_volume() == 1 cleanup() rarc1 = UnRAR2.RarFile('tests/test_volumes_old.rar') assert rarc1.get_volume() == 0 rarc2 = UnRAR2.RarFile('tests/test_volumes_old.r00') assert rarc2.get_volume() == 1 cleanup() # make sure docstring examples are working import doctest doctest.testmod(UnRAR2) # update documentation import pydoc pydoc.writedoc(UnRAR2) # cleanup try: os.remove('__init__.pyc') except: pass
print "Removed annotations from z3_api.h." try: if subprocess.call(['doxygen', 'z3api.dox']) != 0: print "ERROR: doxygen returned nonzero return code" exit(1) except: print "ERROR: failed to execute 'doxygen', make sure doxygen (http://www.doxygen.org) is available in your system." exit(1) print "Generated C and .NET API documentation." os.remove('tmp/z3_api.h') os.remove('tmp/z3_algebraic.h') os.remove('tmp/z3_polynomial.h') os.remove('tmp/z3_rcf.h') os.remove('tmp/z3_interp.h') print "Removed temporary file z3_api.h." os.remove('tmp/website.dox') print "Removed temporary file website.dox" os.remove('tmp/z3py.py') print "Removed temporary file z3py.py" os.removedirs('tmp') print "Removed temporary directory tmp." sys.path.append('../src/api/python') pydoc.writedoc('z3') shutil.move('z3.html', 'api/html/z3.html') print "Generated Python documentation." print "Documentation was successfully generated at subdirectory './api/html'." except: print "ERROR: failed to generate documentation" exit(1)
import os import sys sys.executable='jython' import pydoc import hecutils, interpolate, vdiff, vdisplay, vdss, vmath, vtidefile, vtimeseries, vutils if __name__=='__main__': print 'Current working directory: ', os.getcwd() os.chdir('..\\doc\\pydocs') print 'Now working in directory: ', os.getcwd() modules = [hecutils, interpolate, vdiff, vdisplay, vdss, vmath, vtidefile, vtimeseries, vutils] for m in modules: pydoc.writedoc(m) #
############################################################################### # libbrlapi - A library providing access to braille terminals for applications. # # Copyright (C) 2005-2016 by # Alexis Robert <*****@*****.**> # Samuel Thibault <*****@*****.**> # # libbrlapi comes with ABSOLUTELY NO WARRANTY. # # This is free software, placed under the terms of the # GNU Lesser General Public License, as published by the Free Software # Foundation; either version 2.1 of the License, or (at your option) any # later version. Please see the file LICENSE-LGPL for details. # # Web Page: http://brltty.com/ # # This software is maintained by Dave Mielke <*****@*****.**>. ############################################################################### import sys from distutils.util import get_platform import pydoc if __name__ == "__main__": sys.path.insert(1, 'build/lib.' + get_platform() + '-' + sys.version[0:3]) pydoc.writedoc('brlapi')
def pydoc_recursive(module): pydoc.writedoc(module) for submod in module.__dict__.values(): if isinstance(submod, types.ModuleType) and submod.__name__.startswith( module.__name__): pydoc_recursive(submod)
if world.inFontLab: print "- generating documentation for FontLab specific modules" print "- make sure to run this script in the IDE as well!" # this is a list of FontLab specific modules that need to be documented import robofab.objects.objectsFL import robofab.tools.toolsFL import robofab.pens.flPen import robofab.tools.otFeatures mods = [ robofab.objects.objectsFL, robofab.tools.toolsFL, robofab.pens.flPen, robofab.tools.otFeatures, ] for m in mods: writedoc(m) else: print "- generating documentation for generic modules" print "- make sure to run this script in FontLab as well (if you want that documented)." myWritedocs(robofabDir) os.chdir(currentDir) # fonttools bits = robofabDir.split(os.sep)[:-1] + fontToolsDocoDir htmlDir = os.sep.join(bits) try: os.makedirs(htmlDir) except OSError: pass os.chdir(htmlDir)