MCPcopy Index your code
hub / github.com/python/cpython / get_group_list

Function get_group_list

Lib/email/_header_value_parser.py:1929–1964  ·  view source on GitHub ↗

group-list = mailbox-list / CFWS / obs-group-list obs-group-list = 1*([CFWS] ",") [CFWS]

(value)

Source from the content-addressed store, hash-verified

1927
1928
1929def get_group_list(value):
1930 """ group-list = mailbox-list / CFWS / obs-group-list
1931 obs-group-list = 1*([CFWS] ",") [CFWS]
1932
1933 """
1934 group_list = GroupList()
1935 if not value:
1936 group_list.defects.append(errors.InvalidHeaderDefect(
1937 "end of header before group-list"))
1938 return group_list, value
1939 leader = None
1940 if value and value[0] in CFWS_LEADER:
1941 leader, value = get_cfws(value)
1942 if not value:
1943 # This should never happen in email parsing, since CFWS-only is a
1944 # legal alternative to group-list in a group, which is the only
1945 # place group-list appears.
1946 group_list.defects.append(errors.InvalidHeaderDefect(
1947 "end of header in group-list"))
1948 group_list.append(leader)
1949 return group_list, value
1950 if value[0] == ';':
1951 group_list.append(leader)
1952 return group_list, value
1953 token, value = get_mailbox_list(value)
1954 if len(token.all_mailboxes)==0:
1955 if leader is not None:
1956 group_list.append(leader)
1957 group_list.extend(token)
1958 group_list.defects.append(errors.ObsoleteHeaderDefect(
1959 "group-list with empty entries"))
1960 return group_list, value
1961 if leader is not None:
1962 token[:0] = [leader]
1963 group_list.append(token)
1964 return group_list, value
1965
1966def get_group(value):
1967 """ group = display-name ":" [group-list] ";" [CFWS]

Callers 1

get_groupFunction · 0.85

Calls 5

get_cfwsFunction · 0.85
get_mailbox_listFunction · 0.85
GroupListClass · 0.70
appendMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…