當前位置: 首頁>>代碼示例>>Python>>正文


Python builtins.set方法代碼示例

本文整理匯總了Python中builtins.set方法的典型用法代碼示例。如果您正苦於以下問題:Python builtins.set方法的具體用法?Python builtins.set怎麽用?Python builtins.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在builtins的用法示例。


在下文中一共展示了builtins.set方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_active_graph

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import set [as 別名]
def get_active_graph(graph=None):
        """
        Obtain the currently active graph instance by returning the explicitly given graph or using
        the default graph.

        Parameters
        ----------
        graph : Graph or None
            Graph to return or `None` to use the default graph.

        Raises
        ------
        ValueError
            If no `Graph` instance can be obtained.
        """
        graph = graph or Graph._globals.default_graph
        if not graph:
            raise ValueError("`graph` must be given explicitly or a default graph must be set")
        return graph 
開發者ID:spotify,項目名稱:pythonflow,代碼行數:21,代碼來源:core.py

示例2: openscope

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import set [as 別名]
def openscope(self, customlocals=None):
        '''Opens a new (embedded) scope.

        Args:
            customlocals (dict): By default, the locals of the embedding scope
                are visible in the new one. When this is not the desired
                behaviour a dictionary of customized locals can be passed,
                and those locals will become the only visible ones.
        '''
        self._locals_stack.append(self._locals)
        self._globalrefs_stack.append(self._globalrefs)
        if customlocals is not None:
            self._locals = customlocals.copy()
        elif self._locals is not None:
            self._locals = self._locals.copy()
        else:
            self._locals = {}
        self._globalrefs = set()
        self._scope = self._globals.copy()
        self._scope.update(self._locals) 
開發者ID:aradi,項目名稱:fypp,代碼行數:22,代碼來源:fypp.py

示例3: __init__

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import set [as 別名]
def __init__(self, global_context, raw_msg):
        """Parse the message, extracts and decode all headers and all
        text parts.
        """
        self.missing_boundary_header = False
        self.missing_header_body_separator = False
        super(Message, self).__init__(global_context)
        self.raw_msg = self.translate_line_breaks(raw_msg)
        self.msg = email.message_from_string(self.raw_msg)
        self.headers = _Headers()
        self.raw_headers = _Headers()
        self.addr_headers = _Headers()
        self.name_headers = _Headers()
        self.mime_headers = _Headers()
        self.received_headers = list()
        self.raw_mime_headers = _Headers()
        self.header_ips = _Headers()
        self.text = ""
        self.raw_text = ""
        self.uri_list = set()
        self.score = 0
        self.rules_checked = dict()
        self.interpolate_data = dict()
        self.rules_descriptions = dict()
        self.plugin_tags = dict()
        # Data
        self.sender_address = ""
        self.hostname_with_ip = list()
        self.internal_relays = []
        self.external_relays = []
        self.last_internal_relay_index = 0
        self.last_trusted_relay_index = 0
        self.trusted_relays = []
        self.untrusted_relays = []
        self._parse_message()
        self._hook_parsed_metadata() 
開發者ID:SpamExperts,項目名稱:OrangeAssassin,代碼行數:38,代碼來源:message.py

示例4: handle_set

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import set [as 別名]
def handle_set(self, span, name, expr):
        '''Called when parser encounters a set directive.

        It is a dummy method and should be overridden for actual use.

        Args:
            span (tuple of int): Start and end line of the directive.
            name (str): Name of the variable.
            expr (str): String representation of the expression to be assigned
                to the variable.
        '''
        self._log_event('set', span, name=name, expression=expr) 
開發者ID:aradi,項目名稱:fypp,代碼行數:14,代碼來源:fypp.py

示例5: _render

# 需要導入模塊: import builtins [as 別名]
# 或者: from builtins import set [as 別名]
def _render(self, tree):
        output = []
        eval_inds = []
        eval_pos = []
        for node in tree:
            cmd = node[0]
            if cmd == 'txt':
                output.append(node[3])
            elif cmd == 'if':
                out, ieval, peval = self._get_conditional_content(*node[1:5])
                eval_inds += _shiftinds(ieval, len(output))
                eval_pos += peval
                output += out
            elif cmd == 'eval':
                out, ieval, peval = self._get_eval(*node[1:4])
                eval_inds += _shiftinds(ieval, len(output))
                eval_pos += peval
                output += out
            elif cmd == 'def':
                result = self._define_macro(*node[1:6])
                output.append(result)
            elif cmd == 'set':
                result = self._define_variable(*node[1:5])
                output.append(result)
            elif cmd == 'del':
                self._delete_variable(*node[1:4])
            elif cmd == 'for':
                out, ieval, peval = self._get_iterated_content(*node[1:6])
                eval_inds += _shiftinds(ieval, len(output))
                eval_pos += peval
                output += out
            elif cmd == 'call' or cmd == 'block':
                out, ieval, peval = self._get_called_content(*node[1:7])
                eval_inds += _shiftinds(ieval, len(output))
                eval_pos += peval
                output += out
            elif cmd == 'include':
                out, ieval, peval = self._get_included_content(*node[1:5])
                eval_inds += _shiftinds(ieval, len(output))
                eval_pos += peval
                output += out
            elif cmd == 'comment':
                output.append(self._get_comment(*node[1:3]))
            elif cmd == 'mute':
                output.append(self._get_muted_content(*node[1:4]))
            elif cmd == 'stop':
                self._handle_stop(*node[1:4])
            elif cmd == 'assert':
                result = self._handle_assert(*node[1:4])
                output.append(result)
            elif cmd == 'global':
                self._add_global(*node[1:4])
            else:
                msg = "internal error: unknown command '{0}'".format(cmd)
                raise FyppFatalError(msg)
        return output, eval_inds, eval_pos 
開發者ID:aradi,項目名稱:fypp,代碼行數:58,代碼來源:fypp.py


注:本文中的builtins.set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。