Remove unnecessary pass statements

This commit is contained in:
Florian Bruhin 2018-11-28 11:26:40 +01:00
parent 5ed3fb723d
commit 2453134011
29 changed files with 1 additions and 127 deletions

View File

@ -60,8 +60,6 @@ class UnsupportedAttribute:
supported with QtWebengine.
"""
pass
class UnsupportedOperationError(Exception):

View File

@ -49,8 +49,6 @@ class WebInspectorError(Exception):
"""Raised when the inspector could not be initialized."""
pass
class AbstractWebInspector(QWidget):

View File

@ -35,15 +35,11 @@ class ParseProxyError(Exception):
"""Error while parsing PAC result string."""
pass
class EvalProxyError(Exception):
"""Error while evaluating PAC script."""
pass
def _js_slot(*args):
"""Wrap a methods as a JavaScript function.

View File

@ -61,36 +61,26 @@ class Error(Exception):
"""Exception for generic errors on a qute:// page."""
pass
class NotFoundError(Error):
"""Raised when the given URL was not found."""
pass
class SchemeOSError(Error):
"""Raised when there was an OSError inside a handler."""
pass
class UrlInvalidError(Error):
"""Raised when an invalid URL was opened."""
pass
class RequestDeniedError(Error):
"""Raised when the request is forbidden."""
pass
class Redirect(Exception):

View File

@ -43,29 +43,21 @@ class Error(Exception):
"""Base class for all errors in this module."""
pass
class InvalidUrlError(Error):
"""Exception emitted when a URL is invalid."""
pass
class DoesNotExistError(Error):
"""Exception emitted when a given URL does not exist."""
pass
class AlreadyExistsError(Error):
"""Exception emitted when a given URL does already exist."""
pass
class UrlMarkManager(QObject):

View File

@ -34,15 +34,11 @@ class Error(Exception):
"""Base class for WebElement errors."""
pass
class OrphanedError(Error):
"""Raised when a webelement's parent has vanished."""
pass
def css_selector(group, url):
"""Get a CSS selector for the given group/URL."""

View File

@ -516,7 +516,6 @@ class _NoCloseBytesIO(io.BytesIO):
def close(self):
"""Do nothing."""
pass
def actual_close(self):
"""Close the stream."""

View File

@ -67,7 +67,6 @@ class FixedDataNetworkReply(QNetworkReply):
@pyqtSlot()
def abort(self):
"""Abort the operation."""
pass
def bytesAvailable(self):
"""Determine the bytes available for being read.
@ -123,7 +122,6 @@ class ErrorNetworkReply(QNetworkReply):
def abort(self):
"""Do nothing since it's a fake reply."""
pass
def bytesAvailable(self):
"""We always have 0 bytes available."""
@ -151,7 +149,6 @@ class RedirectNetworkReply(QNetworkReply):
def abort(self):
"""Called when there's e.g. a redirection limit."""
pass
def readData(self, _maxlen):
return bytes()

View File

@ -31,8 +31,6 @@ class IsNullError(webelem.Error):
"""Gets raised by WebKitElement if an element is null."""
pass
class WebKitElement(webelem.AbstractWebElement):

View File

@ -41,7 +41,6 @@ class WebHistoryInterface(QWebHistoryInterface):
def addHistoryEntry(self, url_string):
"""Required for a QWebHistoryInterface impl, obsoleted by add_url."""
pass
@functools.lru_cache(maxsize=32768)
def historyContains(self, url_string):

View File

@ -32,22 +32,16 @@ class CommandError(Error):
"""Raised when a command encounters an error while running."""
pass
class NoSuchCommandError(Error):
"""Raised when a command wasn't found."""
pass
class ArgumentTypeError(Error):
"""Raised when an argument had an invalid type."""
pass
class PrerequisitesError(Error):
@ -56,5 +50,3 @@ class PrerequisitesError(Error):
This is raised for example when we're in the wrong mode while executing the
command, or we need javascript enabled but don't have done so.
"""
pass

View File

@ -28,8 +28,6 @@ class Error(Exception):
"""Base exception for config-related errors."""
pass
class NoAutoconfigError(Error):

View File

@ -25,5 +25,3 @@ from qutebrowser.mainwindow.statusbar import textbase
class KeyString(textbase.TextBase):
"""Keychain string displayed in the statusbar."""
pass

View File

@ -29,15 +29,11 @@ class HistoryEmptyError(Exception):
"""Raised when the history is empty."""
pass
class HistoryEndReachedError(Exception):
"""Raised when the end of the history is reached."""
pass
class History(QObject):

View File

@ -197,7 +197,6 @@ class _CrashDialog(QDialog):
def _init_checkboxes(self):
"""Initialize the checkboxes."""
pass
def _init_buttons(self):
"""Initialize the buttons."""
@ -569,7 +568,6 @@ class ReportDialog(_CrashDialog):
def _init_info_text(self):
"""We don't want an info text as the user wanted to report."""
pass
def _get_error_type(self):
return 'report'

