-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
pyupgrade of beets to Python 3.6 #4030
Conversation
All tests working More tidy up to be done
Fix imports Fix formatting
I do not know why py-lint fails, but running the same command |
I found the following for the Python 3.10 failures: |
Cool; many thanks for wrangling this!! A detailed line-by-line review is also in order, but this all looks pretty good on a (very) cursory glance. As for the lint error, I think we'll want to remove Line 124 in 75223ee
And its configuration in Line 22 in 75223ee
It's likely that you're not seeing the errors locally because |
That was it 👍 We also need to remove the |
Great; good catch! I had to look it up, but the default source encoding was indeed UTF-8 as of 3.0, thanks to PEP 3120. |
sys.version tests are next |
How do you want me to pull in the updates to Master? |
Ah, great question—sorry for letting this fall out of date! Any option is fine with me, TBH (merging in master here, rebasing, etc.)—all options seem perfectly good to me. |
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.
Wow! This is an enormous diff, but I think I've now reviewed the whole thing. I only found a few very minor/superficial comments. Aside from that, I think we should merge this as soon as possible! So excited to be rid of the dependency on six
.
@@ -108,7 +106,7 @@ def assign_items(items, tracks): | |||
log.debug('...done.') | |||
|
|||
# Produce the output matching. | |||
mapping = dict((items[i], tracks[j]) for (i, j) in matching) | |||
mapping = {items[i]: tracks[j] for (i, j) in matching} |
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 is a clever improvement. Nice work, pyupgrade.
BASE_URL = 'https://musicbrainz.org/' | ||
else: | ||
BASE_URL = 'http://musicbrainz.org/' | ||
BASE_URL = 'https://musicbrainz.org/' |
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.
Really great that we can get rid of this check.
values = dict((k, v) for (k, v) in cols.items() | ||
if not k[:4] == 'flex') | ||
values = {k: v for (k, v) in cols.items() | ||
if not k[:4] == 'flex'} |
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.
Could be k.endswith('flex')
, I suppose.
@@ -1317,17 +1317,16 @@ def read_tasks(session): | |||
|
|||
# Generate tasks. | |||
task_factory = ImportTaskFactory(toppath, session) | |||
for t in task_factory.tasks(): | |||
yield t | |||
yield from task_factory.tasks() |
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.
Wahoo! One of my favorite Python 3 quality-of-life syntax features.
'album_id': types.FOREIGN_ID, | ||
|
||
'title': types.STRING, |
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.
It's a little sad to lose this table-like formatting, which did make this listing more readable, but I suppose it's not that big of a deal.
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.
Happy to reformat
beetsplug/mpdstats.py
Outdated
else: | ||
# On Python 3, python-mpd2 always uses Unicode | ||
self.client = mpd.MPDClient() | ||
# On Python 3, python-mpd2 always uses Unicode |
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 comment is maybe not necessary anymore.
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.
Deleted
@@ -1,5 +1,5 @@ | |||
[flake8] | |||
min-version = 2.7 | |||
min-version = 3.6 |
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 catch; I left this one out.
@@ -87,7 +85,6 @@ def build_manpages(): | |||
}, | |||
|
|||
install_requires=[ | |||
'six>=1.9', |
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.
🎉 🎉 🎉
test/rsrc/convert_stub.py
Outdated
# if platform.system() == 'Windows' and PY2: | ||
# in_file = in_file.decode('utf-8') | ||
# out_file = out_file.decode('utf-8') |
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.
Probably OK to delete?
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.
deleted
@sampsyo I believe I have addressed the feedback |
Truly heroic, @arogl. This is so awesome. |
WIP - Attempt to upgrade to Python 3.6 as a minimum
All tests pass/fail the same as Master in both Windows (PY38) and Linux (PY38)
Pushing to get the tests to run
I used the following tool to convert https://github.com/asottile/pyupgrade
pyupgrade --py36-plus
To Do
docs/
to describe it.)docs/changelog.rst
near the top of the document.)