Skip to content
This repository was archived by the owner on Jul 5, 2021. It is now read-only.

Sourcery Starbot ⭐ refactored prcutler/nflpool #514

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch https://github.com/sourcery-ai-bot/nflpool master
git merge --ff-only FETCH_HEAD
git reset HEAD^

data = dict()
data = {}
Copy link
Author

Choose a reason for hiding this comment

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

Function BaseController.data_dict refactored with the following changes:

user_id = cookie_auth.get_user_id_via_auth_cookie(self.request)
return user_id
return cookie_auth.get_user_id_via_auth_cookie(self.request)
Copy link
Author

Choose a reason for hiding this comment

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

Function BaseController.logged_in_user_id refactored with the following changes:

if week >= 17:
week = "Final"
else:
week = "Week " + str(week_query[0])

week = "Final" if week >= 17 else "Week " + str(week_query[0])
Copy link
Author

Choose a reason for hiding this comment

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

Function StandingsController.season refactored with the following changes:

Comment on lines +17 to +23

import hashlib
import os
import nflpool

__full_path = os.path.dirname(os.path.abspath(nflpool.__file__))
__hash_lookup = dict()
__hash_lookup = {}
Copy link
Author

Choose a reason for hiding this comment

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

Lines 22-22 refactored with the following changes:

account = session.query(Account).filter(Account.email == email).first()

return account
return session.query(Account).filter(Account.email == email).first()
Copy link
Author

Choose a reason for hiding this comment

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

Function AccountService.find_account_by_email refactored with the following changes:

Comment on lines -53 to +51
tz = pendulum.timezone("America/New_York")

return tz
return pendulum.timezone("America/New_York")
Copy link
Author

Choose a reason for hiding this comment

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

Function GameDayService.timezone refactored with the following changes:

Comment on lines -60 to +58
time_due = season_start_date.format("h:m A")
# print("Season start date", season_start_date, "time_due", time_due)

return time_due
return season_start_date.format("h:m A")
Copy link
Author

Choose a reason for hiding this comment

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

Function GameDayService.time_due refactored with the following changes:

Comment on lines -68 to +65
picks_due_date = season_start_date.to_formatted_date_string()
# print("picks_due_date", picks_due_date)

return picks_due_date
return season_start_date.to_formatted_date_string()
Copy link
Author

Choose a reason for hiding this comment

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

Function GameDayService.picks_due refactored with the following changes:

Comment on lines -80 to +74
days = delta.days

return days
return delta.days
Copy link
Author

Choose a reason for hiding this comment

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

Function GameDayService.delta_days refactored with the following changes:

Comment on lines -91 to +83
hours = delta.hours

return hours
return delta.hours
Copy link
Author

Choose a reason for hiding this comment

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

Function GameDayService.delta_hours refactored with the following changes:

Comment on lines -102 to +92
minutes = delta.minutes

return minutes
return delta.minutes
Copy link
Author

Choose a reason for hiding this comment

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

Function GameDayService.delta_minutes refactored with the following changes:

Comment on lines 28 to -29

x = 0
Copy link
Author

Choose a reason for hiding this comment

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

Function NewInstallService.get_team_info refactored with the following changes:

Comment on lines -87 to +83
if x == 1:
if division_id == 1:
division = "East"
elif x == 2:
elif division_id == 2:
division = "North"
elif x == 3:
elif division_id == 3:
Copy link
Author

Choose a reason for hiding this comment

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

Function NewInstallService.create_division_info refactored with the following changes:

if x == 1:
if pick_type_id == 1:
for y in range(1, 5):
place = y

if y == 1:
if place == 1:
points = 50
elif y == 2:
elif place == 2:
points = 30
elif y == 4:
elif place == 4:
Copy link
Author

Choose a reason for hiding this comment

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

Function NewInstallService.create_pick_type_points refactored with the following changes:

Comment on lines -49 to -50
session.commit()

Copy link
Author

Choose a reason for hiding this comment

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

Function NewSeasonService.create_season refactored with the following changes:

account_info = session.query(Account).filter(Account.id == user_id).all()

return account_info
return session.query(Account).filter(Account.id == user_id).all()
Copy link
Author

Choose a reason for hiding this comment

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

Function ViewPicksService.get_account_info refactored with the following changes:

Comment on lines -24 to -30
seasons_played = (
return (
session.query(PlayerPicks.season)
.distinct(PlayerPicks.season)
.filter(Account.id == user_id)
)

return seasons_played
Copy link
Author

Choose a reason for hiding this comment

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

Function ViewPicksService.seasons_played refactored with the following changes:

Comment on lines -37 to +33
picks_query = (
return (
Copy link
Author

Choose a reason for hiding this comment

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

Function ViewPicksService.display_picks refactored with the following changes:

Comment on lines -69 to +63
picks_query = (
return (
Copy link
Author

Choose a reason for hiding this comment

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

Function ViewPicksService.change_picks refactored with the following changes:

current_season = season_row.current_season

return current_season
return season_row.current_season
Copy link
Author

Choose a reason for hiding this comment

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

Function get_seasons refactored with the following changes:

x = 0

# print(type(standings_data), standings_data)

for teams in standings_data:
for x, teams in enumerate(standings_data):
Copy link
Author

Choose a reason for hiding this comment

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

Function WeeklyStatsService.get_rankings refactored with the following changes:

Comment on lines -265 to -273
x = 0

for teams in points_for_data:
for x, teams in enumerate(points_for_data):
team_id = int(points_for_data[x]["team"]["id"])
points_for = points_for_data[x]["stats"]["standings"]["pointsFor"]

week = TimeService.get_week()

x += 1
Copy link
Author

Choose a reason for hiding this comment

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

Function WeeklyStatsService.get_points_for refactored with the following changes:

Comment on lines -299 to +292
x = 0

tiebreaker_json = response.json()
tiebreaker_data = tiebreaker_json["teamStatsTotals"]

for teams in tiebreaker_data:
for x, teams in enumerate(tiebreaker_data):
Copy link
Author

Choose a reason for hiding this comment

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

Function WeeklyStatsService.get_tiebreaker refactored with the following changes:

if not any(char in symbol for char in self.password):
if all(char not in symbol for char in self.password):
Copy link
Author

Choose a reason for hiding this comment

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

Function RegisterViewModel.validate refactored with the following changes:

Comment on lines -46 to -49
if self.reset.was_used:
self.error_msg = "This reset code has already been used."
return

Copy link
Author

Choose a reason for hiding this comment

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

Function ResetPasswordViewModel.validate refactored with the following changes:

player_list = [
return [
Copy link
Author

Choose a reason for hiding this comment

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

Function activeplayer_json refactored with the following changes:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant