MCPcopy
hub / github.com/AsahiLinux/m1n1 / insert_n

Function insert_n

tools/reg2json.py:4–16  ·  view source on GitHub ↗
(s, nb)

Source from the content-addressed store, hash-verified

2from xml.etree import ElementTree
3
4def insert_n(s, nb):
5 sout = ""
6 def sub(g):
7 if g.group(2):
8 a, b = int(g.group(1)), int(g.group(2)[1:])
9 return nb[-a - 1:-b or None]
10 else:
11 a = int(g.group(1))
12 return nb[-a - 1]
13
14 s = re.sub(r'n\[(\d+)(:\d+)?\]', sub, s)
15 s = "".join(s.split(":"))
16 return int(s.replace("0b", ""), 2)
17
18def parse_one(regs, xml):
19 t = ElementTree.parse(xml)

Callers 1

parse_oneFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected