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


Python builtins.list方法代碼示例

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


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

示例1: get_all

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def get_all(self, name, failobj=None):
        """Return a list of all the values for the named field.

        These will be sorted in the order they appeared in the original
        message, and may contain duplicates.  Any fields deleted and
        re-inserted are always appended to the header list.

        If no such fields exist, failobj is returned (defaults to None).
        """
        values = []
        name = name.lower()
        for k, v in self._headers:
            if k.lower() == name:
                values.append(self.policy.header_fetch_parse(k, v))
        if not values:
            return failobj
        return values 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:19,代碼來源:message.py

示例2: get_params

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def get_params(self, failobj=None, header='content-type', unquote=True):
        """Return the message's Content-Type parameters, as a list.

        The elements of the returned list are 2-tuples of key/value pairs, as
        split on the `=' sign.  The left hand side of the `=' is the key,
        while the right hand side is the value.  If there is no `=' sign in
        the parameter the value is the empty string.  The value is as
        described in the get_param() method.

        Optional failobj is the object to return if there is no Content-Type
        header.  Optional header is the header to search instead of
        Content-Type.  If unquote is True, the value is unquoted.
        """
        missing = object()
        params = self._get_params_preserve(missing, header)
        if params is missing:
            return failobj
        if unquote:
            return [(k, _unquotevalue(v)) for k, v in params]
        else:
            return params 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:23,代碼來源:message.py

示例3: get_charsets

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def get_charsets(self, failobj=None):
        """Return a list containing the charset(s) used in this message.

        The returned list of items describes the Content-Type headers'
        charset parameter for this message and all the subparts in its
        payload.

        Each item will either be a string (the value of the charset parameter
        in the Content-Type header of that part) or the value of the
        'failobj' parameter (defaults to None), if the part does not have a
        main MIME type of "text", or the charset is not defined.

        The list will contain one string for each part of the message, plus
        one for the container message (i.e. self), so that a non-multipart
        message will still return a list of length 1.
        """
        return [part.get_content_charset(failobj) for part in self.walk()]

    # I.e. def walk(self): ... 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:21,代碼來源:message.py

示例4: _pp

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def _pp(self, indent=''):
        yield '{}{}/{}('.format(
            indent,
            self.__class__.__name__,
            self.token_type)
        for token in self:
            if not hasattr(token, '_pp'):
                yield (indent + '    !! invalid element in token '
                                        'list: {!r}'.format(token))
            else:
                for line in token._pp(indent+'    '):
                    yield line
        if self.defects:
            extra = ' Defects: {}'.format(self.defects)
        else:
            extra = ''
        yield '{}){}'.format(indent, extra) 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:19,代碼來源:_header_value_parser.py

示例5: _fold

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def _fold(self, folded):
        folded.append(str(self.pop(0)))
        folded.lastlen = len(folded.current[0])
        # The first line of the header is different from all others: we don't
        # want to start a new object on a new line if it has any fold points in
        # it that would allow part of it to be on the first header line.
        # Further, if the first fold point would fit on the new line, we want
        # to do that, but if it doesn't we want to put it on the first line.
        # Folded supports this via the stickyspace attribute.  If this
        # attribute is not None, it does the special handling.
        folded.stickyspace = str(self.pop(0)) if self[0].token_type == 'cfws' else ''
        rest = self.pop(0)
        if self:
            raise ValueError("Malformed Header token list")
        rest._fold(folded)


#
# Terminal classes and instances
# 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:22,代碼來源:_header_value_parser.py

示例6: get_qp_ctext

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def get_qp_ctext(value):
    """ctext = <printable ascii except \ ( )>

    This is not the RFC ctext, since we are handling nested comments in comment
    and unquoting quoted-pairs here.  We allow anything except the '()'
    characters, but if we find any ASCII other than the RFC defined printable
    ASCII an NonPrintableDefect is added to the token's defects list.  Since
    quoted pairs are converted to their unquoted values, what is returned is
    a 'ptext' token.  In this case it is a WhiteSpaceTerminal, so it's value
    is ' '.

    """
    ptext, value, _ = _get_ptext_to_endchars(value, '()')
    ptext = WhiteSpaceTerminal(ptext, 'ptext')
    _validate_xtext(ptext)
    return ptext, value 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:18,代碼來源:_header_value_parser.py

