MCPcopy Create free account
hub / github.com/Tyaoo/picker / Pattern

Class Pattern

utils.py:26–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26class Pattern:
27 @staticmethod
28 def create(length: int=8192):
29 pattern = ''
30 parts = ['A', 'a', '0']
31 while len(pattern) != length:
32 pattern += parts[len(pattern) % 3]
33 if len(pattern) % 3 == 0:
34 parts[2] = chr(ord(parts[2]) + 1)
35 if parts[2] > '9':
36 parts[2] = '0'
37 parts[1] = chr(ord(parts[1]) + 1)
38 if parts[1] > 'z':
39 parts[1] = 'a'
40 parts[0] = chr(ord(parts[0]) + 1)
41 if parts[0] > 'Z':
42 parts[0] = 'A'
43 return pattern
44
45 @staticmethod
46 def offset(value: str, length: int=8192):
47 return Pattern.create(length).index(value)
48
49
50def popen(cmd:str) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected