-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
remove Python 2 crumbs #35
Conversation
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.
Thank you!
@@ -172,7 +159,7 @@ def search_irc_logs(query, stats=None, where=DEFAULT_LOGFILE_PATH, | |||
elif event == LogParser.NICKCHANGE: | |||
text, oldnick, newnick = info | |||
else: | |||
text = unicode(info) | |||
text = str(info) |
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.
TBH at this point info
should already be Unicode, so
text = str(info) | |
text = info |
should work fine.
I'm not sure why the old code was doing unicode()
. Maybe to avoid hard errors in case I introduce a new event type that returns a tuple?
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.
This doesn't hurt either ... I don't know enough. The defaukt thing I would do for my projects is adding annotations everywhere.
elif isinstance(o, str): | ||
return repr(o).lstrip('u') | ||
else: | ||
return repr(o) |
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 no need to .lstrip('u')
on Python 3, so this simplifies down to
elif isinstance(o, str): | |
return repr(o).lstrip('u') | |
else: | |
return repr(o) | |
else: | |
return repr(o) |
CGI support might have to be dropped. Luckily, I added WSGI support a while back. I think it'll be mostly documentation changes, some code removal, and a major version bump. |
src/irclog2html/irclogsearch.py
Outdated
except NameError: | ||
# Python 3.x | ||
unicode = str | ||
|
||
|
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.
flake8 says
src/irclog2html/irclogsearch.py:49:1: E303 too many blank lines (3)
(and I cannot stop thinking that there ought to be a way to have GitHub Actions run a linter and annotate the actual diff with the comments, but I've never seen it done for a Python project.)
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.
Looks good to me!
I'm seeing CI failures in AppVeyor, but I don't see how they could be caused by your changes. I'll investigate.
Git bisect blames commit 3d8ab24. Oh! It's because the two |
Hi. I can fix this when I m back on Tuesday. Thanks for finding this out, I was confused. "less is more" |
I'm doing this through GitHub's review UI, and I have doubts that it will remove the correct number of blank lines (2).
Hi, I hope you like it.
cgi
is being removed in Python 3.13(?), I'll look at it later"mock is now part of the Python standard library, available as unittest.mock in Python 3.3 onwards."
https://github.com/testing-cabal/mock