Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type checking enabled #32

Merged
merged 4 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion random_profile/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .main import RandomProfile
from audiobook.main import RandomProfile
import argparse


Expand Down
17 changes: 8 additions & 9 deletions random_profile/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
cities_name_txt = os.path.join(ASSETS_DIR, "cities_name.txt")
states_names_txt = os.path.join(ASSETS_DIR, "states_names.txt")
job_titles_txt = os.path.join(ASSETS_DIR, "job_titles.txt")
email_domain_txt = os.path.join(ASSETS_DIR, "email_domains.txt")

# loading data from txt files
fname = load_txt_file(fname_txt)
Expand All @@ -38,35 +37,35 @@
job_titles = load_txt_file(job_titles_txt)


class RandomProfile:
def __init__(self, num=1):
class RandomProfile(object):
def __init__(self, num: int = 1):
'''
num = Total No. of Name You Want To Print
default is 1
To Print More Than one Name Change value of num
'''
self.num = num

def first_name(self, num=None):
def first_name(self, num: int = None) -> list:
if num is None:
num = self.num
first_name_list = [random.choice(fname) for _ in range(num)]
return first_name_list

def last_name(self, num=None):
def last_name(self, num: int = None) -> list:
if num is None:
num = self.num
last_name_list = [random.choice(lname) for _ in range(num)]
return last_name_list

def full_name(self, num=None):
def full_name(self, num: int = None) -> list:
if num is None:
num = self.num
full_name_list = [random.choice(
fname) + ' ' + random.choice(lname) for _ in range(num)]
return full_name_list

def full_profile(self, num=None):
def full_profile(self, num: int = None) -> list:
if num is None:
num = self.num
profile_list = []
Expand Down Expand Up @@ -113,10 +112,10 @@ def full_profile(self, num=None):

return profile_list

def ipv4(self):
def ipv4(self) -> list:
ip_list = [ipv4_gen() for _ in range(self.num)]
return ip_list

def job_title(self):
def job_title(self) -> list:
job_title_list = [random.choice(job_titles) for _ in range(self.num)]
return job_title_list
8 changes: 4 additions & 4 deletions random_profile/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def ipv4_gen() -> str:
return f"{random.randint(0,255)}.{random.randint(0,255)}.{random.randint(0,255)}.{random.randint(0,255)}"


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

return dob, age
return (dob, age)


def generate_random_height_weight():
def generate_random_height_weight() -> tuple:
height = random.randint(140, 200)
if height < 150:
weight = random.randint(40, 60)
Expand All @@ -61,4 +61,4 @@ def generate_random_height_weight():
weight = random.randint(80, 100)
elif height <= 200:
weight = random.randint(90, 110)
return height, weight
return (height, weight)
12 changes: 3 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,25 @@
long_description = fh.read()

setuptools.setup(
# Here is the module name.
name="random_profile",
# version of the module
version="1.0.0",
# Name of Author
author="Deepak Raj",
# your Email address
author_email="[email protected]",
# Small Description about module
description="Generate Random Profile",
long_description=long_description,
# Specifying that we are using markdown file for description
long_description_content_type="text/markdown",
# Any link to reach this module, if you have any webpage or github profile
data_files=[('assets', glob('random_profile/assets/*'))],
url="https://github.com/codePerfectPlus/Random-Profile-Generator",
packages=setuptools.find_packages(),
# classifiers like program is suitable for python3, just leave as it is.
classifiers=[
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: Implementation :: PyPy",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Utilities",
],
"Environment :: Plugins"],
entry_points={
"console_scripts": ["random_profile = random_profile.__main__:main"],
},
Expand Down