[Lint] Use Black to auto-format code

The move to using auto-formatter makes it easier to read, submit and
speeds up development time. https://github.com/ambv/black/

Although I would prefer 79 chars, the default line length of 88 chars
used by black suffices. The flake8 line length remains at 120 chars
since black does not touch comments or docstrings and this will require
another round of fixes.

The only black setting that is not standard is the use of double-quotes
for strings so disabled any formatting of these. Note however that
flake8 will still flag usage of double-quotes. I may change my mind on
double vs single quotes but for now leave them.

A new pyproject.toml file has been created for black configuration.
This commit is contained in:
Calum Lind 2018-10-02 15:39:51 +01:00
commit b1cdc32f73
233 changed files with 9460 additions and 4112 deletions

View file

@ -29,7 +29,13 @@ __builtin__.__dict__['_n'] = lambda s, p, n: s if n == 1 else p
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
sys.path.append(os.path.abspath(os.path.join(os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.pardir)))
sys.path.append(
os.path.abspath(
os.path.join(
os.path.join(os.path.dirname(__file__), os.path.pardir), os.path.pardir
)
)
)
class Mock(object):
@ -58,11 +64,25 @@ class Mock(object):
MOCK_MODULES = [
'deluge.ui.gtkui.gtkui', 'deluge._libtorrent',
'libtorrent', 'psyco',
'pygtk', 'gtk', 'gobject', 'gtk.gdk', 'pango', 'cairo', 'pangocairo',
'curses', 'win32api', 'win32file', 'win32process', 'win32pipe',
'pywintypes', 'win32con', 'win32event',
'deluge.ui.gtkui.gtkui',
'deluge._libtorrent',
'libtorrent',
'psyco',
'pygtk',
'gtk',
'gobject',
'gtk.gdk',
'pango',
'cairo',
'pangocairo',
'curses',
'win32api',
'win32file',
'win32process',
'win32pipe',
'pywintypes',
'win32con',
'win32event',
]
for mod_name in MOCK_MODULES:
@ -218,8 +238,7 @@ htmlhelp_basename = 'delugedoc'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]).
latex_documents = [
('index', 'deluge.tex', 'deluge Documentation',
'Deluge Team', 'manual'),
('index', 'deluge.tex', 'deluge Documentation', 'Deluge Team', 'manual')
]
# The name of an image file (relative to this directory) to place at the top of