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


Python errors.NonPrintableDefect方法代碼示例

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


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

示例1: get_qp_ctext

# 需要導入模塊: from future.backports.email import errors [as 別名]
# 或者: from future.backports.email.errors import NonPrintableDefect [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

示例2: get_dtext

# 需要導入模塊: from future.backports.email import errors [as 別名]
# 或者: from future.backports.email.errors import NonPrintableDefect [as 別名]
def get_dtext(value):
    """ dtext = <printable ascii except \ [ ]> / obs-dtext
        obs-dtext = obs-NO-WS-CTL / quoted-pair

    We allow anything except the excluded characters, but if we find any
    ASCII other than the RFC defined printable ASCII an NonPrintableDefect is
    added to the token's defects list.  Quoted pairs are converted to their
    unquoted values, so what is returned is a ptext token, in this case a
    ValueTerminal.  If there were quoted-printables, an ObsoleteHeaderDefect is
    added to the returned token's defect list.

    """
    ptext, value, had_qp = _get_ptext_to_endchars(value, '[]')
    ptext = ValueTerminal(ptext, 'ptext')
    if had_qp:
        ptext.defects.append(errors.ObsoleteHeaderDefect(
            "quoted printable found in domain-literal"))
    _validate_xtext(ptext)
    return ptext, value 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:21,代碼來源:_header_value_parser.py

示例3: _validate_xtext

# 需要導入模塊: from future.backports.email import errors [as 別名]
# 或者: from future.backports.email.errors import NonPrintableDefect [as 別名]
def _validate_xtext(xtext):
    """If input token contains ASCII non-printables, register a defect."""

    non_printables = _non_printable_finder(xtext)
    if non_printables:
        xtext.defects.append(errors.NonPrintableDefect(non_printables))
    if utils._has_surrogates(xtext):
        xtext.defects.append(errors.UndecodableBytesDefect(
            "Non-ASCII characters found in header token")) 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:11,代碼來源:_header_value_parser.py

示例4: get_qcontent

# 需要導入模塊: from future.backports.email import errors [as 別名]
# 或者: from future.backports.email.errors import NonPrintableDefect [as 別名]
def get_qcontent(value):
    """qcontent = qtext / quoted-pair

    We allow anything except the DQUOTE character, but if we find any ASCII
    other than the RFC defined printable ASCII an NonPrintableDefect is
    added to the token's defects list.  Any quoted pairs are converted to their
    unquoted values, so what is returned is a 'ptext' token.  In this case it
    is a ValueTerminal.

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


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