View File

@ -72,8 +72,6 @@ class SqlEnvironmentError(SqlError):
disk or I/O errors), where qutebrowser isn't to blame.
"""
pass
class SqlBugError(SqlError):
@ -82,8 +80,6 @@ class SqlBugError(SqlError):
This is raised for errors resulting from a qutebrowser bug.
"""
pass
def raise_sqlite_error(msg, error):
"""Raise either a SqlBugError or SqlEnvironmentError."""

View File

@ -370,7 +370,6 @@ def window_only(current_win_id):
@cmdutils.register()
def nop():
"""Do nothing."""
pass
@cmdutils.register()

View File

@ -42,8 +42,6 @@ class RegistryUnavailableError(Exception):
"""Exception raised when a certain registry does not exist yet."""
pass
class NoWindow(Exception):

View File

@ -630,7 +630,6 @@ def open_file(filename, cmdline=None):
def unused(_arg):
"""Function which does nothing to avoid pylint complaining."""
pass
def expand_windows_drive(path):

View File

@ -33,8 +33,6 @@ class Error(Exception):
"""Exception for errors in this module."""
pass
def parse():
"""Parse command line arguments."""

View File

@ -34,8 +34,6 @@ class Error(Exception):
"""Exception raised when linking fails."""
pass
def run_py(executable, *code):
"""Run the given python code with the given executable."""

View File

@ -842,8 +842,6 @@ class YamlLoader(yaml.SafeLoader):
"""Custom YAML loader used in compare_session."""
pass
# Translate ... to ellipsis in YAML.
YamlLoader.add_constructor('!ellipsis', lambda loader, node: ...)

View File