示例7: get_ttext

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def get_ttext(value):
    """ttext = <matches _ttext_matcher>

    We allow any non-TOKEN_ENDS in ttext, but add defects to the token's
    defects list if we find non-ttext characters.  We also register defects for
    *any* non-printables even though the RFC doesn't exclude all of them,
    because we follow the spirit of RFC 5322.

    """
    m = _non_token_end_matcher(value)
    if not m:
        raise errors.HeaderParseError(
            "expected ttext but found '{}'".format(value))
    ttext = m.group()
    value = value[len(ttext):]
    ttext = ValueTerminal(ttext, 'ttext')
    _validate_xtext(ttext)
    return ttext, value 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:20,代碼來源:_header_value_parser.py

示例8: get_attrtext

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def get_attrtext(value):
    """attrtext = 1*(any non-ATTRIBUTE_ENDS character)

    We allow any non-ATTRIBUTE_ENDS in attrtext, but add defects to the
    token's defects list if we find non-attrtext characters.  We also register
    defects for *any* non-printables even though the RFC doesn't exclude all of
    them, because we follow the spirit of RFC 5322.

    """
    m = _non_attribute_end_matcher(value)
    if not m:
        raise errors.HeaderParseError(
            "expected attrtext but found {!r}".format(value))
    attrtext = m.group()
    value = value[len(attrtext):]
    attrtext = ValueTerminal(attrtext, 'attrtext')
    _validate_xtext(attrtext)
    return attrtext, value 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:20,代碼來源:_header_value_parser.py

示例9: __init__

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def __init__(self, policy=compat32):
        self.policy = policy
        self._headers = list()
        self._unixfrom = None
        self._payload = None
        self._charset = None
        # Defaults for multipart messages
        self.preamble = self.epilogue = None
        self.defects = []
        # Default content type
        self._default_type = 'text/plain' 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:13,代碼來源:message.py

示例10: is_multipart

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def is_multipart(self):
        """Return True if the message consists of multiple parts."""
        return isinstance(self._payload, list)

    #
    # Unix From_ line
    # 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:9,代碼來源:message.py

示例11: attach

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def attach(self, payload):
        """Add the given payload to the current payload.

        The current payload will always be a list of objects after this method
        is called.  If you want to set the payload to a scalar object, use
        set_payload() instead.
        """
        if self._payload is None:
            self._payload = [payload]
        else:
            self._payload.append(payload) 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:13,代碼來源:message.py

示例12: __delitem__

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def __delitem__(self, name):
        """Delete all occurrences of a header, if present.

        Does not raise an exception if the header is missing.
        """
        name = name.lower()
        newheaders = list()
        for k, v in self._headers:
            if k.lower() != name:
                newheaders.append((k, v))
        self._headers = newheaders 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:13,代碼來源:message.py

示例13: keys

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def keys(self):
        """Return a list of all the message's header field names.

        These will be sorted in the order they appeared in the original
        message, or were added to the message, and may contain duplicates.
        Any fields deleted and re-inserted are always appended to the header
        list.
        """
        return [k for k, v in self._headers] 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:11,代碼來源:message.py

示例14: items

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def items(self):
        """Get all the message's header fields and values.

        These will be sorted in the order they appeared in the original
        message, or were added to the message, and may contain duplicates.
        Any fields deleted and re-inserted are always appended to the header
        list.
        """
        return [(k, self.policy.header_fetch_parse(k, v))
                for k, v in self._headers] 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:12,代碼來源:message.py

示例15: __init__

# 需要導入模塊: from future import builtins [as 別名]
# 或者: from future.builtins import list [as 別名]
def __init__(self, maxlen, policy):
        self.maxlen = maxlen
        self.policy = policy
        self.lastlen = 0
        self.stickyspace = None
        self.firstline = True
        self.done = []
        self.current = list()    # uses l.clear() 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:10,代碼來源:_header_value_parser.py


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