-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
737a104
commit 13b0bb7
Showing
4 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import random | ||
import string | ||
|
||
class UUIDGenerator: | ||
|
||
def __init__(self, dtype='str-major', seed=None): | ||
self.dtype = dtype | ||
if seed is not None: | ||
self.seed = seed | ||
else: | ||
self.seed = random.randint(1, 200) | ||
def generate(self): | ||
if self.dtype == 'int-major': | ||
self.result = [] | ||
length = 22 | ||
data = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '&', '-', '%', '#', '@'] | ||
self.result = ''.join(random.choice(data) for i in range(length)) | ||
|
||
elif self.dtype == 'str-major': | ||
length = 22 | ||
letters = string.ascii_lowercase + string.ascii_uppercase + '-%$#@!&^*(){}[]><?/|' | ||
self.result = ''.join(random.choice(letters) for i in range(length)) | ||
|
||
else: | ||
self.result = 'Unknown UUID data-type mentioned' | ||
|
||
return self.result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Mention Version Number | ||
__version__ = '1.1' | ||
__version__ = '1.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters