MCPcopy Index your code
hub / github.com/FSoft-AI4Code/HyperAgent / generate_random_string

Function generate_random_string

src/hyperagent/utils.py:19–33  ·  view source on GitHub ↗
(length, use_uppercase=True, use_lowercase=True, use_digits=True, use_punctuation=False)

Source from the content-addressed store, hash-verified

17import string
18
19def generate_random_string(length, use_uppercase=True, use_lowercase=True, use_digits=True, use_punctuation=False):
20 characters = ''
21 if use_uppercase:
22 characters += string.ascii_uppercase
23 if use_lowercase:
24 characters += string.ascii_lowercase
25 if use_digits:
26 characters += string.digits
27 if use_punctuation:
28 characters += string.punctuation
29
30 if not characters:
31 raise ValueError("At least one character set must be selected")
32
33 return ''.join(random.choice(characters) for i in range(length))
34
35def find_most_matched_string(word_list, target):
36 # Get close matches; n=1 ensures only the top match is returned

Callers 1

extract_patchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected