(lines)
return fmt
Parse a list of string representing the response to LIST OVERVIEW.FMT
    and return a list of header/metadata names.
    Raises NNTPDataError if the response is not compliant
    (cf. RFC 3977, section 8.4).
Parse a list of string representing the response to LIST OVERVIEW.FMT
    and return a list of header/metadata names.
    Raises NNTPDataError if the response is not compliant
    (cf. RFC 3977, section 8.4).
Parse a list of string representing the response to LIST OVERVIEW . FMT and return a list of header / metadata names . Raises NNTPDataError if the response is not compliant ( cf . RFC 3977 section 8 . 4 ) .
def _parse_overview_fmt(lines):
    """Parse a list of string representing the response to LIST OVERVIEW.FMT
    and return a list of header/metadata names.
    Raises NNTPDataError if the response is not compliant
    (cf. RFC 3977, section 8.4)."""
    fmt = []
    for line in lines:
        if line[0] == ':':
            # Metadata name (e.g. ":bytes")
            name, _, suffix = line[1:].partition(':')
            name = ':' + name
        else:
            # Header name (e.g. "Subject:" or "Xref:full")
            name, _, suffix = line.partition(':')
        name = name.lower()
        name = _OVERVIEW_FMT_ALTERNATIVES.get(name, name)
        # Should we do something with the suffix?
        fmt.append(name)
    defaults = _DEFAULT_OVERVIEW_FMT
    if len(fmt) < len(defaults):
        raise NNTPDataError("LIST OVERVIEW.FMT response too short")
    if fmt[:len(defaults)] != defaults:
        raise NNTPDataError("LIST OVERVIEW.FMT redefines default fields")
    return fmt
def _parse_overview_fmt ( lines ) : fmt = [ ] for line in lines : if line [ 0 ] == ':' : # Metadata name (e.g. ":bytes") name , _ , suffix = line [ 1 : ] . partition ( ':' ) name = ':' + name else : # Header name (e.g. "Subject:" or "Xref:full") name , _ , suffix = line . partition ( ':' ) name = name . lower ( ) name = _OVERVIEW_FMT_ALTERNATIVES . get ( name , name ) # Should we do something with the suffix? fmt . append ( name ) defaults = _DEFAULT_OVERVIEW_FMT if len ( fmt ) < len ( defaults ) : raise NNTPDataError ( "LIST OVERVIEW.FMT response too short" ) if fmt [ : len ( defaults ) ] != defaults : raise NNTPDataError ( "LIST OVERVIEW.FMT redefines default fields" ) return fmt