@ -39,15 +39,11 @@ class InvalidLine(Exception):
"""Raised when the process prints a line which is not parsable."""
pass
class ProcessExited(Exception):
"""Raised when the child process did exit."""
pass
class WaitForTimeout(Exception):
@ -271,7 +267,6 @@ class Process(QObject):
def _after_start(self):
"""Do things which should be done immediately after starting."""
pass
def before_test(self):
"""Restart process before a test if it exited before."""
@ -443,7 +438,6 @@ class Process(QObject):
QuteProc._maybe_skip, and call _maybe_skip after every parsed message
in wait_for (where it's most likely that new messages arrive).
"""
pass
def wait_for(self, timeout=None, *, override_waited_for=False,
do_skip=False, divisor=1, after=None, **kwargs):

View File

@ -306,7 +306,6 @@ class FakeSignal:
Currently does nothing, but could be improved to do some sanity
checking on the slot.
"""
pass
def disconnect(self, slot=None):
"""Disconnect the signal from a slot.
@ -314,7 +313,6 @@ class FakeSignal:
Currently does nothing, but could be improved to do some sanity
checking on the slot and see if it actually got connected.
"""
pass
def emit(self, *args):
"""Emit the signal.
@ -322,7 +320,6 @@ class FakeSignal:
Currently does nothing, but could be improved to do type checking based
on a signature given to __init__.
"""
pass
@attr.s
@ -457,8 +454,6 @@ class BookmarkManagerStub(UrlMarkManagerStub):
"""Stub for the bookmark-manager object."""
pass
class QuickmarkManagerStub(UrlMarkManagerStub):

View File

@ -48,7 +48,6 @@ def _get_cmd(*args, **kwargs):
@cmdutils.register(*args, **kwargs)
def fun():
"""Blah."""
pass
return cmdutils.cmd_dict['fun']
@ -83,7 +82,6 @@ class TestRegister:
@cmdutils.register()
def fun():
"""Blah."""
pass
cmd = cmdutils.cmd_dict['fun']
assert cmd.handler is fun
@ -95,7 +93,6 @@ class TestRegister:
@cmdutils.register()
def eggs_bacon():
"""Blah."""
pass
assert cmdutils.cmd_dict['eggs-bacon'].name == 'eggs-bacon'
assert 'eggs_bacon' not in cmdutils.cmd_dict
@ -105,7 +102,6 @@ class TestRegister:
@cmdutils.register()
def Test(): # noqa: N801,N806 pylint: disable=invalid-name
"""Blah."""
pass
assert cmdutils.cmd_dict['test'].name == 'test'
assert 'Test' not in cmdutils.cmd_dict
@ -115,7 +111,6 @@ class TestRegister:
@cmdutils.register(name='foobar')
def fun():
"""Blah."""
pass
assert cmdutils.cmd_dict['foobar'].name == 'foobar'
assert 'fun' not in cmdutils.cmd_dict
@ -126,20 +121,17 @@ class TestRegister:
@cmdutils.register(name='foobar')
def fun():
"""Blah."""
pass
with pytest.raises(ValueError):
@cmdutils.register(name='foobar')
def fun2():
"""Blah."""
pass
def test_instance(self):
"""Make sure the instance gets passed to Command."""
@cmdutils.register(instance='foobar')
def fun(self):
"""Blah."""
pass
assert cmdutils.cmd_dict['fun']._instance == 'foobar'
def test_star_args(self):
@ -147,7 +139,6 @@ class TestRegister:
@cmdutils.register()
def fun(*args):
"""Blah."""
pass
with pytest.raises(argparser.ArgumentParserError):
cmdutils.cmd_dict['fun'].parser.parse_args([])
@ -195,14 +186,12 @@ class TestRegister:
@cmdutils.argument('arg1', flag='b')
def fun(arg1=False, arg2=False):
"""Blah."""
pass
def test_win_id(self):
@cmdutils.register()
@cmdutils.argument('win_id', win_id=True)
def fun(win_id):
"""Blah."""
pass
assert cmdutils.cmd_dict['fun']._get_call_args(42) == ([42], {})
def test_count(self):
@ -210,7 +199,6 @@ class TestRegister:
@cmdutils.argument('count', count=True)
def fun(count=0):
"""Blah."""
pass
assert cmdutils.cmd_dict['fun']._get_call_args(42) == ([0], {})
def test_count_without_default(self):
@ -220,7 +208,6 @@ class TestRegister:
@cmdutils.argument('count', count=True)
def fun(count):
"""Blah."""
pass
@pytest.mark.parametrize('hide', [True, False])
def test_pos_args(self, hide):
@ -228,7 +215,6 @@ class TestRegister:
@cmdutils.argument('arg', hide=hide)
def fun(arg):
"""Blah."""
pass
pos_args = cmdutils.cmd_dict['fun'].pos_args
if hide:
@ -283,7 +269,6 @@ class TestRegister:
@cmdutils.argument('arg', choices=['foo', 'bar'])
def fun(arg):
"""Blah."""
pass
cmd = cmdutils.cmd_dict['fun']
cmd.namespace = cmd.parser.parse_args(['fish'])
@ -297,7 +282,6 @@ class TestRegister:
@cmdutils.argument('arg', choices=['foo', 'bar'])
def fun(*, arg='foo'):
"""Blah."""
pass
cmd = cmdutils.cmd_dict['fun']
cmd.namespace = cmd.parser.parse_args(['--arg=fish'])
@ -312,7 +296,6 @@ class TestRegister:
@cmdutils.argument('opt')
def fun(foo, bar, opt=False):
"""Blah."""
pass
cmd = cmdutils.cmd_dict['fun']
assert cmd.get_pos_arg_info(0) == command.ArgInfo(choices=('a', 'b'))
@ -324,7 +307,6 @@ class TestRegister:
# https://github.com/qutebrowser/qutebrowser/issues/1872
def fun(*, target):
"""Blah."""
pass
with pytest.raises(TypeError, match="fun: handler has keyword only "
"argument 'target' without default!"):
@ -334,7 +316,6 @@ class TestRegister:
# https://github.com/qutebrowser/qutebrowser/issues/1872
def fun(*, target: int):
"""Blah."""
pass
with pytest.raises(TypeError, match="fun: handler has keyword only "
"argument 'target' without default!"):
@ -350,14 +331,12 @@ class TestArgument:
@cmdutils.argument('foo')
def fun(bar):
"""Blah."""
pass
def test_storage(self):
@cmdutils.argument('foo', flag='x')
@cmdutils.argument('bar', flag='y')
def fun(foo, bar):
"""Blah."""
pass
expected = {
'foo': command.ArgInfo(flag='x'),
'bar': command.ArgInfo(flag='y')
@ -372,7 +351,6 @@ class TestArgument:
@cmdutils.register()
def fun(bar):
"""Blah."""
pass
def test_count_and_win_id_same_arg(self):
with pytest.raises(TypeError,
@ -380,7 +358,6 @@ class TestArgument:
@cmdutils.argument('arg', count=True, win_id=True)
def fun(arg=0):
"""Blah."""
pass
def test_no_docstring(self, caplog):
with caplog.at_level(logging.WARNING):
@ -388,6 +365,7 @@ class TestArgument:
def fun():
# no docstring
pass
assert len(caplog.records) == 1
assert caplog.messages[0].endswith('test_cmdutils.py has no docstring')
@ -398,7 +376,6 @@ class TestArgument:
@cmdutils.register()
def fun():
# no docstring
pass
class TestRun:
@ -441,7 +418,6 @@ class TestRun:
backend=usertypes.Backend.QtWebEngine)
def fun(self):
"""Blah."""
pass
monkeypatch.setattr(command.objects, 'backend',
usertypes.Backend.QtWebKit)

View File

@ -105,35 +105,29 @@ def cmdutils_patch(monkeypatch, stubs, miscmodels_patch):
@cmdutils.argument('value', completion=miscmodels_patch.value)
def set_command(section_=None, option=None, value=None):
"""docstring."""
pass
@cmdutils.argument('topic', completion=miscmodels_patch.helptopic)
def show_help(tab=False, bg=False, window=False, topic=None):
"""docstring."""
pass
@cmdutils.argument('url', completion=miscmodels_patch.url)
@cmdutils.argument('count', count=True)
def openurl(url=None, related=False, bg=False, tab=False, window=False,
count=None):
"""docstring."""
pass
@cmdutils.argument('win_id', win_id=True)
@cmdutils.argument('command', completion=miscmodels_patch.command)
def bind(key, win_id, command=None, *, mode='normal'):
"""docstring."""
pass
def tab_give():
"""docstring."""
pass
@cmdutils.argument('option', completion=miscmodels_patch.option)
@cmdutils.argument('values', completion=miscmodels_patch.value)
def config_cycle(option, *values):
"""For testing varargs."""
pass
cmd_utils = stubs.FakeCmdUtils({
'set': command.Command(name='set', handler=set_command),

View File

@ -336,8 +336,6 @@ class SavefileTestException(Exception):
"""Exception raised in TestSavefileOpen for testing."""
pass
@pytest.mark.usefixtures('qapp')
class TestSavefileOpen:
@ -541,7 +539,6 @@ if test_file is not None:
def testReadinto_text(self):
"""Skip this test as BufferedIOBase seems to fail it."""
pass
class PyOtherFileTests(PyIODeviceTestMixin, test_file.OtherFileTests,
unittest.TestCase):
@ -550,11 +547,9 @@ if test_file is not None:
def testSetBufferSize(self):
"""Skip this test as setting buffer size is unsupported."""
pass
def testTruncateOnWindows(self):
"""Skip this test truncating is unsupported."""
pass
class FailingQIODevice(QIODevice):

View File

@ -409,8 +409,6 @@ class GotException(Exception):
"""Exception used for TestDisabledExcepthook."""
pass
def excepthook(_exc, _val, _tb):
pass
@ -512,8 +510,6 @@ class Obj:
"""Test object for test_get_repr()."""
pass
@pytest.mark.parametrize('constructor, attrs, expected', [
(False, {}, '<test_utils.Obj>'),
@ -534,12 +530,10 @@ class QualnameObj():
def func(self):
"""Test method for test_qualname."""
pass
def qualname_func(_blah):
"""Test function for test_qualname."""
pass
QUALNAME_OBJ = QualnameObj()
@ -578,8 +572,6 @@ class TestIsEnum:
"""Test class for is_enum."""
pass
assert not utils.is_enum(Test)
def test_object(self):
@ -597,7 +589,6 @@ class TestRaises:
def do_nothing(self):
"""Helper function which does nothing."""
pass
@pytest.mark.parametrize('exception, value, expected', [
(ValueError, 'a', True),

View File

@ -29,8 +29,6 @@ class Parent(QObject):
"""Class for test_parent()."""
pass
def test_parent():
"""Make sure the parent is set correctly."""