homa 0.15__tar.gz → 0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of homa might be problematic. Click here for more details.
- {homa-0.15 → homa-0.16}/Homa.egg-info/PKG-INFO +2 -2
- {homa-0.15 → homa-0.16}/Homa.egg-info/SOURCES.txt +6 -1
- {homa-0.15 → homa-0.16}/PKG-INFO +2 -2
- {homa-0.15 → homa-0.16}/README.md +1 -1
- homa-0.16/homa/repositories/RandomDateRepository.py +62 -0
- homa-0.16/homa/repositories/RandomImageRepository.py +2 -0
- homa-0.16/homa/repositories/RandomNameRepository.py +66 -0
- homa-0.16/homa/repositories/RandomTextRepository.py +24 -0
- homa-0.16/homa/repositories/__init__.py +4 -0
- {homa-0.15 → homa-0.16}/setup.py +1 -1
- {homa-0.15 → homa-0.16}/Homa.egg-info/dependency_links.txt +0 -0
- {homa-0.15 → homa-0.16}/Homa.egg-info/top_level.txt +0 -0
- {homa-0.15 → homa-0.16}/LICENSE +0 -0
- {homa-0.15 → homa-0.16}/homa/__init__.py +0 -0
- {homa-0.15 → homa-0.16}/homa/helpers.py +0 -0
- {homa-0.15 → homa-0.16}/homa/main.py +0 -0
- {homa-0.15 → homa-0.16}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: homa
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16
|
|
4
4
|
Description-Content-Type: text/markdown
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ License-File: LICENSE
|
|
|
15
15
|
|
|
16
16
|
Homa is a library to generate random data that provides more productivity for developers.
|
|
17
17
|
|
|
18
|
-
In loving memory of [Saber Rastikerdar](https://rastikerdar.github.io/), who introduced Persian to the digital world. 🖤💚
|
|
18
|
+
In loving memory of [Saber Rastikerdar](https://rastikerdar.github.io/), who introduced Persian (Farsi) to the digital world. 🖤💚
|
|
19
19
|
|
|
20
20
|
## Names
|
|
21
21
|
|
|
@@ -11,4 +11,9 @@ homa/main.py
|
|
|
11
11
|
homa.egg-info/PKG-INFO
|
|
12
12
|
homa.egg-info/SOURCES.txt
|
|
13
13
|
homa.egg-info/dependency_links.txt
|
|
14
|
-
homa.egg-info/top_level.txt
|
|
14
|
+
homa.egg-info/top_level.txt
|
|
15
|
+
homa/repositories/RandomDateRepository.py
|
|
16
|
+
homa/repositories/RandomImageRepository.py
|
|
17
|
+
homa/repositories/RandomNameRepository.py
|
|
18
|
+
homa/repositories/RandomTextRepository.py
|
|
19
|
+
homa/repositories/__init__.py
|
{homa-0.15 → homa-0.16}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: homa
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16
|
|
4
4
|
Description-Content-Type: text/markdown
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ License-File: LICENSE
|
|
|
15
15
|
|
|
16
16
|
Homa is a library to generate random data that provides more productivity for developers.
|
|
17
17
|
|
|
18
|
-
In loving memory of [Saber Rastikerdar](https://rastikerdar.github.io/), who introduced Persian to the digital world. 🖤💚
|
|
18
|
+
In loving memory of [Saber Rastikerdar](https://rastikerdar.github.io/), who introduced Persian (Farsi) to the digital world. 🖤💚
|
|
19
19
|
|
|
20
20
|
## Names
|
|
21
21
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
Homa is a library to generate random data that provides more productivity for developers.
|
|
11
11
|
|
|
12
|
-
In loving memory of [Saber Rastikerdar](https://rastikerdar.github.io/), who introduced Persian to the digital world. 🖤💚
|
|
12
|
+
In loving memory of [Saber Rastikerdar](https://rastikerdar.github.io/), who introduced Persian (Farsi) to the digital world. 🖤💚
|
|
13
13
|
|
|
14
14
|
## Names
|
|
15
15
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from ..helpers import randint
|
|
2
|
+
import datetime
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class RandomDateRepository:
|
|
6
|
+
def __init__(self):
|
|
7
|
+
self.generatedYear = None
|
|
8
|
+
self.generatedMonth = None
|
|
9
|
+
self.generatedDay = None
|
|
10
|
+
self.dayCounts = {
|
|
11
|
+
1: 31, # January
|
|
12
|
+
2: 28, # February
|
|
13
|
+
3: 31, # March
|
|
14
|
+
4: 30, # April
|
|
15
|
+
5: 31, # May
|
|
16
|
+
6: 30, # June
|
|
17
|
+
7: 31, # July
|
|
18
|
+
8: 31, # August
|
|
19
|
+
9: 30, # September
|
|
20
|
+
10: 31, # October
|
|
21
|
+
11: 30, # November
|
|
22
|
+
12: 31 # December
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
def year(self, start: int = 2000, end: int = 2020) -> int:
|
|
26
|
+
self.generatedYear = randint(start, end + 1)
|
|
27
|
+
self.isLeap = self.generatedYear % 4 == 0
|
|
28
|
+
|
|
29
|
+
if self.isLeap:
|
|
30
|
+
self.dayCounts[2] = 29
|
|
31
|
+
else:
|
|
32
|
+
self.dayCounts[2] = 28
|
|
33
|
+
|
|
34
|
+
return self.generatedYear
|
|
35
|
+
|
|
36
|
+
def month(self) -> int:
|
|
37
|
+
self.generatedMonth = randint(1, 12 + 1)
|
|
38
|
+
return self.generatedMonth
|
|
39
|
+
|
|
40
|
+
def day(self) -> int:
|
|
41
|
+
self.generatedDay = randint(1, self.dayCounts[self.generatedMonth])
|
|
42
|
+
return self.generatedDay
|
|
43
|
+
|
|
44
|
+
def date(self, asString=False, separator="/"):
|
|
45
|
+
if asString:
|
|
46
|
+
return f"{self.year()}{separator}{self.month()}{separator}{self.day()}"
|
|
47
|
+
|
|
48
|
+
return datetime.datetime(
|
|
49
|
+
self.year(),
|
|
50
|
+
self.month(),
|
|
51
|
+
self.day()
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
def datetime(self):
|
|
55
|
+
return datetime.datetime(
|
|
56
|
+
self.year(),
|
|
57
|
+
self.month(),
|
|
58
|
+
self.day(),
|
|
59
|
+
randint(0, 23 + 1),
|
|
60
|
+
randint(0, 60),
|
|
61
|
+
randint(0, 60),
|
|
62
|
+
)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from random import shuffle
|
|
2
|
+
|
|
3
|
+
from ..helpers import fileAsArray
|
|
4
|
+
from ..helpers import oneOf
|
|
5
|
+
from ..helpers import root
|
|
6
|
+
from ..helpers import replaceVowels
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class RandomNameRepository:
|
|
10
|
+
def __init__(self) -> None:
|
|
11
|
+
self.__masculine_firstnames = fileAsArray(
|
|
12
|
+
root("wordlists/names/masculine_names.txt")
|
|
13
|
+
)
|
|
14
|
+
self.__feminine_firstnames = fileAsArray(
|
|
15
|
+
root("wordlists/names/feminine_names.txt")
|
|
16
|
+
)
|
|
17
|
+
self.__surnames = fileAsArray(
|
|
18
|
+
root("wordlists/names/surnames.txt")
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
shuffle(self.__masculine_firstnames)
|
|
22
|
+
shuffle(self.__feminine_firstnames)
|
|
23
|
+
shuffle(self.__surnames)
|
|
24
|
+
|
|
25
|
+
self.lastGender = None
|
|
26
|
+
|
|
27
|
+
def gender(self, gender: str | None):
|
|
28
|
+
genderMap = {
|
|
29
|
+
"girl": "F",
|
|
30
|
+
"girls": "F",
|
|
31
|
+
"female": "F",
|
|
32
|
+
"boy": "M",
|
|
33
|
+
"male": "M"
|
|
34
|
+
}
|
|
35
|
+
self.lastGender = oneOf(
|
|
36
|
+
["F", "M"]) if not gender else genderMap[gender]
|
|
37
|
+
|
|
38
|
+
def firstname(self) -> str:
|
|
39
|
+
targetArrayMap = {
|
|
40
|
+
"M": self.__masculine_firstnames,
|
|
41
|
+
"F": self.__feminine_firstnames,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return oneOf(targetArrayMap[self.lastGenderOrRandom()])
|
|
45
|
+
|
|
46
|
+
def surname(self) -> str:
|
|
47
|
+
return replaceVowels(oneOf(self.__surnames))
|
|
48
|
+
|
|
49
|
+
def prefix(self):
|
|
50
|
+
targetArrayMap = {
|
|
51
|
+
"M": ["Lord", "Sir", "Gentleman", "Dr."],
|
|
52
|
+
"F": ["Madam", "Dr.", "Miss", "Ms."]
|
|
53
|
+
}
|
|
54
|
+
return oneOf(targetArrayMap[self.lastGenderOrRandom()])
|
|
55
|
+
|
|
56
|
+
def lastGenderOrRandom(self):
|
|
57
|
+
return self.lastGender if self.lastGender else oneOf(["M", "F"])
|
|
58
|
+
|
|
59
|
+
def fullname(self, gender=None):
|
|
60
|
+
self.gender(gender)
|
|
61
|
+
|
|
62
|
+
usePrefix = oneOf([True, False])
|
|
63
|
+
if usePrefix:
|
|
64
|
+
return f"{self.prefix()} {self.firstname()} {self.surname()}"
|
|
65
|
+
|
|
66
|
+
return f"{self.firstname()} {self.surname()}"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import string
|
|
2
|
+
import random
|
|
3
|
+
|
|
4
|
+
from ..helpers import randint
|
|
5
|
+
from ..helpers import oneOf
|
|
6
|
+
from ..helpers import fileAsArray
|
|
7
|
+
from ..helpers import root
|
|
8
|
+
from ..helpers import replaceVowels
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RandomTextRepository:
|
|
12
|
+
def __init__(self) -> None:
|
|
13
|
+
self.titles = fileAsArray(
|
|
14
|
+
root("wordlists/text/titles.txt")
|
|
15
|
+
)
|
|
16
|
+
random.shuffle(self.titles)
|
|
17
|
+
|
|
18
|
+
def token(self, lowerBound: int = 4, upperBound: int = 14):
|
|
19
|
+
letters = list(string.ascii_lowercase)
|
|
20
|
+
random.shuffle(letters)
|
|
21
|
+
return "".join(letters[:randint(lowerBound, upperBound)])
|
|
22
|
+
|
|
23
|
+
def title(self):
|
|
24
|
+
return replaceVowels(oneOf(self.titles))
|
{homa-0.15 → homa-0.16}/setup.py
RENAMED
|
File without changes
|
|
File without changes
|
{homa-0.15 → homa-0.16}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|