MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / legacy_compress

Function legacy_compress

src/ifcopenshell-python/test/test_guid.py:59–65  ·  view source on GitHub ↗
(g: str)

Source from the content-addressed store, hash-verified

57
58
59def legacy_compress(g: str) -> str:
60 bs = [int(g[i : i + 2], 16) for i in range(0, len(g), 2)]
61
62 def b64(v, l=4):
63 return "".join([chars[(v // (64**i)) % 64] for i in range(l)][::-1])
64
65 return "".join([b64(bs[0], 2)] + [b64((bs[i] << 16) + (bs[i + 1] << 8) + bs[i + 2]) for i in range(1, 16, 3)])
66
67
68def legacy_expand(g: str) -> str:

Calls 3

b64Function · 0.85
rangeFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected