Skip to content

Commit 363f452

Browse files
authored
Merge pull request Py-Contributors#32 from codePerfectPlus/type-check
type checking enabled
2 parents 4d51082 + de43596 commit 363f452

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
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: 8 additions & 9 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)
@@ -38,35 +37,35 @@
3837
job_titles = load_txt_file(job_titles_txt)
3938

4039

41-
class RandomProfile:
42-
def __init__(self, num=1):
40+
class RandomProfile(object):
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)

setup.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,25 @@
55
long_description = fh.read()
66

77
setuptools.setup(
8-
# Here is the module name.
98
name="random_profile",
10-
# version of the module
119
version="1.0.0",
12-
# Name of Author
1310
author="Deepak Raj",
14-
# your Email address
1511
author_email="[email protected]",
16-
# Small Description about module
1712
description="Generate Random Profile",
1813
long_description=long_description,
19-
# Specifying that we are using markdown file for description
2014
long_description_content_type="text/markdown",
21-
# Any link to reach this module, if you have any webpage or github profile
2215
data_files=[('assets', glob('random_profile/assets/*'))],
2316
url="https://github.com/codePerfectPlus/Random-Profile-Generator",
2417
packages=setuptools.find_packages(),
25-
# classifiers like program is suitable for python3, just leave as it is.
2618
classifiers=[
19+
"Development Status :: 5 - Production/Stable",
2720
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: Implementation :: PyPy",
2822
"License :: OSI Approved :: MIT License",
2923
"Operating System :: OS Independent",
3024
"Topic :: Software Development :: Libraries :: Python Modules",
3125
"Topic :: Utilities",
32-
],
26+
"Environment :: Plugins"],
3327
entry_points={
3428
"console_scripts": ["random_profile = random_profile.__main__:main"],
3529
},

0 commit comments

Comments
 (0)