-
-
Notifications
You must be signed in to change notification settings - Fork 402
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
reddit: updating reddit module praw dependency #1505
Conversation
RustyBower
commented
Mar 16, 2019
- version locking praw
- updating code for new praw version
- narrowing exception
9d6cbc1
to
8810781
Compare
Want to fix the style checker failure? I probably won't have a chance to look at this properly until tomorrow, though, so if you want to minimize amends/force-pushes, you can also just wait. :) |
8810781
to
8593dc9
Compare
Needs rebasing due to updated requirements for Also needs tweaking to avoid undoing changes made in #1516. |
@RustyBower be careful with that PR, this should be probably rebased once both #1486 and #1503 are merged. Still OK to work on that? 😃 |
This should be rebased and fixed now |
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 found it very helpful to review this with whitespace-only changes ignored. Doing so let me very quickly catch places where another PR (#1516) was partially reverted.
d97686e
to
7977a8e
Compare
Blahhh, I kinda promised to merge this before #1486 and now I went and merged that first, creating a conflict with this PR. Ugh. I got trigger-happy. 🙏 |
All rebased |
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.
👍
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.
There's some major duplication in this after rebase.
Lines 125 to 152 in f38e868
message = '[REDDITOR] ' + u.name | |
now = dt.datetime.utcnow() | |
cakeday_start = dt.datetime.utcfromtimestamp(u.created_utc) | |
cakeday_start = cakeday_start.replace(year=now.year) | |
day = dt.timedelta(days=1) | |
year_div_by_400 = now.year % 400 == 0 | |
year_div_by_100 = now.year % 100 == 0 | |
year_div_by_4 = now.year % 4 == 0 | |
is_leap = year_div_by_400 or ((not year_div_by_100) and year_div_by_4) | |
if (not is_leap) and ((cakeday_start.month, cakeday_start.day) == (2, 29)): | |
# If cake day is 2/29 and it's not a leap year, cake day is 1/3. | |
# Cake day begins at exact account creation time. | |
is_cakeday = cakeday_start + day <= now <= cakeday_start + (2 * day) | |
else: | |
is_cakeday = cakeday_start <= now <= cakeday_start + day | |
if is_cakeday: | |
message = message + ' | ' + bold(color('Cake day', colors.LIGHT_PURPLE)) | |
if commanded: | |
message = message + ' | https://reddit.com/u/' + u.name | |
if u.is_gold: | |
message = message + ' | ' + bold(color('Gold', colors.YELLOW)) | |
if u.is_mod: | |
message = message + ' | ' + bold(color('Mod', colors.GREEN)) | |
message = message + (' | Link: ' + str(u.link_karma) + | |
' | Comment: ' + str(u.comment_karma)) | |
bot.say(message) |
duplicates the logic outside that try
block, just below:
Lines 159 to 186 in f38e868
message = '[REDDITOR] ' + u.name | |
now = dt.datetime.utcnow() | |
cakeday_start = dt.datetime.utcfromtimestamp(u.created_utc) | |
cakeday_start = cakeday_start.replace(year=now.year) | |
day = dt.timedelta(days=1) | |
year_div_by_400 = now.year % 400 == 0 | |
year_div_by_100 = now.year % 100 == 0 | |
year_div_by_4 = now.year % 4 == 0 | |
is_leap = year_div_by_400 or ((not year_div_by_100) and year_div_by_4) | |
if (not is_leap) and ((cakeday_start.month, cakeday_start.day) == (2, 29)): | |
# If cake day is 2/29 and it's not a leap year, cake day is 3/1. | |
# Cake day begins at exact account creation time. | |
is_cakeday = cakeday_start + day <= now <= cakeday_start + (2 * day) | |
else: | |
is_cakeday = cakeday_start <= now <= cakeday_start + day | |
if is_cakeday: | |
message = message + ' | ' + bold(color('Cake day', colors.LIGHT_PURPLE)) | |
if commanded: | |
message = message + ' | https://reddit.com/u/' + u.name | |
if u.is_gold: | |
message = message + ' | ' + bold(color('Gold', colors.YELLOW)) | |
if u.is_mod: | |
message = message + ' | ' + bold(color('Mod', colors.GREEN)) | |
message = message + (' | Link: ' + str(u.link_karma) + | |
' | Comment: ' + str(u.comment_karma)) | |
bot.say(message) |
Not sure what happened @RustyBower but please deduplicate and make sure you don't undo any of #1486 (which touched a bit of stuff, including making sure that "2/29" and "3/1" in the cake-day comment match—one of your comments is still the old "2/29" and "1/3" mismatched one).
sprays @Exirel with water bad kitty, review more carefully!
7669879
to
cf7284d
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.
I'd say this is one more nitpicking review for good measure, but this isn't a nitpick… it's a bug that will break handling reddit links unless it's fixed. 😆
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.
Tested and found a problem that appears unrelated to any of these changes. Giving it the go-ahead while I turn my attention to figuring out the other issue.
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.
AFAICT, 🚢