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

Function segregate

Lib/encodings/punycode.py:10–20  ·  view source on GitHub ↗

3.1 Basic code point segregation

(str)

Source from the content-addressed store, hash-verified

8##################### Encoding #####################################
9
10def segregate(str):
11 """3.1 Basic code point segregation"""
12 base = bytearray()
13 extended = set()
14 for c in str:
15 if ord(c) < 128:
16 base.append(ord(c))
17 else:
18 extended.add(c)
19 extended = sorted(extended)
20 return base.take_bytes(), extended
21
22def selective_len(str, max):
23 """Return the length of str, considering only characters below max."""

Callers 1

punycode_encodeFunction · 0.85

Calls 4

setFunction · 0.85
take_bytesMethod · 0.80
appendMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…