当前位置: 首页>>代码示例>>Python>>正文


Python compat.partial方法代码示例

本文整理汇总了Python中mako.compat.partial方法的典型用法代码示例。如果您正苦于以下问题:Python compat.partial方法的具体用法?Python compat.partial怎么用?Python compat.partial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mako.compat的用法示例。


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

示例1: __init__

# 需要导入模块: from mako import compat [as 别名]
# 或者: from mako.compat import partial [as 别名]
def __init__(self, buffer, **data):
        self._buffer_stack = [buffer]

        self._data = data

        self._kwargs = data.copy()
        self._with_template = None
        self._outputting_as_unicode = None
        self.namespaces = {}

        # "capture" function which proxies to the
        # generic "capture" function
        self._data['capture'] = compat.partial(capture, self)

        # "caller" stack used by def calls with content
        self.caller_stack = self._data['caller'] = CallerStack() 
开发者ID:jpush,项目名称:jbox,代码行数:18,代码来源:runtime.py

示例2: _get_star

# 需要导入模块: from mako import compat [as 别名]
# 或者: from mako.compat import partial [as 别名]
def _get_star(self):
        if self.callables:
            for key in self.callables:
                yield (key, self.callables[key])

        def get(key):
            callable_ = self.template._get_def_callable(key)
            return compat.partial(callable_, self.context)
        for k in self.template.module._exports:
            yield (k, get(k)) 
开发者ID:jpush,项目名称:jbox,代码行数:12,代码来源:runtime.py

示例3: __getattr__

# 需要导入模块: from mako import compat [as 别名]
# 或者: from mako.compat import partial [as 别名]
def __getattr__(self, key):
        if key in self.callables:
            val = self.callables[key]
        elif self.template.has_def(key):
            callable_ = self.template._get_def_callable(key)
            val = compat.partial(callable_, self.context)
        elif self.inherits:
            val = getattr(self.inherits, key)

        else:
            raise AttributeError(
                "Namespace '%s' has no member '%s'" %
                (self.name, key))
        setattr(self, key, val)
        return val 
开发者ID:jpush,项目名称:jbox,代码行数:17,代码来源:runtime.py

示例4: _get_star

# 需要导入模块: from mako import compat [as 别名]
# 或者: from mako.compat import partial [as 别名]
def _get_star(self):
        if self.callables:
            for key in self.callables:
                yield (key, self.callables[key])
        def get(key):
            callable_ = self.template._get_def_callable(key)
            return compat.partial(callable_, self.context)
        for k in self.template.module._exports:
            yield (k, get(k)) 
开发者ID:fboender,项目名称:ansible-cmdb,代码行数:11,代码来源:runtime.py

示例5: __getattr__

# 需要导入模块: from mako import compat [as 别名]
# 或者: from mako.compat import partial [as 别名]
def __getattr__(self, key):
        if key in self.callables:
            val = self.callables[key]
        elif self.template.has_def(key):
            callable_ = self.template._get_def_callable(key)
            val = compat.partial(callable_, self.context)
        elif self.inherits:
            val = getattr(self.inherits, key)

        else:
            raise AttributeError(
                    "Namespace '%s' has no member '%s'" %
                    (self.name, key))
        setattr(self, key, val)
        return val 
开发者ID:fboender,项目名称:ansible-cmdb,代码行数:17,代码来源:runtime.py


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