Skip to content

Commit 2008732

Browse files
#v1.4.1
[NEW] Object is reused instead of creating multiple object instances.
1 parent 8536ae3 commit 2008732

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# randomisedString v1.4.0
1+
# randomisedString v1.4.1
22

33
```pip install randomisedString --upgrade```
44

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "randomisedString"
9-
version = "1.4.0"
9+
version = "1.4.1"
1010
description = "A well maintained program to generate cryptographically safe randomised strings. Can be used for assigning unique IDs of any specified size. Can be alpha only or numeric or alphanumeric as specified."
1111
readme = "README.md"
1212
maintainers = [{ name = "Bhindi", email = "[email protected]" }]

randomisedString.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.4.0"
1+
__version__ = "1.4.1"
22
__packagename__ = "randomisedstring"
33

44

@@ -42,9 +42,16 @@ class Imports:
4242

4343

4444
class RandomisedString:
45+
_instance = None
46+
47+
def __new__(cls, *args, **kwargs):
48+
if cls._instance is None:
49+
cls._instance = super(RandomisedString, cls).__new__(cls)
50+
return cls._instance
51+
4552
def __init__(self):
4653
"""
47-
Initialise the Generator and use the public functions to generate a randomised string.
54+
Initialize the Generator and use the public functions to generate a randomized string.
4855
"""
4956
self.LOWER_CASE_ASCIIS = list(range(97, 122 + 1))
5057
self.UPPER_CASE_ASCIIS = list(range(65, 90 + 1))

0 commit comments

Comments
 (0)