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

Function insertion_unsort

Lib/encodings/punycode.py:48–68  ·  view source on GitHub ↗

3.2 Insertion unsort coding

(str, extended)

Source from the content-addressed store, hash-verified

46 index += 1
47
48def insertion_unsort(str, extended):
49 """3.2 Insertion unsort coding"""
50 oldchar = 0x80
51 result = []
52 oldindex = -1
53 for c in extended:
54 index = pos = -1
55 char = ord(c)
56 curlen = selective_len(str, char)
57 delta = (curlen+1) * (char - oldchar)
58 while 1:
59 index,pos = selective_find(str,c,index,pos)
60 if index == -1:
61 break
62 delta += index - oldindex
63 result.append(delta-1)
64 oldindex = index
65 delta = 0
66 oldchar = char
67
68 return result
69
70def T(j, bias):
71 # Punycode parameters: tmin = 1, tmax = 26, base = 36

Callers 1

punycode_encodeFunction · 0.85

Calls 3

selective_lenFunction · 0.85
selective_findFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…