-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Python3
Johnny Robeson edited this page Sep 4, 2016
·
54 revisions
We're in the process of porting the entire beets codebase to Python 3.x.
-
exceptions must use
except A as B:
instead ofexcept A, B:
-
calls to
map()
should be wrapped inlist()
when a list is expected as it returns aniter
in python 3
- add python 3 to trove classification
- check documentation for 2.x, 3.x references
- check wiki for 2.x, 3.x references
- remove
u'
(andu"
) prefixes from code - remove
u'
(andu"
) prefixes from documentation - remove
u'
(andu"
) prefixes from wiki - run 2to3 to make sure we got everything
- audit all calls to open() (or any other I/O) to see if we can read/write them as text vs binary
- remove any PY2/3 version checks and the related code
- remove any usage of six
- remove
# -*- coding: utf-8 -*-
from all python files - replace buffer with memoryview
- replace
codecs.open
,io.open
withopen
- use explicit keyword arg names in function definitions - PY2:
def foo(.., **kwargs)
-> PY3:def foo(.., arg1=None, arg2=None, ...)
as per https://docs.python.org/3.3/tutorial/controlflow.html#arbitrary-argument-lists - use
str.format
style ({}
) inbeets.logger
or drop it completely https://docs.python.org/3/whatsnew/3.2.html#logging - Remove
F405
from flake8ignore
configurtion ifbeets.logging
is replaced - change
flake8-coding
configuration tono-accept-encodings
- use more 3.x only functions from shutil to replace some of the functions in
beets.util
https://docs.python.org/3.4/library/shutil.html (TODO: be more specific) - drop
mock
dep since it's part of the stdlib (py >= 3.3) - replace deprecated
inspect.getargspec
- Remove unnecessary traceback passing in
HumanReadableException