MCPcopy Index your code
hub / github.com/clips/pattern / shi

Function shi

pattern/vector/__init__.py:91–98  ·  view source on GitHub ↗

Returns a short string hash for a given int.

(i, base="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")

Source from the content-addressed store, hash-verified

89encode_utf8 = encode_string
90
91def shi(i, base="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"):
92 """ Returns a short string hash for a given int.
93 """
94 s = []
95 while i > 0:
96 i, r = divmod(i, len(base))
97 s.append(base[r])
98 return "".join(reversed(s))
99
100#--- LIST FUNCTIONS --------------------------------------------------------------------------------
101

Callers 1

__init__.pyFile · 0.85

Calls 2

lenFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected