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. |
sampsyo
left a comment
There was a problem hiding this comment.
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.
|
|
||
| # 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.
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.
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.
Could be k.endswith('flex'), I suppose.
| 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.
Wahoo! One of my favorite Python 3 quality-of-life syntax features.
| 'path': PathType(), | ||
| 'album_id': types.FOREIGN_ID, | ||
|
|
||
| 'title': types.STRING, |
There was a problem hiding this comment.
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.
| 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.
This comment is maybe not necessary anymore.
| @@ -1,5 +1,5 @@ | |||
| [flake8] | |||
| min-version = 2.7 | |||
| min-version = 3.6 | |||
There was a problem hiding this comment.
Nice catch; I left this one out.
| }, | ||
|
|
||
| install_requires=[ | ||
| 'six>=1.9', |
| # if platform.system() == 'Windows' and PY2: | ||
| # in_file = in_file.decode('utf-8') | ||
| # out_file = out_file.decode('utf-8') |
|
@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-plusTo Do
docs/to describe it.)docs/changelog.rstnear the top of the document.)