Skip to content

Commit 09ddf89

Browse files
Smart Random v0.0.2
1 parent 83068e3 commit 09ddf89

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# smartrandom
2-
1+
# smartrandom <sup>v0.0.2</sup>
32
---
43

54
## Random Data Generators:
@@ -13,13 +12,13 @@ Helps to generate passwords, service codes (for example, for sending via SMS), h
1312
```python
1413
from smartrandom.random_master import RandomMaster
1514

16-
random_string = RandomMaster.string.get(length=10)
17-
random_number_string = RandomMaster.number.get(length=10)
18-
password = RandomMaster.password.get(length=10)
19-
random_hash = RandomMaster.hash.get(text='give me hash')
20-
random_number_code = RandomMaster.get_code(length=10, number_flag=True)
21-
random_string_code = RandomMaster.get_code(length=10, string_flag=True)
22-
random_symbol_code = RandomMaster.get_code(length=10, symbol_flag=True)
15+
random_string = RandomMaster.string.create(length=10)
16+
random_number_string = RandomMaster.number.create(length=10)
17+
password = RandomMaster.password.create(length=10)
18+
random_hash = RandomMaster.hash.create(text='give me hash')
19+
random_number_code = RandomMaster.create_code(length=10, number_flag=True)
20+
random_string_code = RandomMaster.create_code(length=10, string_flag=True)
21+
random_symbol_code = RandomMaster.create_code(length=10, symbol_flag=True)
2322

2423
```
2524

@@ -44,6 +43,6 @@ random_symbol_code = RandomMaster.get_code(length=10, symbol_flag=True)
4443
--------------------------------------------------------
4544
Licensed under the terms of the BSD 3-Clause License
4645
(see LICENSE for details).
47-
Copyright © 2018-2023, A.A Suvorov
46+
Copyright © 2018-2024, A.A Suvorov
4847
All rights reserved.
4948
--------------------------------------------------------

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = smartrandom
3-
version = 0.0.1
3+
version = 0.0.2
44
author = A.A Suvorov
55
author_email = [email protected]
66
description = Random Data Generators

smartrandom/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# --------------------------------------------------------
2+
# Licensed under the terms of the BSD 3-Clause License
3+
# (see LICENSE for details).
4+
# Copyright © 2018-2024, A.A Suvorov
5+
# All rights reserved.
6+
# --------------------------------------------------------
7+
# https://github.com/smartlegionlab
8+
# --------------------------------------------------------
9+
"""Smart Random"""

smartrandom/random_master.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# -*- coding: utf-8 -*-
21
# --------------------------------------------------------
32
# Licensed under the terms of the BSD 3-Clause License
43
# (see LICENSE for details).
5-
# Copyright © 2018-2023, A.A Suvorov
4+
# Copyright © 2018-2024, A.A Suvorov
65
# All rights reserved.
76
# --------------------------------------------------------
87
# https://github.com/smartlegionlab
@@ -16,23 +15,23 @@ class RandomStringMaster:
1615
letters = string.ascii_letters
1716

1817
@classmethod
19-
def get(cls, length=10):
18+
def create(cls, length=10):
2019
return ''.join((random.choice(cls.letters) for _ in range(length)))
2120

2221

2322
class RandomNumberMaster:
2423
numbers = string.digits
2524

2625
@classmethod
27-
def get(cls, length=10):
26+
def create(cls, length=10):
2827
return ''.join((random.choice(cls.numbers) for _ in range(length)))
2928

3029

3130
class RandomSymbolMaster:
3231
symbols = '@$!%*#?&-'
3332

3433
@classmethod
35-
def get(cls, length=10):
34+
def create(cls, length=10):
3635
return ''.join((random.choice(cls.symbols) for _ in range(length)))
3736

3837

@@ -42,13 +41,13 @@ class RandomPasswordMaster:
4241
symbols = '@$!%*#?&-'
4342

4443
@classmethod
45-
def get(cls, length=10):
44+
def create(cls, length=10):
4645
return ''.join((random.choice(cls.letters + cls.numbers + cls.symbols) for _ in range(length)))
4746

4847

4948
class RandomHashMaster:
5049
@classmethod
51-
def get(cls, text):
50+
def create(cls, text):
5251
sha = hashlib.sha3_512(text.encode('utf-8'))
5352
new_hash = sha.hexdigest()
5453
return new_hash
@@ -62,7 +61,7 @@ class RandomMaster:
6261
hash = RandomHashMaster()
6362

6463
@classmethod
65-
def get_code(cls, length=10, number_flag=False, string_flag=False, symbol_flag=False):
64+
def create_code(cls, length=10, number_flag=False, string_flag=False, symbol_flag=False):
6665
data = ''
6766
if string_flag:
6867
data += cls.string.letters

0 commit comments

Comments
 (0)