當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。