-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add important dates feature #85
Add important dates feature #85
Conversation
@trevor-viljoen Great work! Could you please fix the pep8 issues as described in the codeclimate issue sbefore I merge? |
3fbb388
to
8fc560a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature! Hope you don't mind a drive-by review.
mlbgame/__init__.py
Outdated
@@ -228,6 +228,12 @@ def game_events(game_id): | |||
return [mlbgame.events.Inning(data[x], x) for x in data] | |||
|
|||
|
|||
def important_dates(year=datetime.now().year): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using year=None
here and then assigning year
to datetime.now().year
in the function body if None
is passed in.
The way it's currently done the default value for year
will be calculated at import time.
mlbgame/info.py
Outdated
wildcard_teams | ||
year | ||
""" | ||
def dtfmt(self, my_date): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight simplification if you want: this can be a function in the module instead of a method on this class. Then you can just refer to it as dtfmt
when calling it below instead of self.dtfmt
.
mlbgame/info.py
Outdated
return '' | ||
return my_date.strftime('%A, %B %d') | ||
|
||
def strformat(self, my_str, args): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar suggestion as above.
Make date_format and str_format module functions
@trevor-viljoen Looks good! |
This PR adds #84. Example and sample output: