flake8: Add hacking
This commit is contained in:
parent
735db072c6
commit
642dc46ba9
@ -1228,7 +1228,8 @@ class DownloadManager(QAbstractListModel):
|
|||||||
def flags(self, _index):
|
def flags(self, _index):
|
||||||
"""Override flags so items aren't selectable.
|
"""Override flags so items aren't selectable.
|
||||||
|
|
||||||
The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable."""
|
The default would be Qt.ItemIsEnabled | Qt.ItemIsSelectable.
|
||||||
|
"""
|
||||||
return Qt.ItemIsEnabled | Qt.ItemNeverHasChildren
|
return Qt.ItemIsEnabled | Qt.ItemNeverHasChildren
|
||||||
|
|
||||||
def rowCount(self, parent=QModelIndex()):
|
def rowCount(self, parent=QModelIndex()):
|
||||||
|
@ -261,7 +261,8 @@ class CommandRunner(QObject):
|
|||||||
"""Run a command and display exceptions in the statusbar.
|
"""Run a command and display exceptions in the statusbar.
|
||||||
|
|
||||||
Contrary to run_safely, error messages are queued so this is more
|
Contrary to run_safely, error messages are queued so this is more
|
||||||
suitable to use while initializing."""
|
suitable to use while initializing.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
self.run(text, count)
|
self.run(text, count)
|
||||||
except (cmdexc.CommandMetaError, cmdexc.CommandError) as e:
|
except (cmdexc.CommandMetaError, cmdexc.CommandError) as e:
|
||||||
|
@ -147,7 +147,8 @@ class TabCompletionModel(base.BaseCompletionModel):
|
|||||||
|
|
||||||
"""A model to complete on open tabs across all windows.
|
"""A model to complete on open tabs across all windows.
|
||||||
|
|
||||||
Used for switching the buffer command."""
|
Used for switching the buffer command.
|
||||||
|
"""
|
||||||
|
|
||||||
# https://github.com/The-Compiler/qutebrowser/issues/545
|
# https://github.com/The-Compiler/qutebrowser/issues/545
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
|
@ -32,7 +32,8 @@ class UrlCompletionModel(base.BaseCompletionModel):
|
|||||||
|
|
||||||
"""A model which combines bookmarks, quickmarks and web history URLs.
|
"""A model which combines bookmarks, quickmarks and web history URLs.
|
||||||
|
|
||||||
Used for the `open` command."""
|
Used for the `open` command.
|
||||||
|
"""
|
||||||
|
|
||||||
# https://github.com/The-Compiler/qutebrowser/issues/545
|
# https://github.com/The-Compiler/qutebrowser/issues/545
|
||||||
# pylint: disable=abstract-method
|
# pylint: disable=abstract-method
|
||||||
|
@ -198,7 +198,8 @@ class _CrashDialog(QDialog):
|
|||||||
def _init_text(self):
|
def _init_text(self):
|
||||||
"""Initialize the main text to be displayed on an exception.
|
"""Initialize the main text to be displayed on an exception.
|
||||||
|
|
||||||
Should be extended by subclasses to set the actual text."""
|
Should be extended by subclasses to set the actual text.
|
||||||
|
"""
|
||||||
self._lbl = QLabel(wordWrap=True, openExternalLinks=True,
|
self._lbl = QLabel(wordWrap=True, openExternalLinks=True,
|
||||||
textInteractionFlags=Qt.LinksAccessibleByMouse)
|
textInteractionFlags=Qt.LinksAccessibleByMouse)
|
||||||
self._vbox.addWidget(self._lbl)
|
self._vbox.addWidget(self._lbl)
|
||||||
|
@ -267,7 +267,8 @@ def remove_inputhook():
|
|||||||
"""Remove the PyQt input hook.
|
"""Remove the PyQt input hook.
|
||||||
|
|
||||||
Doing this means we can't use the interactive shell anymore (which we don't
|
Doing this means we can't use the interactive shell anymore (which we don't
|
||||||
anyways), but we can use pdb instead."""
|
anyways), but we can use pdb instead.
|
||||||
|
"""
|
||||||
from PyQt5.QtCore import pyqtRemoveInputHook
|
from PyQt5.QtCore import pyqtRemoveInputHook
|
||||||
pyqtRemoveInputHook()
|
pyqtRemoveInputHook()
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ import os
|
|||||||
def get_latest_pdfjs_url():
|
def get_latest_pdfjs_url():
|
||||||
"""Get the URL of the latest pdf.js prebuilt package.
|
"""Get the URL of the latest pdf.js prebuilt package.
|
||||||
|
|
||||||
Returns a (version, url)-tuple."""
|
Returns a (version, url)-tuple.
|
||||||
|
"""
|
||||||
github_api = 'https://api.github.com'
|
github_api = 'https://api.github.com'
|
||||||
endpoint = 'repos/mozilla/pdf.js/releases/latest'
|
endpoint = 'repos/mozilla/pdf.js/releases/latest'
|
||||||
request_url = '{}/{}'.format(github_api, endpoint)
|
request_url = '{}/{}'.format(github_api, endpoint)
|
||||||
|
@ -31,6 +31,10 @@ exclude = .venv,.hypothesis,.git,__pycache__,resources.py
|
|||||||
# (PEP257 got changed, but let's stick to the old standard)
|
# (PEP257 got changed, but let's stick to the old standard)
|
||||||
# D402: First line should not be function's signature (false-positives)
|
# D402: First line should not be function's signature (false-positives)
|
||||||
# FI10 - FI15: __future__ import missing
|
# FI10 - FI15: __future__ import missing
|
||||||
|
# H201: bare except
|
||||||
|
# H238: Use new-stule classes
|
||||||
|
# H301: one import per line
|
||||||
|
# H306: imports not in alphabetical order
|
||||||
ignore =
|
ignore =
|
||||||
E128,E226,E265,E501,E402,E266,
|
E128,E226,E265,E501,E402,E266,
|
||||||
F401,
|
F401,
|
||||||
@ -38,7 +42,8 @@ ignore =
|
|||||||
L101,L102,L103,L201,L202,L203,L204,L207,L302,
|
L101,L102,L103,L201,L202,L203,L204,L207,L302,
|
||||||
P101,P102,P103,
|
P101,P102,P103,
|
||||||
D102,D103,D104,D105,D209,D211,D402,
|
D102,D103,D104,D105,D209,D211,D402,
|
||||||
FI10,FI11,FI12,FI13,FI14,FI15
|
FI10,FI11,FI12,FI13,FI14,FI15,
|
||||||
|
H201,H238,H301,H306
|
||||||
max-complexity = 12
|
max-complexity = 12
|
||||||
putty-ignore =
|
putty-ignore =
|
||||||
/# pylint: disable=invalid-name/ : +N801,N806
|
/# pylint: disable=invalid-name/ : +N801,N806
|
||||||
|
@ -326,7 +326,8 @@ def compare_session(quteproc, expected):
|
|||||||
def no_crash():
|
def no_crash():
|
||||||
"""Don't do anything.
|
"""Don't do anything.
|
||||||
|
|
||||||
This is actually a NOP as a crash is already checked in the log."""
|
This is actually a NOP as a crash is already checked in the log.
|
||||||
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,8 +46,7 @@ def percentage(qtbot):
|
|||||||
(5, '[ 5%]'),
|
(5, '[ 5%]'),
|
||||||
])
|
])
|
||||||
def test_percentage_text(percentage, y, expected):
|
def test_percentage_text(percentage, y, expected):
|
||||||
"""
|
"""Test text displayed by the widget based on the y position of a page.
|
||||||
Test text displayed by the widget based on the y position of a page.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
y: y position of the page as an int in the range [0, 100].
|
y: y position of the page as an int in the range [0, 100].
|
||||||
|
@ -104,8 +104,7 @@ foo\ bar/foo bar/foo\ bar/
|
|||||||
|
|
||||||
|
|
||||||
def _parse_split_test_data_str():
|
def _parse_split_test_data_str():
|
||||||
"""
|
"""Parse the test data set into a namedtuple to use in tests.
|
||||||
Parse the test data set into a namedtuple to use in tests.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A list of namedtuples with str attributes: input, keep, no_keep
|
A list of namedtuples with str attributes: input, keep, no_keep
|
||||||
|
1
tox.ini
1
tox.ini
@ -161,6 +161,7 @@ deps =
|
|||||||
flake8-tuple==0.2.9
|
flake8-tuple==0.2.9
|
||||||
flake8-tidy-imports==1.0.0
|
flake8-tidy-imports==1.0.0
|
||||||
flake8-future-import==0.3.0
|
flake8-future-import==0.3.0
|
||||||
|
hacking==0.10.2
|
||||||
pep257==0.7.0 # still needed by flake8-docstrings but ignored
|
pep257==0.7.0 # still needed by flake8-docstrings but ignored
|
||||||
pydocstyle==1.0.0
|
pydocstyle==1.0.0
|
||||||
commands =
|
commands =
|
||||||
|
Loading…
Reference in New Issue
Block a user