本文整理汇总了Python中types.ModuleType.__doc__方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleType.__doc__方法的具体用法?Python ModuleType.__doc__怎么用?Python ModuleType.__doc__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类types.ModuleType
的用法示例。
在下文中一共展示了ModuleType.__doc__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __doc__ [as 别名]
def __init__(self, env, libs=None):
self.destroyed = False
libs = libs or ['prelude']
for lib in libs:
if 'darwin' in sys.platform:
prelude = join(dirname(realpath(__file__)), lib + '.dylib')
elif 'linux' in sys.platform:
prelude = join(dirname(realpath(__file__)), lib+ '.so')
else:
raise NotImplementedError
# XXX: yeah, don't do this
ctypes._dlopen(prelude, ctypes.RTLD_GLOBAL)
cgen = env['cgen']
self.__namespace = cgen.globals
self.__llmodule = cgen.module
if not detect_avx_support():
tc = le.TargetMachine.new(features='-avx', cm=le.CM_JITDEFAULT)
else:
tc = le.TargetMachine.new(features='', cm=le.CM_JITDEFAULT)
eb = le.EngineBuilder.new(self.__llmodule)
self.__engine = eb.create(tc)
#self.__engine.run_function(cgen.globals['__module'], [])
mod = ModuleType('blir_wrapper')
wrap_llvm_module(cgen.module, self.__engine, mod)
mod.__doc__ = 'Compiled LLVM wrapper module'
self.__mod = mod
示例2: make_nameko_helper
# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __doc__ [as 别名]
def make_nameko_helper(config):
"""Create a fake module that provides some convenient access to nameko
standalone functionality for interactive shell usage.
"""
module = ModuleType('nameko')
module.__doc__ = """Nameko shell helper for making rpc calls and dispatching
events.
Usage:
>>> n.rpc.service.method()
"reply"
>>> n.dispatch_event('service', 'event_type', 'event_data')
"""
proxy = ClusterRpcProxy(config)
module.rpc = proxy.start()
module.dispatch_event = event_dispatcher(config)
module.config = config
module.disconnect = proxy.stop
return module
示例3: MetaData
# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __doc__ [as 别名]
metadata = MetaData(bind=engine)
session = scoped_session(lambda: create_session(engine,
autoflush=True, transactional=True))
#: create a fake module for easy access to database session methods
db = ModuleType('db')
key = value = mod = None
for mod in sqlalchemy, orm:
for key, value in mod.__dict__.iteritems():
if key in mod.__all__:
setattr(db, key, value)
del key, mod, value
db.__doc__ = __doc__
for name in 'delete', 'save', 'flush', 'execute', 'begin', 'query', \
'commit', 'rollback', 'clear', 'refresh', 'expire':
setattr(db, name, getattr(session, name))
db.session = session
recipients_table = db.Table('recipients', metadata,
db.Column('id', db.Integer, primary_key=True),
db.Column('name', db.String(100), nullable=False),
db.Column('mail', db.String(100), nullable=False),
db.Column('active', db.Boolean, nullable=False),
db.Column('comment', db.String(100), nullable=True),
)
示例4: join
# 需要导入模块: from types import ModuleType [as 别名]
# 或者: from types.ModuleType import __doc__ [as 别名]
from __future__ import with_statement
from os.path import join, dirname, abspath
import re
from types import ModuleType
from nms.utils.local import LocalProxy, Local, LocalManager
main_path = join(abspath(dirname(__file__)), '..')
#: local objects
_local = Local()
_local_manager = LocalManager([_local])
#: fake module for context internals
ctx = ModuleType('ctx')
ctx.__doc__ = 'module that holds all context locals'
ctx.context = LocalProxy(_local, 'context')
ctx.settings = LocalProxy(_local, 'settings')
ctx.clipboard = LocalProxy(_local, 'clipboard')
ctx.logger = LocalProxy(_local, 'logger')
ctx.theme_environment = LocalProxy(_local, 'theme_environment')
ctx.theme_loader = LocalProxy(_local, 'theme_loader')
def get_copyright():
"""Return the copyright string for the about dialog."""
import nms
return 'Copyright %s' % re.compile(r'^\s+:%s:\s+(.*?)\.$(?m)' % 'copyright') \
.search(nms.__doc__).group(1).strip()