MCPcopy Index your code
hub / github.com/1Panel-dev/MaxKB / encode

Method encode

apps/common/utils/chat_link_code.py:19–35  ·  view source on GitHub ↗
(uuid_obj: Union[uuid.UUID, str] = None)

Source from the content-addressed store, hash-verified

17
18 @staticmethod
19 def encode(uuid_obj: Union[uuid.UUID, str] = None) -> str:
20
21 if uuid_obj is None:
22 uuid_obj = uuid.uuid7()
23 elif isinstance(uuid_obj, str):
24 uuid_obj = uuid.UUID(uuid_obj)
25
26 num = int(uuid_obj.hex, 16)
27
28 if num == 0:
29 return UUIDEncoder.BASE62_ALPHABET[0]
30
31 result = []
32 while num:
33 num, rem = divmod(num,62)
34 result.append(UUIDEncoder.BASE62_ALPHABET[rem])
35 return ''.join(reversed(result))
36
37 @staticmethod
38 def decode(encoded: str) -> uuid.UUID:

Callers 5

encryptFunction · 0.45
rsa_long_encryptFunction · 0.45
_legacy_md5_hashFunction · 0.45
get_sha256_hashFunction · 0.45
get_tool_mcp_configMethod · 0.45

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected