MCPcopy
hub / github.com/tornadoweb/tornado / split

Method split

tornado/tcpclient.py:80–102  ·  view source on GitHub ↗

Partition the ``addrinfo`` list by address family. Returns two lists. The first list contains the first entry from ``addrinfo`` and all others with the same family, and the second list contains all other addresses (normally one list will be AF_INET and the other AF_

(
        addrinfo: List[Tuple],
    )

Source from the content-addressed store, hash-verified

78
79 @staticmethod
80 def split(
81 addrinfo: List[Tuple],
82 ) -> Tuple[
83 List[Tuple[socket.AddressFamily, Tuple]],
84 List[Tuple[socket.AddressFamily, Tuple]],
85 ]:
86 """Partition the ``addrinfo`` list by address family.
87
88 Returns two lists. The first list contains the first entry from
89 ``addrinfo`` and all others with the same family, and the
90 second list contains all other addresses (normally one list will
91 be AF_INET and the other AF_INET6, although non-standard resolvers
92 may return additional families).
93 """
94 primary = []
95 secondary = []
96 primary_af = addrinfo[0][0]
97 for af, addr in addrinfo:
98 if af == primary_af:
99 primary.append((af, addr))
100 else:
101 secondary.append((af, addr))
102 return primary, secondary
103
104 def start(
105 self,

Callers 15

__init__Method · 0.95
formatMethod · 0.80
load_translationsFunction · 0.80
get_closestMethod · 0.80
parseMethod · 0.80
_apply_xheadersMethod · 0.80
handle_requestMethod · 0.80
environMethod · 0.80
_openid_argsMethod · 0.80
get_browser_localeMethod · 0.80

Calls 1

appendMethod · 0.80

Tested by 8

getMethod · 0.64
run_subprocessMethod · 0.64
test_one_familyMethod · 0.64
test_mixedMethod · 0.64
test_break_continueMethod · 0.64
header_callbackMethod · 0.64