Skip to content
Open
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
22 changes: 11 additions & 11 deletions git_stalk/stalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def jft(user):


def get_event(string):
"""Returns the event"""
# Returns the event

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this everywhere in the file. This is called docstring. Please read: [https://www.python.org/dev/peps/pep-0257/#id16](One line docstring)

event = ""
words = re.findall('[A-Z][^A-Z]*', string)
event = " ".join(words)
Expand All @@ -34,7 +34,7 @@ def get_event(string):


def get_details(event):
"""Returns the details of the event according to the type of the event"""
# Returns the details of the event according to the type of the event

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this.

types = {
"IssuesEvent": event["payload"]["issue"]["title"],
"IssuesCommentEvent": event["payload"]["comment"]["body"],
Expand All @@ -48,7 +48,7 @@ def get_details(event):


def check_for_fork(link, user):
"""Check whether it is a forked."""
# Check whether it is a fork

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this

tukde = link.split('/')
if tukde[len(tukde) - 2] == user:
response = requests.get(link)
Expand All @@ -60,15 +60,15 @@ def check_for_fork(link, user):


def get_local_time(string):
"""Returns the local time."""
# Returns the local time

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this

local_time = convert_to_local(string)
tukde = local_time.split(' ')
samay = tukde[1].split('+')[0]
return samay


def get_following_users(user):
"""prints the users followed by current user"""
# prints the users followed by current user

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this

following_link = "{}{}/following".format(github_uri, str(user))
following_users = requests.get(following_link).json()

Expand All @@ -79,7 +79,7 @@ def get_following_users(user):


def get_followers(user):
"""prints the followers of user"""
# prints the followers of user

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this


followers_link = "{}{}/followers".format(github_uri, str(user))
followers = requests.get(followers_link).json()
Expand All @@ -91,7 +91,7 @@ def get_followers(user):


def get_basic_info(user):
"""Prints the user's basic info."""
# Prints the user's basic info

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this


user_link = "{}{}".format(github_uri, str(user))
user_profile = requests.get(user_link)
Expand All @@ -108,7 +108,7 @@ def get_basic_info(user):


def convert_to_local(string):
"""Returns the local_stamp as string."""
# Returns the local_stamp as string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this


from_zone = tz.tzutc()
to_zone = tz.tzlocal()
Expand Down Expand Up @@ -251,12 +251,12 @@ def create_star(event):


def update():
"""Runs the upgrade command and upgrades git-stalk"""
# Runs the upgrade command and upgrades git-stalk

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this

os.system("pip install --upgrade git-stalk")


def filter_since_until_dates(events, since_date=None, until_date=None):
"""Filters the events based on since and until dates"""
# Filters the events based on since and until dates

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this

event_tuples = [(datetime.datetime.strptime(event['created_at'][:10], "%Y-%m-%d"), event) for event in events]
if since_date:
event_tuples = [since_date <= event_tuple[0] for event_tuple in event_tuples]
Expand All @@ -275,7 +275,7 @@ def parse_date_from_string(datetime_object):


def get_dates_from_arguments(arguments):
"""Return triplet of dates from given arguments."""
# Return triplet of dates from given arguments

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this

since_date, until_date, text_date = None, None, ""
if arguments["since"]:
since_date = parse_date_from_string(arguments["since"])
Expand Down