Skip to content

Commit 5037d24

Browse files
type checking enabled
1 parent f290729 commit 5037d24

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

random_profile/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .main import RandomProfile
1+
from audiobook.main import RandomProfile
22
import argparse
33

44

random_profile/main.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
cities_name_txt = os.path.join(ASSETS_DIR, "cities_name.txt")
2626
states_names_txt = os.path.join(ASSETS_DIR, "states_names.txt")
2727
job_titles_txt = os.path.join(ASSETS_DIR, "job_titles.txt")
28-
email_domain_txt = os.path.join(ASSETS_DIR, "email_domains.txt")
2928

3029
# loading data from txt files
3130
fname = load_txt_file(fname_txt)
@@ -39,34 +38,34 @@
3938

4039

4140
class RandomProfile:
42-
def __init__(self, num=1):
41+
def __init__(self, num: int = 1):
4342
'''
4443
num = Total No. of Name You Want To Print
4544
default is 1
4645
To Print More Than one Name Change value of num
4746
'''
4847
self.num = num
4948

50-
def first_name(self, num=None):
49+
def first_name(self, num: int = None) -> list:
5150
if num is None:
5251
num = self.num
5352
first_name_list = [random.choice(fname) for _ in range(num)]
5453
return first_name_list
5554

56-
def last_name(self, num=None):
55+
def last_name(self, num: int = None) -> list:
5756
if num is None:
5857
num = self.num
5958
last_name_list = [random.choice(lname) for _ in range(num)]
6059
return last_name_list
6160

62-
def full_name(self, num=None):
61+
def full_name(self, num: int = None) -> list:
6362
if num is None:
6463
num = self.num
6564
full_name_list = [random.choice(
6665
fname) + ' ' + random.choice(lname) for _ in range(num)]
6766
return full_name_list
6867

69-
def full_profile(self, num=None):
68+
def full_profile(self, num: int = None) -> list:
7069
if num is None:
7170
num = self.num
7271
profile_list = []
@@ -113,10 +112,10 @@ def full_profile(self, num=None):
113112

114113
return profile_list
115114

116-
def ipv4(self):
115+
def ipv4(self) -> list:
117116
ip_list = [ipv4_gen() for _ in range(self.num)]
118117
return ip_list
119118

120-
def job_title(self):
119+
def job_title(self) -> list:
121120
job_title_list = [random.choice(job_titles) for _ in range(self.num)]
122121
return job_title_list

random_profile/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def ipv4_gen() -> str:
2828
return f"{random.randint(0,255)}.{random.randint(0,255)}.{random.randint(0,255)}.{random.randint(0,255)}"
2929

3030

31-
def generate_dob_age():
31+
def generate_dob_age() -> tuple:
3232
month = random.randint(1, 12)
3333
if month == 2: # if month is feb
3434
day = random.randint(1, 28)
@@ -44,10 +44,10 @@ def generate_dob_age():
4444
age = (datetime.now() - dob).days // 365
4545
dob = dob.strftime("%d/%m/%Y")
4646

47-
return dob, age
47+
return (dob, age)
4848

4949

50-
def generate_random_height_weight():
50+
def generate_random_height_weight() -> tuple:
5151
height = random.randint(140, 200)
5252
if height < 150:
5353
weight = random.randint(40, 60)
@@ -61,4 +61,4 @@ def generate_random_height_weight():
6161
weight = random.randint(80, 100)
6262
elif height <= 200:
6363
weight = random.randint(90, 110)
64-
return height, weight
64+
return (height, weight)

0 commit comments

Comments
 (0)