• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pydoc.writedoc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pydoc.writedoc函数的典型用法代码示例。如果您正苦于以下问题:Python writedoc函数的具体用法?Python writedoc怎么用?Python writedoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了writedoc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: createPyDocs

 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)
开发者ID:Cito,项目名称:w4py-olde-docs,代码行数:26,代码来源:install.py


示例2: writedoc

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)
开发者ID:gic888,项目名称:MIEN,代码行数:35,代码来源:makedocs.py


示例3: createPyDocs

	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)
开发者ID:akkmzack,项目名称:RIOS-8.5,代码行数:28,代码来源:install.py


示例4: main

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)
开发者ID:3taps,项目名称:3taps-Python-Client,代码行数:30,代码来源:generateDocs.py


示例5: get_modulo

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)
开发者ID:fdanesse,项目名称:JAMediaSuite,代码行数:31,代码来源:Make_doc.py


示例6: writedocs

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
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:8,代码来源:pythondoc.py


示例7: _GetHTMLDoc

def _GetHTMLDoc():
    """
    #################################################################
    Write HTML documentation for this module.
    #################################################################
    """
    import pydoc
    pydoc.writedoc('topology')    
开发者ID:gadsbyfly,项目名称:PyBioMed,代码行数:8,代码来源:topology.py


示例8: create_pydocs

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)
开发者ID:jinpeng,项目名称:PythonTestingCookbook,代码行数:11,代码来源:recipe15.py


示例9: autodoc_html_cb

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.")
开发者ID:AmiGanguli,项目名称:dia,代码行数:11,代码来源:pydiadoc.py


示例10: generateDoc

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)
开发者ID:CSSDePaul,项目名称:Computerized-Robot-Arena-Program,代码行数:12,代码来源:documentationGenerator.py


示例11: main

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
开发者ID:ska-sa,项目名称:meqtrees-timba,代码行数:12,代码来源:generate-docs.py


示例12: _generate_docs

 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)
开发者ID:nijel,项目名称:osc2,代码行数:15,代码来源:setup.py


示例13: main

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))
开发者ID:wtsi-npg,项目名称:zCall,代码行数:46,代码来源:createDocs.py


示例14: documentModules

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
开发者ID:benguillet,项目名称:dcor_frontend,代码行数:45,代码来源:doc.py


示例15: _generate_docs

 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)
开发者ID:openSUSE,项目名称:osc2,代码行数:20,代码来源:setup.py


示例16: myWritedocs

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
开发者ID:adrientetar,项目名称:robofab,代码行数:20,代码来源:makeDocumentation.py


示例17: get_modulo

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)
开发者ID:fdanesse,项目名称:Historico,代码行数:20,代码来源:Make_gi_doc.py


示例18: refresh_api_doc

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)
开发者ID:cpatulea,项目名称:remuco,代码行数:20,代码来源:release.py


示例19: generate_docs

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)
开发者ID:AnthonyAlers,项目名称:topographica,代码行数:21,代码来源:gendocs.py


示例20:

__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/')
#
#
开发者ID:reinerwaldmann,项目名称:PHDLinearization,代码行数:24,代码来源:Fianora_Estimator_Decorators.py



注:本文中的pydoc.writedoc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python parser.Parser类代码示例发布时间:2022-05-25
下一篇:
Python pydoc.synopsis函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap