Remove blank lines before """ in docstrings.

pep257 has changed in this regard so we reflect this change.
This commit is contained in:
Florian Bruhin 2014-04-10 14:21:27 +02:00
parent cba2d4d450
commit c5ca0e56be
33 changed files with 1 additions and 227 deletions

View File

@ -78,7 +78,6 @@ class QuteBrowser(QApplication):
_timers: List of used QTimers so they don't get GCed. _timers: List of used QTimers so they don't get GCed.
_shutting_down: True if we're currently shutting down. _shutting_down: True if we're currently shutting down.
_quit_status: The current quitting status. _quit_status: The current quitting status.
""" """
def __init__(self): def __init__(self):
@ -142,7 +141,6 @@ class QuteBrowser(QApplication):
Return: Return:
Argument namespace from argparse. Argument namespace from argparse.
""" """
parser = ArgumentParser("usage: %(prog)s [options]") parser = ArgumentParser("usage: %(prog)s [options]")
parser.add_argument('-l', '--log', dest='loglevel', parser.add_argument('-l', '--log', dest='loglevel',
@ -181,7 +179,6 @@ class QuteBrowser(QApplication):
"""Initialisation of the qutebrowser commands. """Initialisation of the qutebrowser commands.
Registers all commands, connects its signals, and sets up keyparser. Registers all commands, connects its signals, and sets up keyparser.
""" """
for key, cmd in sorted(cmdutils.cmd_dict.items()): for key, cmd in sorted(cmdutils.cmd_dict.items()):
cmd.signal.connect(self.command_handler) cmd.signal.connect(self.command_handler)
@ -197,7 +194,6 @@ class QuteBrowser(QApplication):
"""Process initial positional args. """Process initial positional args.
URLs to open have no prefix, commands to execute begin with a colon. URLs to open have no prefix, commands to execute begin with a colon.
""" """
# QNetworkAccessManager::createRequest will hang for over a second, so # QNetworkAccessManager::createRequest will hang for over a second, so
# we make sure the GUI is refreshed here, so the start seems faster. # we make sure the GUI is refreshed here, so the start seems faster.
@ -223,7 +219,6 @@ class QuteBrowser(QApplication):
This sets up the uncaught exception hook, quits with an appropriate This sets up the uncaught exception hook, quits with an appropriate
exit status, and handles Ctrl+C properly by passing control to the exit status, and handles Ctrl+C properly by passing control to the
Python interpreter once all 500ms. Python interpreter once all 500ms.
""" """
signal(SIGINT, lambda *args: self.exit(128 + SIGINT)) signal(SIGINT, lambda *args: self.exit(128 + SIGINT))
timer = QTimer() timer = QTimer()
@ -238,7 +233,6 @@ class QuteBrowser(QApplication):
Return: Return:
A list of open pages, or an empty list. A list of open pages, or an empty list.
""" """
pages = [] pages = []
if self.mainwindow is None: if self.mainwindow is None:
@ -268,7 +262,6 @@ class QuteBrowser(QApplication):
It'll try very hard to write all open tabs to a file, and then exit It'll try very hard to write all open tabs to a file, and then exit
gracefully. gracefully.
""" """
# pylint: disable=broad-except # pylint: disable=broad-except
@ -324,7 +317,6 @@ class QuteBrowser(QApplication):
Args: Args:
The sender of the quit signal (string) The sender of the quit signal (string)
""" """
self._quit_status[sender] = True self._quit_status[sender] = True
logging.debug("maybe_quit called from {}, quit status {}".format( logging.debug("maybe_quit called from {}, quit status {}".format(
@ -341,7 +333,6 @@ class QuteBrowser(QApplication):
Args: Args:
s: The string to evaluate. s: The string to evaluate.
""" """
try: try:
r = eval(s) r = eval(s)
@ -359,7 +350,6 @@ class QuteBrowser(QApplication):
Raises: Raises:
Always raises Exception. Always raises Exception.
""" """
raise Exception("Forced crash") raise Exception("Forced crash")
@ -373,7 +363,6 @@ class QuteBrowser(QApplication):
Args: Args:
do_quit: Whether to quit after shutting down. do_quit: Whether to quit after shutting down.
""" """
if self._shutting_down: if self._shutting_down:
return return
@ -406,7 +395,6 @@ class QuteBrowser(QApplication):
"""Quit application after a shutdown. """Quit application after a shutdown.
Gets called when all tabs finished shutting down after shutdown(). Gets called when all tabs finished shutting down after shutdown().
""" """
logging.debug("Shutdown complete, quitting.") logging.debug("Shutdown complete, quitting.")
self.quit() self.quit()
@ -423,7 +411,6 @@ class QuteBrowser(QApplication):
func: The function name to be called (as string). func: The function name to be called (as string).
count: The count given to the command, or None. count: The count given to the command, or None.
args: A list of arguments given to the command. args: A list of arguments given to the command.
""" """
(instance, func, count, args) = tpl (instance, func, count, args) = tpl
if instance == '': if instance == '':

View File

@ -43,7 +43,6 @@ class Command(QObject):
Signals: Signals:
signal: Gets emitted when something should be called via handle_command signal: Gets emitted when something should be called via handle_command
from the app.py context. from the app.py context.
""" """
# FIXME: # FIXME:
@ -75,7 +74,6 @@ class Command(QObject):
Raise: Raise:
ArgumentCountError if the argument count is wrong. ArgumentCountError if the argument count is wrong.
""" """
if self.nargs[1] is None and self.nargs[0] <= len(args): if self.nargs[1] is None and self.nargs[0] <= len(args):
pass pass
@ -101,7 +99,6 @@ class Command(QObject):
Emit: Emit:
signal: When the command has an instance and should be handled from signal: When the command has an instance and should be handled from
the app.py context. the app.py context.
""" """
dbgout = ["command called:", self.name] dbgout = ["command called:", self.name]
if args: if args:

View File

@ -18,7 +18,6 @@
"""Exception classes for commands modules. """Exception classes for commands modules.
Defined here to avoid circular dependency hell. Defined here to avoid circular dependency hell.
""" """

View File

@ -45,7 +45,6 @@ class KeyParser(QObject):
arg: Text to set. arg: Text to set.
keystring_updated: Emitted when the keystring is updated. keystring_updated: Emitted when the keystring is updated.
arg: New keystring. arg: New keystring.
""" """
set_cmd_text = pyqtSignal(str) set_cmd_text = pyqtSignal(str)
@ -72,7 +71,6 @@ class KeyParser(QObject):
Return: Return:
True if event has been handled, False otherwise. True if event has been handled, False otherwise.
""" """
MODMASK2STR = { MODMASK2STR = {
Qt.ControlModifier: 'Ctrl', Qt.ControlModifier: 'Ctrl',
@ -112,7 +110,6 @@ class KeyParser(QObject):
Emit: Emit:
set_cmd_text: If the keystring should be shown in the statusbar. set_cmd_text: If the keystring should be shown in the statusbar.
""" """
# FIXME maybe we can do this in an easier way by using QKeySeqyence # FIXME maybe we can do this in an easier way by using QKeySeqyence
# which has a matches method. # which has a matches method.
@ -170,7 +167,6 @@ class KeyParser(QObject):
A tuple (matchtype, hay) where matchtype is MATCH_DEFINITIVE, A tuple (matchtype, hay) where matchtype is MATCH_DEFINITIVE,
MATCH_PARTIAL or MATCH_NONE and hay is the long keystring where the MATCH_PARTIAL or MATCH_NONE and hay is the long keystring where the
part was found in. part was found in.
""" """
try: try:
cmdstr_hay = self._bindings[cmdstr_needle] cmdstr_hay = self._bindings[cmdstr_needle]
@ -196,7 +192,6 @@ class KeyParser(QObject):
Return: Return:
The normalized keystring. The normalized keystring.
""" """
replacements = [ replacements = [
('Control', 'Ctrl'), ('Control', 'Ctrl'),
@ -222,7 +217,6 @@ class KeyParser(QObject):
Emit: Emit:
set_cmd_text: If a partial command should be printed to the set_cmd_text: If a partial command should be printed to the
statusbar. statusbar.
""" """
try: try:
self.commandparser.run(cmdstr, count=count, ignore_exc=ignore_exc) self.commandparser.run(cmdstr, count=count, ignore_exc=ignore_exc)
@ -242,7 +236,6 @@ class KeyParser(QObject):
Args: Args:
sect: The section to get the keybindings from. sect: The section to get the keybindings from.
""" """
for (key, cmd) in sect.items(): for (key, cmd) in sect.items():
if key.startswith('@') and key.endswith('@'): if key.startswith('@') and key.endswith('@'):
@ -263,7 +256,6 @@ class KeyParser(QObject):
Emit: Emit:
keystring_updated: If a new keystring should be set. keystring_updated: If a new keystring should be set.
""" """
handled = self._handle_modifier_key(e) handled = self._handle_modifier_key(e)
if not handled: if not handled:

View File

@ -41,7 +41,6 @@ class SearchParser(QObject):
do_search: Emitted when a search should be started. do_search: Emitted when a search should be started.
arg 1: Search string. arg 1: Search string.
arg 2: Flags to use. arg 2: Flags to use.
""" """
do_search = pyqtSignal(str, 'QWebPage::FindFlags') do_search = pyqtSignal(str, 'QWebPage::FindFlags')
@ -60,7 +59,6 @@ class SearchParser(QObject):
Emit: Emit:
do_search: If a search should be started. do_search: If a search should be started.
""" """
if self._text is not None and self._text != text: if self._text is not None and self._text != text:
self.do_search.emit('', 0) self.do_search.emit('', 0)
@ -80,7 +78,6 @@ class SearchParser(QObject):
Args: Args:
text: The text to search for. text: The text to search for.
""" """
self._search(text) self._search(text)
@ -90,7 +87,6 @@ class SearchParser(QObject):
Args: Args:
text: The text to search for. text: The text to search for.
""" """
self._search(text, rev=True) self._search(text, rev=True)
@ -102,7 +98,6 @@ class SearchParser(QObject):
Emit: Emit:
do_search: If a search should be started. do_search: If a search should be started.
""" """
if self._text is not None: if self._text is not None:
for i in range(count): # pylint: disable=unused-variable for i in range(count): # pylint: disable=unused-variable
@ -116,7 +111,6 @@ class CommandParser:
Attributes: Attributes:
_cmd: The command which was parsed. _cmd: The command which was parsed.
_args: The arguments which were parsed. _args: The arguments which were parsed.
""" """
def __init__(self): def __init__(self):
@ -135,7 +129,6 @@ class CommandParser:
Return: Return:
A split string commandline, e.g ['open', 'www.google.com'] A split string commandline, e.g ['open', 'www.google.com']
""" """
parts = text.strip().split(maxsplit=1) parts = text.strip().split(maxsplit=1)
if not parts: if not parts:
@ -172,7 +165,6 @@ class CommandParser:
Args: Args:
count: Count to pass to the command. count: Count to pass to the command.
""" """
if count is not None: if count is not None:
self._cmd.run(self._args, count=count) self._cmd.run(self._args, count=count)
@ -198,7 +190,6 @@ class CommandParser:
Return: Return:
True if command was called (handler returnstatus is ignored!). True if command was called (handler returnstatus is ignored!).
False if command wasn't called (there was an ignored exception). False if command wasn't called (there was an ignored exception).
""" """
if ';;' in text: if ';;' in text:
retvals = [] retvals = []
@ -233,7 +224,6 @@ def split_cmdline(text):
Return: Return:
A list of strings. A list of strings.
""" """
parser = CommandParser() parser = CommandParser()
try: try:

View File

@ -41,7 +41,6 @@ class register:
hide: Whether to hide the command or not. hide: Whether to hide the command or not.
completion: Which completion to use for arguments, as a list of completion: Which completion to use for arguments, as a list of
strings. strings.
""" """
def __init__(self, instance=None, name=None, nargs=None, split_args=True, def __init__(self, instance=None, name=None, nargs=None, split_args=True,
@ -52,7 +51,6 @@ class register:
Arguments: Arguments:
See class attributes. See class attributes.
""" """
self.name = name self.name = name
self.split_args = split_args self.split_args = split_args
@ -74,7 +72,6 @@ class register:
Return: Return:
The original function (unmodified). The original function (unmodified).
""" """
# FIXME: only register commands once # FIXME: only register commands once
names = [] names = []
@ -111,7 +108,6 @@ class register:
N (N, N) N (N, N)
+ (1, None) + (1, None)
* (0, None) * (0, None)
""" """
# pylint: disable=no-member # pylint: disable=no-member
# pylint: disable=unpacking-non-sequence # pylint: disable=unpacking-non-sequence

View File

@ -20,7 +20,6 @@
This borrows a lot of ideas from configparser, but also has some things that This borrows a lot of ideas from configparser, but also has some things that
are fundamentally different. This is why nothing inherts from configparser, but are fundamentally different. This is why nothing inherts from configparser, but
we borrow some methods and classes from there where it makes sense. we borrow some methods and classes from there where it makes sense.
""" """
import os import os
@ -63,7 +62,6 @@ def init(configdir):
Args: Args:
configdir: The directory where the configs are stored in. configdir: The directory where the configs are stored in.
""" """
global config, state global config, state
logging.debug("Config init, configdir {}".format(configdir)) logging.debug("Config init, configdir {}".format(configdir))
@ -85,7 +83,6 @@ class Config:
_configfile: The config file path. _configfile: The config file path.
_interpolation: An configparser.Interpolation object _interpolation: An configparser.Interpolation object
_proxies: configparser.SectionProxy objects for sections. _proxies: configparser.SectionProxy objects for sections.
""" """
def __init__(self, configdir, fname): def __init__(self, configdir, fname):
@ -186,7 +183,6 @@ class Config:
Return: Return:
True if the option and section exist, False otherwise. True if the option and section exist, False otherwise.
""" """
if section not in self.config: if section not in self.config:
return False return False
@ -201,7 +197,6 @@ class Config:
Return: Return:
True if the option existed, False otherwise. True if the option existed, False otherwise.
""" """
try: try:
sectdict = self.config[section] sectdict = self.config[section]
@ -226,7 +221,6 @@ class Config:
Return: Return:
The value of the option. The value of the option.
""" """
val = self.get(section, option) val = self.get(section, option)
message.info("{} {} = {}".format(section, option, val)) message.info("{} {} = {}".format(section, option, val))
@ -239,7 +233,6 @@ class Config:
option: The option name option: The option name
fallback: A fallback value. fallback: A fallback value.
raw: Whether to get the uninterpolated, untransformed value. raw: Whether to get the uninterpolated, untransformed value.
""" """
logging.debug("getting {} -> {}".format(section, option)) logging.debug("getting {} -> {}".format(section, option))
try: try:
@ -274,7 +267,6 @@ class Config:
Arguments: Arguments:
*args: Get passed to self.set(). *args: Get passed to self.set().
""" """
# FIXME completion for values # FIXME completion for values
try: try:
@ -309,7 +301,6 @@ class Config:
Return: Return:
The changed config part as string. The changed config part as string.
""" """
lines = [] lines = []
for secname, section in self.config.items(): for secname, section in self.config.items():
@ -336,7 +327,6 @@ class ReadConfigParser(ConfigParser):
Attributes: Attributes:
_configdir: The directory to read the config from. _configdir: The directory to read the config from.
_configfile: The config file path. _configfile: The config file path.
""" """
def __init__(self, configdir, fname): def __init__(self, configdir, fname):
@ -345,7 +335,6 @@ class ReadConfigParser(ConfigParser):
Args: Args:
configdir: Directory to read the config from. configdir: Directory to read the config from.
fname: Filename of the config file. fname: Filename of the config file.
""" """
super().__init__(interpolation=None) super().__init__(interpolation=None)
self.optionxform = lambda opt: opt # be case-insensitive self.optionxform = lambda opt: opt # be case-insensitive
@ -377,7 +366,6 @@ class SectionProxy(MutableMapping):
Attributes: Attributes:
_conf: The Config object. _conf: The Config object.
_name: The section name. _name: The section name.
""" """
# pylint: disable=redefined-builtin # pylint: disable=redefined-builtin
@ -388,7 +376,6 @@ class SectionProxy(MutableMapping):
Arguments: Arguments:
conf: The Config object. conf: The Config object.
name: The section name. name: The section name.
""" """
self._conf = conf self._conf = conf
self._name = name self._name = name
@ -429,7 +416,6 @@ class SectionProxy(MutableMapping):
option: The option name to get. option: The option name to get.
fallback: A fallback value. fallback: A fallback value.
raw: Whether to get a raw value or not. raw: Whether to get a raw value or not.
""" """
return self._conf.get(self._name, option, raw=raw, fallback=fallback) return self._conf.get(self._name, option, raw=raw, fallback=fallback)

View File

@ -34,7 +34,6 @@ class ValidValues:
values: A list with the allowed untransformed values. values: A list with the allowed untransformed values.
descriptions: A dict with value/desc mappings. descriptions: A dict with value/desc mappings.
show: Whether to show the values in the config or not. show: Whether to show the values in the config or not.
""" """
def __init__(self, *vals, show=True): def __init__(self, *vals, show=True):
@ -68,7 +67,6 @@ class SettingValue:
default: Default value if the user has not overridden it, as a string. default: Default value if the user has not overridden it, as a string.
value: (property) The currently valid, most important value. value: (property) The currently valid, most important value.
rawvalue: The current value as a raw string. rawvalue: The current value as a raw string.
""" """
def __init__(self, typ, default=None): def __init__(self, typ, default=None):
@ -77,7 +75,6 @@ class SettingValue:
Args: Args:
typ: The BaseType to use. typ: The BaseType to use.
default: Raw value to set. default: Raw value to set.
""" """
self.typ = typ() self.typ = typ()
self.rawvalue = None self.rawvalue = None
@ -112,7 +109,6 @@ class BaseType:
valid_values: Possible values if they can be expressed as a fixed valid_values: Possible values if they can be expressed as a fixed
string. ValidValues instance. string. ValidValues instance.
typestr: The name of the type to appear in the config. typestr: The name of the type to appear in the config.
""" """
typestr = None typestr = None
@ -130,7 +126,6 @@ class BaseType:
Return: Return:
The transformed value. The transformed value.
""" """
return value return value
@ -147,7 +142,6 @@ class BaseType:
ValidationError if the value was invalid. ValidationError if the value was invalid.
NotImplementedError if self.valid_values is not defined and this NotImplementedError if self.valid_values is not defined and this
method should be overridden. method should be overridden.
""" """
if self.valid_values is not None: if self.valid_values is not None:
if value not in self.valid_values: if value not in self.valid_values:

View File

@ -35,7 +35,6 @@ class KeyValue:
key: string key: string
value: SettingValue value: SettingValue
descriptions: A dict with the description strings for the keys. descriptions: A dict with the description strings for the keys.
""" """
def __init__(self, *args): def __init__(self, *args):
@ -45,7 +44,6 @@ class KeyValue:
*args: Key/Value pairs to set. *args: Key/Value pairs to set.
key: string key: string
value: SettingValue value: SettingValue
""" """
if args: if args:
self.descriptions = {} self.descriptions = {}
@ -62,7 +60,6 @@ class KeyValue:
Return: Return:
The value, as value class. The value, as value class.
""" """
return self.values[key] return self.values[key]
@ -72,7 +69,6 @@ class KeyValue:
Args: Args:
key: The key to set the value for, as a string. key: The key to set the value for, as a string.
value: The value to set, as a string value: The value to set, as a string
""" """
self.values[key].value = value self.values[key].value = value
@ -119,7 +115,6 @@ class ValueList:
#descriptions: A dict with the description strings for the keys. #descriptions: A dict with the description strings for the keys.
# Currently a global empty dict to be compatible with # Currently a global empty dict to be compatible with
# KeyValue section. # KeyValue section.
""" """
def __init__(self, keytype, valtype, *defaults): def __init__(self, keytype, valtype, *defaults):
@ -147,7 +142,6 @@ class ValueList:
Return: Return:
The value, as value class. The value, as value class.
""" """
try: try:
return self.values[key] return self.values[key]
@ -160,7 +154,6 @@ class ValueList:
Args: Args:
key: The key to set the value for, as a string. key: The key to set the value for, as a string.
value: The value to set, as a string value: The value to set, as a string
""" """
self.values[key] = conftypes.SettingValue(self.valtype) self.values[key] = conftypes.SettingValue(self.valtype)
self.values[key].value = value self.values[key].value = value

View File

@ -31,7 +31,6 @@ def get_stylesheet(template):
Return: Return:
The formatted template as string. The formatted template as string.
""" """
global _colordict, _fontdict global _colordict, _fontdict
if _colordict is None: if _colordict is None:
@ -63,7 +62,6 @@ class ColorDict(dict):
If the key has a .bg. element in it, return background-color: X;. If the key has a .bg. element in it, return background-color: X;.
In all other cases, return the plain value. In all other cases, return the plain value.
""" """
try: try:
val = super().__getitem__(key) val = super().__getitem__(key)
@ -84,7 +82,6 @@ class ColorDict(dict):
Return: Return:
A value, or None if the value wasn't found. A value, or None if the value wasn't found.
""" """
try: try:
return super().__getitem__(key) return super().__getitem__(key)
@ -107,7 +104,6 @@ class FontDict(dict):
(Color not defined, so no output in the stylesheet) (Color not defined, so no output in the stylesheet)
In all other cases, return font: <value>. In all other cases, return font: <value>.
""" """
try: try:
val = super().__getitem__(key) val = super().__getitem__(key)
@ -124,7 +120,6 @@ class FontDict(dict):
Return: Return:
A value, or None if the value wasn't found. A value, or None if the value wasn't found.
""" """
try: try:
return super().__getitem__(key) return super().__getitem__(key)

View File

@ -33,7 +33,6 @@ class CompletionModel(QAbstractItemModel):
_id_map: A mapping from Python object IDs (from id()) to objects, to be _id_map: A mapping from Python object IDs (from id()) to objects, to be
used as internalIndex for the model. used as internalIndex for the model.
_root: The root item. _root: The root item.
""" """
def __init__(self, parent=None): def __init__(self, parent=None):
@ -51,7 +50,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
The CompletionItem for index, or the root CompletionItem if the The CompletionItem for index, or the root CompletionItem if the
index was invalid. index was invalid.
""" """
if index.isValid(): if index.isValid():
return self._id_map[index.internalId()] return self._id_map[index.internalId()]
@ -67,7 +65,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
A list of (startidx, endidx) tuples. A list of (startidx, endidx) tuples.
""" """
pos1 = pos2 = 0 pos1 = pos2 = 0
marks = [] marks = []
@ -86,7 +83,6 @@ class CompletionModel(QAbstractItemModel):
Args: Args:
needle: The string to mark. needle: The string to mark.
""" """
for i in range(self.rowCount()): for i in range(self.rowCount()):
cat = self.index(i, 0) cat = self.index(i, 0)
@ -104,7 +100,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
The created CompletionItem. The created CompletionItem.
""" """
cat = CompletionItem([name], self._root) cat = CompletionItem([name], self._root)
self._id_map[id(cat)] = cat self._id_map[id(cat)] = cat
@ -121,7 +116,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
The created CompletionItem. The created CompletionItem.
""" """
item = CompletionItem((name, desc), parent=cat) item = CompletionItem((name, desc), parent=cat)
self._id_map[id(item)] = item self._id_map[id(item)] = item
@ -137,7 +131,6 @@ class CompletionModel(QAbstractItemModel):
position: The start row to remove. position: The start row to remove.
count: How many rows to remove. count: How many rows to remove.
parent: The parent QModelIndex. parent: The parent QModelIndex.
""" """
node = self._node(parent) node = self._node(parent)
self.beginRemoveRows(parent, position, position + count - 1) self.beginRemoveRows(parent, position, position + count - 1)
@ -155,7 +148,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
Column count as an integer. Column count as an integer.
""" """
# pylint: disable=unused-argument # pylint: disable=unused-argument
return self._root.column_count() return self._root.column_count()
@ -171,7 +163,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
Row count as an integer. Row count as an integer.
""" """
if parent.column() > 0: if parent.column() > 0:
return 0 return 0
@ -193,7 +184,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
The data as QVariant or an invalid QVariant on error. The data as QVariant or an invalid QVariant on error.
""" """
if not index.isValid(): if not index.isValid():
return QVariant() return QVariant()
@ -217,7 +207,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
The data as QVariant or an invalid QVariant on error. The data as QVariant or an invalid QVariant on error.
""" """
if orientation == Qt.Horizontal and role == Qt.DisplayRole: if orientation == Qt.Horizontal and role == Qt.DisplayRole:
return QVariant(self._root.data(section)) return QVariant(self._root.data(section))
@ -238,7 +227,6 @@ class CompletionModel(QAbstractItemModel):
Emit: Emit:
dataChanged when the data was changed. dataChanged when the data was changed.
""" """
if not index.isValid(): if not index.isValid():
return False return False
@ -262,7 +250,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
The item flags, or Qt.NoItemFlags on error. The item flags, or Qt.NoItemFlags on error.
""" """
# FIXME categories are not selectable, but moving via arrow keys still # FIXME categories are not selectable, but moving via arrow keys still
# tries to select them # tries to select them
@ -286,7 +273,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
A generated QModelIndex or an invalid QModelIndex on failure. A generated QModelIndex or an invalid QModelIndex on failure.
""" """
if parent.model() is not None and parent.model() is not self: if parent.model() is not None and parent.model() is not self:
logging.warn("index() called with wrong parent! - " logging.warn("index() called with wrong parent! - "
@ -322,7 +308,6 @@ class CompletionModel(QAbstractItemModel):
Return: Return:
The parent's QModelIndex or an invalid QModelIndex on failure. The parent's QModelIndex or an invalid QModelIndex on failure.
""" """
if not index.isValid(): if not index.isValid():
return QModelIndex() return QModelIndex()
@ -338,7 +323,6 @@ class CompletionModel(QAbstractItemModel):
Raise: Raise:
NotImplementedError, should be overwritten in a superclass. NotImplementedError, should be overwritten in a superclass.
""" """
raise NotImplementedError raise NotImplementedError
@ -352,7 +336,6 @@ class CompletionItem():
children: The children of this item. children: The children of this item.
_data: The data of this item. _data: The data of this item.
_marks: The marks of this item. _marks: The marks of this item.
""" """
def __init__(self, data, parent=None): def __init__(self, data, parent=None):
@ -361,7 +344,6 @@ class CompletionItem():
Args: Args:
data: The data for the model, as tuple (columns). data: The data for the model, as tuple (columns).
parent: An optional parent item. parent: An optional parent item.
""" """
self.parent = parent self.parent = parent
self.children = [] self.children = []
@ -380,7 +362,6 @@ class CompletionItem():
Raise: Raise:
ValueError if the role is invalid. ValueError if the role is invalid.
""" """
if role == Qt.DisplayRole: if role == Qt.DisplayRole:
return self._data[column] return self._data[column]
@ -399,7 +380,6 @@ class CompletionItem():
Raise: Raise:
ValueError if the role is invalid. ValueError if the role is invalid.
""" """
if role == Qt.DisplayRole: if role == Qt.DisplayRole:
self._data[column] = value self._data[column] = value
@ -413,7 +393,6 @@ class CompletionItem():
Return: Return:
The column count. The column count.
""" """
return len(self._data) return len(self._data)
@ -422,7 +401,6 @@ class CompletionItem():
Return: Return:
The row index of the item, or 0 if we're a root item. The row index of the item, or 0 if we're a root item.
""" """
if self.parent: if self.parent:
return self.parent.children.index(self) return self.parent.children.index(self)

View File

@ -19,7 +19,6 @@
Contains: Contains:
CompletionFilterModel -- A QSortFilterProxyModel subclass for completions. CompletionFilterModel -- A QSortFilterProxyModel subclass for completions.
""" """
import logging import logging
@ -34,7 +33,6 @@ class CompletionFilterModel(QSortFilterProxyModel):
Attributes: Attributes:
srcmodel: The source model of this QSFPM. srcmodel: The source model of this QSFPM.
_pattern: The pattern to filter with, used in pattern property. _pattern: The pattern to filter with, used in pattern property.
""" """
def __init__(self, source, parent=None): def __init__(self, source, parent=None):
@ -59,7 +57,6 @@ class CompletionFilterModel(QSortFilterProxyModel):
Args: Args:
val: The value to set. val: The value to set.
""" """
self._pattern = val self._pattern = val
self.invalidateFilter() self.invalidateFilter()
@ -105,7 +102,6 @@ class CompletionFilterModel(QSortFilterProxyModel):
Return: Return:
True if self.pattern is contained in item, or if it's a root item True if self.pattern is contained in item, or if it's a root item
(category). False in all other cases (category). False in all other cases
""" """
if parent == QModelIndex(): if parent == QModelIndex():
return True return True
@ -128,7 +124,6 @@ class CompletionFilterModel(QSortFilterProxyModel):
Return: Return:
True if left < right, else False True if left < right, else False
""" """
left = self.srcmodel.data(lindex).value() left = self.srcmodel.data(lindex).value()
right = self.srcmodel.data(rindex).value() right = self.srcmodel.data(rindex).value()

View File

@ -32,7 +32,6 @@ class NetworkManager(QNetworkAccessManager):
_requests: Pending requests. _requests: Pending requests.
_scheme_handlers: A dictionary (scheme -> handler) of supported custom _scheme_handlers: A dictionary (scheme -> handler) of supported custom
schemes. schemes.
""" """
def __init__(self, parent=None): def __init__(self, parent=None):
@ -60,7 +59,6 @@ class NetworkManager(QNetworkAccessManager):
Return: Return:
A QNetworkReply. A QNetworkReply.
""" """
scheme = req.url().scheme() scheme = req.url().scheme()
logging.debug("new req, scheme {}, handlers {}".format( logging.debug("new req, scheme {}, handlers {}".format(

View File

@ -51,7 +51,6 @@ def _get_html(title, snippet):
Return: Return:
HTML content as bytes. HTML content as bytes.
""" """
return _HTML_TEMPLATE.format(title=title, body=snippet).encode('UTF-8') return _HTML_TEMPLATE.format(title=title, body=snippet).encode('UTF-8')
@ -68,7 +67,6 @@ class QuteSchemeHandler(SchemeHandler):
Return: Return:
The method name qute_* The method name qute_*
""" """
return url.replace('http://', '').replace('qute:', 'qute_') return url.replace('http://', '').replace('qute:', 'qute_')
@ -82,7 +80,6 @@ class QuteSchemeHandler(SchemeHandler):
Return: Return:
A QNetworkReply. A QNetworkReply.
""" """
# FIXME handle unknown pages # FIXME handle unknown pages
# FIXME adjust URLutils based on handlers # FIXME adjust URLutils based on handlers

View File

@ -42,7 +42,6 @@ class SchemeHandler(QObject):
Raise: Raise:
NotImplementedError because this needs to be overwritten by NotImplementedError because this needs to be overwritten by
subclasses. subclasses.
""" """
raise NotImplementedError raise NotImplementedError
@ -62,7 +61,6 @@ class SpecialNetworkReply(QNetworkReply):
Emit: Emit:
metaDataChanged and readyRead and finished after initializing. metaDataChanged and readyRead and finished after initializing.
""" """
super().__init__(parent) super().__init__(parent)
@ -92,7 +90,6 @@ class SpecialNetworkReply(QNetworkReply):
Return: Return:
bytes available (int) bytes available (int)
""" """
return len(self._data) + super().bytesAvailable() return len(self._data) + super().bytesAvailable()
@ -104,7 +101,6 @@ class SpecialNetworkReply(QNetworkReply):
Return: Return:
bytestring containing the data bytestring containing the data
""" """
len_ = min(maxlen, len(self._data)) len_ = min(maxlen, len(self._data))
buf = bytes(self._data[:len_]) buf = bytes(self._data[:len_])

View File

@ -35,7 +35,6 @@ def set_trace():
"""Set a tracepoint in the Python debugger that works with Qt. """Set a tracepoint in the Python debugger that works with Qt.
Based on http://stackoverflow.com/a/1745965/2085149 Based on http://stackoverflow.com/a/1745965/2085149
""" """
print() print()
print("When done debugging, remember to execute:") print("When done debugging, remember to execute:")
@ -50,7 +49,6 @@ def trace_lines(do_trace):
Args: Args:
do_trace: Whether to start tracing (True) or stop it (False). do_trace: Whether to start tracing (True) or stop it (False).
""" """
def trace(frame, event, _): def trace(frame, event, _):
"""Trace function passed to sys.settrace.""" """Trace function passed to sys.settrace."""

View File

@ -19,7 +19,6 @@
In its own file so it doesn't include any Qt stuff, because if it did, it In its own file so it doesn't include any Qt stuff, because if it did, it
wouldn't work. wouldn't work.
""" """
import os import os
@ -34,7 +33,6 @@ def fix():
This fixes crashes on various sites. This fixes crashes on various sites.
See https://bugreports.qt-project.org/browse/QTBUG-36099 See https://bugreports.qt-project.org/browse/QTBUG-36099
""" """
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
# Switch to old but stable font rendering engine # Switch to old but stable font rendering engine

View File

@ -36,7 +36,6 @@ def init():
This needs to be done by hand because the import time is before Qt is ready This needs to be done by hand because the import time is before Qt is ready
for everything. for everything.
""" """
global bridge global bridge
bridge = MessageBridge() bridge = MessageBridge()

View File

@ -31,7 +31,6 @@ def read_file(filename):
Return: Return:
The file contents as string. The file contents as string.
""" """
fn = os.path.join(qutebrowser.basedir, filename) fn = os.path.join(qutebrowser.basedir, filename)
with open(fn, 'r', encoding='UTF-8') as f: with open(fn, 'r', encoding='UTF-8') as f:
@ -47,6 +46,5 @@ def dotted_getattr(obj, path):
Return: Return:
The object at path. The object at path.
""" """
return reduce(getattr, path.split('.'), obj) return reduce(getattr, path.split('.'), obj)

View File

@ -32,7 +32,6 @@ def signal_name(sig):
Return: Return:
The cleaned up signal name. The cleaned up signal name.
""" """
m = re.match(r'[0-9]+(.*)\(.*\)', sig.signal) m = re.match(r'[0-9]+(.*)\(.*\)', sig.signal)
return m.group(1) return m.group(1)
@ -47,7 +46,6 @@ def dbg_signal(sig, args):
Return: Return:
A human-readable string representation of signal/args. A human-readable string representation of signal/args.
""" """
return '{}({})'.format(signal_name(sig), ', '.join(map(str, args))) return '{}({})'.format(signal_name(sig), ', '.join(map(str, args)))
@ -59,7 +57,6 @@ class SignalCache(QObject):
Attributes: Attributes:
_uncached: A list of signals which should not be cached. _uncached: A list of signals which should not be cached.
_signal_dict: The internal mapping of signals we got. _signal_dict: The internal mapping of signals we got.
""" """
def __init__(self, uncached=None): def __init__(self, uncached=None):
@ -68,7 +65,6 @@ class SignalCache(QObject):
Args: Args:
uncached: A list of signal names (as string) which should never be uncached: A list of signal names (as string) which should never be
cached. cached.
""" """
super().__init__() super().__init__()
if uncached is None: if uncached is None:
@ -94,7 +90,6 @@ class SignalCache(QObject):
Emit: Emit:
Cached signals. Cached signals.
""" """
if not self._signal_needs_caching(sig): if not self._signal_needs_caching(sig):
return return

View File

@ -18,7 +18,6 @@
"""Qt style to remove Ubuntu focus rectangle uglyness. """Qt style to remove Ubuntu focus rectangle uglyness.
We might also use this to do more in the future. We might also use this to do more in the future.
""" """
import functools import functools
@ -40,7 +39,6 @@ class Style(QCommonStyle):
Attributes: Attributes:
_style: The base/"parent" style. _style: The base/"parent" style.
""" """
def __init__(self, style): def __init__(self, style):
@ -50,7 +48,6 @@ class Style(QCommonStyle):
Args: Args:
style: The base/"parent" style. style: The base/"parent" style.
""" """
self._style = style self._style = style
for method in ['drawComplexControl', 'drawControl', 'drawItemPixmap', for method in ['drawComplexControl', 'drawControl', 'drawItemPixmap',
@ -74,7 +71,6 @@ class Style(QCommonStyle):
option: const QStyleOption * opt option: const QStyleOption * opt
painter: QPainter * p painter: QPainter * p
widget: const QWidget * widget widget: const QWidget * widget
""" """
if element == QStyle.PE_FrameFocusRect: if element == QStyle.PE_FrameFocusRect:
return return

View File

@ -38,7 +38,6 @@ def _get_search_url(txt):
Raise: Raise:
ValueError if there is no template or no search term was found. ValueError if there is no template or no search term was found.
""" """
logging.debug('Finding search engine for "{}"'.format(txt)) logging.debug('Finding search engine for "{}"'.format(txt))
r = re.compile(r'(^|\s+)!(\w+)($|\s+)') r = re.compile(r'(^|\s+)!(\w+)($|\s+)')
@ -69,7 +68,6 @@ def _is_url_naive(url):
Return: Return:
True if the url really is an URL, False otherwise. True if the url really is an URL, False otherwise.
""" """
PROTOCOLS = ['http://', 'https://'] PROTOCOLS = ['http://', 'https://']
u = urlstring(url) u = urlstring(url)
@ -85,7 +83,6 @@ def _is_url_dns(url):
Return: Return:
True if the url really is an URL, False otherwise. True if the url really is an URL, False otherwise.
""" """
# FIXME we could probably solve this in a nicer way by attempting to open # FIXME we could probably solve this in a nicer way by attempting to open
# the page in the webview, and then open the search if that fails. # the page in the webview, and then open the search if that fails.
@ -109,7 +106,6 @@ def qurl(url):
Return: Return:
The URL as string. The URL as string.
""" """
return url if isinstance(url, QUrl) else QUrl(url) return url if isinstance(url, QUrl) else QUrl(url)
@ -122,7 +118,6 @@ def urlstring(url):
Return: Return:
The URL as string The URL as string
""" """
return url.toString() if isinstance(url, QUrl) else url return url.toString() if isinstance(url, QUrl) else url
@ -135,7 +130,6 @@ def fuzzy_url(url):
Return: Return:
A target QUrl to a searchpage or the original URL. A target QUrl to a searchpage or the original URL.
""" """
u = qurl(url) u = qurl(url)
urlstr = urlstring(url) urlstr = urlstring(url)
@ -173,7 +167,6 @@ def is_url(url):
Raise: Raise:
ValueError if the autosearch config value is invalid. ValueError if the autosearch config value is invalid.
""" """
urlstr = urlstring(url) urlstr = urlstring(url)

View File

@ -32,7 +32,6 @@ class NeighborList:
_items: A list of all items, accessed through item property. _items: A list of all items, accessed through item property.
idx: The current position in the list. idx: The current position in the list.
_mode: The current mode. _mode: The current mode.
""" """
BLOCK = 0 BLOCK = 0
@ -49,7 +48,6 @@ class NeighborList:
BLOCK: Stay on the selected item BLOCK: Stay on the selected item
WRAP: Wrap around to the other end WRAP: Wrap around to the other end
RAISE: Raise an IndexError. RAISE: Raise an IndexError.
""" """
if items is None: if items is None:
self._items = [] self._items = []
@ -78,7 +76,6 @@ class NeighborList:
Raise: Raise:
IndexError if the border of the list is reached and mode is RAISE. IndexError if the border of the list is reached and mode is RAISE.
""" """
logging.debug("{} items, idx {}, offset {}".format(len(self._items), logging.debug("{} items, idx {}, offset {}".format(len(self._items),
self.idx, offset)) self.idx, offset))

View File

@ -35,7 +35,6 @@ def _git_str():
Return: Return:
string containing the git commit ID. string containing the git commit ID.
None if there was an error or we're not in a git repo. None if there was an error or we're not in a git repo.
""" """
if hasattr(sys, "frozen"): if hasattr(sys, "frozen"):
return None return None
@ -59,7 +58,6 @@ def _release_info():
Return: Return:
list of (filename, content) tuples. list of (filename, content) tuples.
""" """
data = [] data = []
for fn in glob.glob("/etc/*-release"): for fn in glob.glob("/etc/*-release"):

View File

@ -33,7 +33,6 @@ class BrowserPage(QWebPage):
Attributes: Attributes:
_extension_handlers: Mapping of QWebPage extensions to their handlers. _extension_handlers: Mapping of QWebPage extensions to their handlers.
network_access_manager: The QNetworkAccessManager used. network_access_manager: The QNetworkAccessManager used.
""" """
def __init__(self, parent=None): def __init__(self, parent=None):
@ -57,7 +56,6 @@ class BrowserPage(QWebPage):
Return: Return:
False if no error page should be displayed, True otherwise. False if no error page should be displayed, True otherwise.
""" """
info = sip.cast(opt, QWebPage.ErrorPageExtensionOption) info = sip.cast(opt, QWebPage.ErrorPageExtensionOption)
errpage = sip.cast(out, QWebPage.ErrorPageExtensionReturn) errpage = sip.cast(out, QWebPage.ErrorPageExtensionReturn)
@ -79,7 +77,6 @@ class BrowserPage(QWebPage):
Return: Return:
True if the extension can be handled, False otherwise. True if the extension can be handled, False otherwise.
""" """
return ext in self._extension_handlers return ext in self._extension_handlers
@ -93,7 +90,6 @@ class BrowserPage(QWebPage):
Return: Return:
Handler return value. Handler return value.
""" """
try: try:
handler = self._extension_handlers[ext] handler = self._extension_handlers[ext]

View File

@ -56,7 +56,6 @@ class BrowserTab(QWebView):
linkHovered: QWebPages linkHovered signal exposed. linkHovered: QWebPages linkHovered signal exposed.
temp_message: Show a temporary message in the statusbar. temp_message: Show a temporary message in the statusbar.
arg: Message to be shown. arg: Message to be shown.
""" """
scroll_pos_changed = pyqtSignal(int, int) scroll_pos_changed = pyqtSignal(int, int)
@ -93,7 +92,6 @@ class BrowserTab(QWebView):
Emit: Emit:
titleChanged and urlChanged titleChanged and urlChanged
""" """
u = urlutils.fuzzy_url(url) u = urlutils.fuzzy_url(url)
logging.debug('New title: {}'.format(urlutils.urlstring(u))) logging.debug('New title: {}'.format(urlutils.urlstring(u)))
@ -109,7 +107,6 @@ class BrowserTab(QWebView):
Emit: Emit:
temp_message: Emitted with new zoom level. temp_message: Emitted with new zoom level.
""" """
level = self._zoom.getitem(offset) level = self._zoom.getitem(offset)
self.setZoomFactor(float(level) / 100) self.setZoomFactor(float(level) / 100)
@ -127,7 +124,6 @@ class BrowserTab(QWebView):
Emit: Emit:
open_tab: Emitted if window should be opened in a new tab. open_tab: Emitted if window should be opened in a new tab.
""" """
if self._open_new_tab: if self._open_new_tab:
self.open_tab.emit(url) self.open_tab.emit(url)
@ -143,7 +139,6 @@ class BrowserTab(QWebView):
Args: Args:
callback: Function to call after shutting down. callback: Function to call after shutting down.
""" """
self._shutdown_callback = callback self._shutdown_callback = callback
try: try:
@ -176,7 +171,6 @@ class BrowserTab(QWebView):
Args: Args:
sender: The object which called the callback. sender: The object which called the callback.
""" """
self._destroyed[sender] = True self._destroyed[sender] = True
dbgout = '\n'.join(['{}: {}'.format(k.__class__.__name__, v) dbgout = '\n'.join(['{}: {}'.format(k.__class__.__name__, v)
@ -200,7 +194,6 @@ class BrowserTab(QWebView):
Emit: Emit:
scroll_pos_changed; If the scroll position changed. scroll_pos_changed; If the scroll position changed.
""" """
frame = self.page_.mainFrame() frame = self.page_.mainFrame()
new_pos = (frame.scrollBarValue(Qt.Horizontal), new_pos = (frame.scrollBarValue(Qt.Horizontal),
@ -230,7 +223,6 @@ class BrowserTab(QWebView):
Return: Return:
The superclass event return value. The superclass event return value.
""" """
if e.type() in [QEvent.MouseButtonPress, QEvent.MouseButtonDblClick]: if e.type() in [QEvent.MouseButtonPress, QEvent.MouseButtonDblClick]:
self._open_new_tab = (e.button() == Qt.MidButton or self._open_new_tab = (e.button() == Qt.MidButton or

View File

@ -19,7 +19,6 @@
Defines a CompletionView which uses CompletionFiterModel and CompletionModel Defines a CompletionView which uses CompletionFiterModel and CompletionModel
subclasses to provide completions. subclasses to provide completions.
""" """
import logging import logging
@ -68,7 +67,6 @@ class CompletionView(QTreeView):
Signals: Signals:
change_completed_part: Text which should be substituted for the word change_completed_part: Text which should be substituted for the word
we're currently completing. we're currently completing.
""" """
_STYLESHEET = """ _STYLESHEET = """
@ -145,7 +143,6 @@ class CompletionView(QTreeView):
Return: Return:
A QModelIndex. A QModelIndex.
""" """
idx = self.selectionModel().currentIndex() idx = self.selectionModel().currentIndex()
if not idx.isValid(): if not idx.isValid():
@ -166,7 +163,6 @@ class CompletionView(QTreeView):
"""Get a new completion model. """Get a new completion model.
parts: The command chunks to get a completion for. parts: The command chunks to get a completion for.
""" """
if len(parts) == 1: if len(parts) == 1:
return 'command' return 'command'
@ -196,7 +192,6 @@ class CompletionView(QTreeView):
Args: Args:
model: An index into self._completion_models. model: An index into self._completion_models.
""" """
self._lastmodel = self._model self._lastmodel = self._model
m = self._completion_models[model] m = self._completion_models[model]
@ -214,7 +209,6 @@ class CompletionView(QTreeView):
Args: Args:
text: The new text text: The new text
""" """
# FIXME we should also consider the cursor position # FIXME we should also consider the cursor position
if self._ignore_next: if self._ignore_next:
@ -263,7 +257,6 @@ class CompletionView(QTreeView):
Emit: Emit:
change_completed_part: When a completion took place. change_completed_part: When a completion took place.
""" """
if not self._completing: if not self._completing:
# No completion running at the moment, ignore keypress # No completion running at the moment, ignore keypress
@ -292,7 +285,6 @@ class _CompletionItemDelegate(QStyledItemDelegate):
_style: The style to be used. _style: The style to be used.
_painter: The QPainter to be used. _painter: The QPainter to be used.
_doc: The QTextDocument to be used. _doc: The QTextDocument to be used.
""" """
# FIXME this is horribly slow when resizing. # FIXME this is horribly slow when resizing.
@ -333,7 +325,6 @@ class _CompletionItemDelegate(QStyledItemDelegate):
Args: Args:
index -- The QModelIndex of the item to draw. index -- The QModelIndex of the item to draw.
""" """
if not self._opt.text: if not self._opt.text:
return return
@ -381,7 +372,6 @@ class _CompletionItemDelegate(QStyledItemDelegate):
Args: Args:
text_rect: The QRect to clip the drawing to. text_rect: The QRect to clip the drawing to.
""" """
clip = QRectF(0, 0, text_rect.width(), text_rect.height()) clip = QRectF(0, 0, text_rect.width(), text_rect.height())
self._doc.drawContents(self._painter, clip) self._doc.drawContents(self._painter, clip)
@ -391,7 +381,6 @@ class _CompletionItemDelegate(QStyledItemDelegate):
Args: Args:
index: The QModelIndex of the item to draw. index: The QModelIndex of the item to draw.
""" """
# FIXME we probably should do eliding here. See # FIXME we probably should do eliding here. See
# qcommonstyle.cpp:viewItemDrawText # qcommonstyle.cpp:viewItemDrawText
@ -462,7 +451,6 @@ class _CompletionItemDelegate(QStyledItemDelegate):
Return: Return:
A QSize with the recommended size. A QSize with the recommended size.
""" """
value = index.data(Qt.SizeHintRole) value = index.data(Qt.SizeHintRole)
if value is not None: if value is not None:
@ -483,7 +471,6 @@ class _CompletionItemDelegate(QStyledItemDelegate):
painter: QPainter * painter painter: QPainter * painter
option: const QStyleOptionViewItem & option option: const QStyleOptionViewItem & option
index: const QModelIndex & index index: const QModelIndex & index
""" """
self._painter = painter self._painter = painter
self._painter.save() self._painter.save()

View File

@ -39,7 +39,6 @@ class CrashDialog(QDialog):
_hbox: The QHboxLayout containing the buttons _hbox: The QHboxLayout containing the buttons
_btn_quit: The quit button _btn_quit: The quit button
_btn_restore: the restore button _btn_restore: the restore button
""" """
def __init__(self, pages, cmdhist, exc): def __init__(self, pages, cmdhist, exc):
@ -49,7 +48,6 @@ class CrashDialog(QDialog):
pages: A list of the open pages (URLs as strings) pages: A list of the open pages (URLs as strings)
cmdhist: A list with the command history (as strings) cmdhist: A list with the command history (as strings)
exc: An exception tuple (type, value, traceback) exc: An exception tuple (type, value, traceback)
""" """
super().__init__() super().__init__()
self.setFixedSize(500, 350) self.setFixedSize(500, 350)
@ -99,7 +97,6 @@ class CrashDialog(QDialog):
Return: Return:
The string to display. The string to display.
""" """
outputs = [ outputs = [
('Version info', version()), ('Version info', version()),

View File

@ -40,7 +40,6 @@ class MainWindow(QWidget):
tabs: The TabbedBrowser widget. tabs: The TabbedBrowser widget.
status: The StatusBar widget. status: The StatusBar widget.
_vbox: The main QVBoxLayout. _vbox: The main QVBoxLayout.
""" """
def __init__(self): def __init__(self):
@ -107,7 +106,6 @@ class MainWindow(QWidget):
Args: Args:
e: The QResizeEvent e: The QResizeEvent
""" """
super().resizeEvent(e) super().resizeEvent(e)
confheight = str(config.config.get('general', 'completion_height')) confheight = str(config.config.get('general', 'completion_height'))

View File

@ -56,7 +56,6 @@ class StatusBar(QWidget):
moved: Emitted when the statusbar has moved, so the completion widget moved: Emitted when the statusbar has moved, so the completion widget
can move the the right position. can move the the right position.
arg: The new position. arg: The new position.
""" """
resized = pyqtSignal('QRect') resized = pyqtSignal('QRect')
@ -131,7 +130,6 @@ class StatusBar(QWidget):
Re-set the stylesheet after setting the value, so everything gets Re-set the stylesheet after setting the value, so everything gets
updated by Qt properly. updated by Qt properly.
""" """
self._error = val self._error = val
self.setStyleSheet(get_stylesheet(self._STYLESHEET)) self.setStyleSheet(get_stylesheet(self._STYLESHEET))
@ -163,7 +161,6 @@ class StatusBar(QWidget):
Args: Args:
text: The text to display, or an empty string to clear. text: The text to display, or an empty string to clear.
""" """
self.txt.temptext = text self.txt.temptext = text
@ -178,7 +175,6 @@ class StatusBar(QWidget):
Args: Args:
e: The original QKeyEvent. e: The original QKeyEvent.
""" """
if e.key() in [Qt.Key_Control, Qt.Key_Alt, Qt.Key_Shift, Qt.Key_Meta]: if e.key() in [Qt.Key_Control, Qt.Key_Alt, Qt.Key_Shift, Qt.Key_Meta]:
# Only modifier pressed, don't hide yet. # Only modifier pressed, don't hide yet.
@ -193,7 +189,6 @@ class StatusBar(QWidget):
Emit: Emit:
resized: Always emitted. resized: Always emitted.
""" """
super().resizeEvent(e) super().resizeEvent(e)
self.resized.emit(self.geometry()) self.resized.emit(self.geometry())
@ -206,7 +201,6 @@ class StatusBar(QWidget):
Emit: Emit:
moved: Always emitted. moved: Always emitted.
""" """
super().moveEvent(e) super().moveEvent(e)
self.moved.emit(e.pos()) self.moved.emit(e.pos())
@ -236,7 +230,6 @@ class _Command(QLineEdit):
hide_completion: Emitted when the completion widget should be hidden. hide_completion: Emitted when the completion widget should be hidden.
show_cmd: Emitted when command input should be shown. show_cmd: Emitted when command input should be shown.
hide_cmd: Emitted when command input can be hidden. hide_cmd: Emitted when command input can be hidden.
""" """
# FIXME we should probably use a proper model for the command history. # FIXME we should probably use a proper model for the command history.
@ -292,7 +285,6 @@ class _Command(QLineEdit):
Called when the user presses the up/down key and wasn't browsing the Called when the user presses the up/down key and wasn't browsing the
history already. history already.
""" """
pre = self.text().strip() pre = self.text().strip()
logging.debug('Preset text: "{}"'.format(pre)) logging.debug('Preset text: "{}"'.format(pre))
@ -349,7 +341,6 @@ class _Command(QLineEdit):
got_cmd: If a new cmd was entered. got_cmd: If a new cmd was entered.
got_search: If a new search was entered. got_search: If a new search was entered.
got_search_rev: If a new reverse search was entered. got_search_rev: If a new reverse search was entered.
""" """
signals = { signals = {
':': self.got_cmd, ':': self.got_cmd,
@ -370,7 +361,6 @@ class _Command(QLineEdit):
Args: Args:
text: The text to set (string). text: The text to set (string).
""" """
self.setText(text) self.setText(text)
self.setFocus() self.setFocus()
@ -382,7 +372,6 @@ class _Command(QLineEdit):
Args: Args:
text: The text to set (string). text: The text to set (string).
""" """
# FIXME we should consider the cursor position. # FIXME we should consider the cursor position.
text = self.text() text = self.text()
@ -405,7 +394,6 @@ class _Command(QLineEdit):
Emit: Emit:
hide_completion: Always emitted so the completion is hidden. hide_completion: Always emitted so the completion is hidden.
""" """
if e.reason() in [Qt.MouseFocusReason, Qt.TabFocusReason, if e.reason() in [Qt.MouseFocusReason, Qt.TabFocusReason,
Qt.BacktabFocusReason, Qt.OtherFocusReason]: Qt.BacktabFocusReason, Qt.OtherFocusReason]:
@ -429,7 +417,6 @@ class _CommandValidator(QValidator):
Return: Return:
A tuple (status, string, pos) as a QValidator should. A tuple (status, string, pos) as a QValidator should.
""" """
if any(string.startswith(c) for c in keys.STARTCHARS): if any(string.startswith(c) for c in keys.STARTCHARS):
return (QValidator.Acceptable, string, pos) return (QValidator.Acceptable, string, pos)
@ -443,7 +430,6 @@ class _Progress(QProgressBar):
Attributes: Attributes:
_STYLESHEET: The stylesheet template. _STYLESHEET: The stylesheet template.
""" """
# FIXME for some reason, margin-left is not shown # FIXME for some reason, margin-left is not shown
@ -486,7 +472,6 @@ class TextBase(QLabel):
Attributes: Attributes:
_elidemode: Where to elide the text. _elidemode: Where to elide the text.
_elided_text: The current elided text. _elided_text: The current elided text.
""" """
def __init__(self, bar, elidemode=Qt.ElideRight): def __init__(self, bar, elidemode=Qt.ElideRight):
@ -500,7 +485,6 @@ class TextBase(QLabel):
Args: Args:
width: The maximal width the text should take. width: The maximal width the text should take.
""" """
self._elided_text = self.fontMetrics().elidedText( self._elided_text = self.fontMetrics().elidedText(
self.text(), self._elidemode, width, Qt.TextShowMnemonic) self.text(), self._elidemode, width, Qt.TextShowMnemonic)
@ -517,7 +501,6 @@ class TextBase(QLabel):
Args: Args:
txt: The text to set (string). txt: The text to set (string).
""" """
super().setText(txt) super().setText(txt)
self._update_elided_text(self.geometry().width()) self._update_elided_text(self.geometry().width())
@ -555,7 +538,6 @@ class _Text(TextBase):
when it is set. The temptext is shown when there is no error, and the when it is set. The temptext is shown when there is no error, and the
(permanent) text is shown when there is neither a temporary text nor an (permanent) text is shown when there is neither a temporary text nor an
error. error.
""" """
def __init__(self, parent=None): def __init__(self, parent=None):
@ -576,7 +558,6 @@ class _Text(TextBase):
"""Update QLabel text when needed. """Update QLabel text when needed.
Called from __setattr__ if a text property changed. Called from __setattr__ if a text property changed.
""" """
for text in [self.errortext, self.temptext, self.normaltext]: for text in [self.errortext, self.temptext, self.normaltext]:
if text: if text:
@ -619,7 +600,6 @@ class _Percentage(TextBase):
Args: Args:
_: The x percentage (int), currently ignored. _: The x percentage (int), currently ignored.
y: The y percentage (int) y: The y percentage (int)
""" """
if y == 0: if y == 0:
self.setText('[top]') self.setText('[top]')
@ -639,7 +619,6 @@ class _Url(TextBase):
_urltype: The current URL type. One of normal/ok/error/warn/hover. _urltype: The current URL type. One of normal/ok/error/warn/hover.
Accessed via the urltype property. Accessed via the urltype property.
_STYLESHEET: The stylesheet template. _STYLESHEET: The stylesheet template.
""" """
_STYLESHEET = """ _STYLESHEET = """
@ -670,7 +649,6 @@ class _Url(TextBase):
Args: Args:
bar: The statusbar (parent) object. bar: The statusbar (parent) object.
elidemode: How to elide the text. elidemode: How to elide the text.
""" """
super().__init__(bar, elidemode) super().__init__(bar, elidemode)
self.setObjectName(self.__class__.__name__) self.setObjectName(self.__class__.__name__)
@ -697,7 +675,6 @@ class _Url(TextBase):
Args: Args:
ok: Whether loading finished successfully (True) or not (False). ok: Whether loading finished successfully (True) or not (False).
""" """
# FIXME: set color to warn if there was an SSL error # FIXME: set color to warn if there was an SSL error
self.urltype = 'success' if ok else 'error' self.urltype = 'success' if ok else 'error'
@ -708,7 +685,6 @@ class _Url(TextBase):
Args: Args:
s: The URL to set. s: The URL to set.
""" """
self.setText(urlstring(s)) self.setText(urlstring(s))
self.urltype = 'normal' self.urltype = 'normal'
@ -725,7 +701,6 @@ class _Url(TextBase):
link: The link which was hovered (string) link: The link which was hovered (string)
title: The title of the hovered link (string) title: The title of the hovered link (string)
text: The text of the hovered link (string) text: The text of the hovered link (string)
""" """
if link: if link:
if self._old_url is None: if self._old_url is None:

View File

@ -31,7 +31,6 @@ class TabWidget(QTabWidget):
Attributes: Attributes:
_STYLESHEET: The stylesheet template to be used. _STYLESHEET: The stylesheet template to be used.
""" """
# FIXME there is still some ugly 1px white stripe from somewhere if we do # FIXME there is still some ugly 1px white stripe from somewhere if we do

View File

@ -73,7 +73,6 @@ class TabbedBrowser(TabWidget):
resized: Emitted when the browser window has resized, so the completion resized: Emitted when the browser window has resized, so the completion
widget can adjust its size to it. widget can adjust its size to it.
arg: The new size. arg: The new size.
""" """
cur_progress = pyqtSignal(int) cur_progress = pyqtSignal(int)
@ -112,7 +111,6 @@ class TabbedBrowser(TabWidget):
Emit: Emit:
shutdown_complete: When the tab shutdown is done completely. shutdown_complete: When the tab shutdown is done completely.
""" """
try: try:
self._tabs.remove(tab) self._tabs.remove(tab)
@ -133,7 +131,6 @@ class TabbedBrowser(TabWidget):
The current widget if count is None. The current widget if count is None.
The widget with the given tab ID if count is given. The widget with the given tab ID if count is given.
None if no widget was found. None if no widget was found.
""" """
if count is None: if count is None:
return self.currentWidget() return self.currentWidget()
@ -149,7 +146,6 @@ class TabbedBrowser(TabWidget):
Args: Args:
text: The text to set. text: The text to set.
""" """
logging.debug('title changed to "{}"'.format(text)) logging.debug('title changed to "{}"'.format(text))
if text: if text:
@ -165,7 +161,6 @@ class TabbedBrowser(TabWidget):
Return: Return:
A partial functon calling _filter_signals with a signal. A partial functon calling _filter_signals with a signal.
""" """
return functools.partial(self._filter_signals, signal) return functools.partial(self._filter_signals, signal)
@ -187,7 +182,6 @@ class TabbedBrowser(TabWidget):
Emit: Emit:
The target signal if the sender was the current widget. The target signal if the sender was the current widget.
""" """
# FIXME BUG the signal cache ordering seems to be weird sometimes. # FIXME BUG the signal cache ordering seems to be weird sometimes.
# How to reproduce: # How to reproduce:
@ -219,7 +213,6 @@ class TabbedBrowser(TabWidget):
Emit: Emit:
shutdown_complete if the shutdown completed successfully. shutdown_complete if the shutdown completed successfully.
""" """
try: try:
self.currentChanged.disconnect() self.currentChanged.disconnect()
@ -248,7 +241,6 @@ class TabbedBrowser(TabWidget):
Emit: Emit:
quit: If last tab was closed and last_close in config is set to quit: If last tab was closed and last_close in config is set to
quit. quit.
""" """
idx = self.currentIndex() if count is None else count - 1 idx = self.currentIndex() if count is None else count - 1
tab = self.cntwidget(count) tab = self.cntwidget(count)
@ -274,7 +266,6 @@ class TabbedBrowser(TabWidget):
Args: Args:
url: The URL to open. url: The URL to open.
""" """
logging.debug("Opening {}".format(url)) logging.debug("Opening {}".format(url))
url = urlutils.qurl(url) url = urlutils.qurl(url)
@ -306,7 +297,6 @@ class TabbedBrowser(TabWidget):
Emit: Emit:
set_cmd_text prefilled with :tabopen $URL set_cmd_text prefilled with :tabopen $URL
""" """
url = urlutils.urlstring(self.currentWidget().url()) url = urlutils.urlstring(self.currentWidget().url())
self.set_cmd_text.emit(':tabopen ' + url) self.set_cmd_text.emit(':tabopen ' + url)
@ -317,7 +307,6 @@ class TabbedBrowser(TabWidget):
Emit: Emit:
set_cmd_text prefilled with :open $URL set_cmd_text prefilled with :open $URL
""" """
url = urlutils.urlstring(self.currentWidget().url()) url = urlutils.urlstring(self.currentWidget().url())
self.set_cmd_text.emit(':open ' + url) self.set_cmd_text.emit(':open ' + url)
@ -327,7 +316,6 @@ class TabbedBrowser(TabWidget):
"""Switch to the previous tab, or skip [count] tabs. """Switch to the previous tab, or skip [count] tabs.
Command handler for :undo. Command handler for :undo.
""" """
if self._url_stack: if self._url_stack:
self.tabopen(self._url_stack.pop()) self.tabopen(self._url_stack.pop())
@ -340,7 +328,6 @@ class TabbedBrowser(TabWidget):
Args: Args:
count: How many tabs to switch back. count: How many tabs to switch back.
""" """
idx = self.currentIndex() idx = self.currentIndex()
if idx - count >= 0: if idx - count >= 0:
@ -357,7 +344,6 @@ class TabbedBrowser(TabWidget):
Args: Args:
count: How many tabs to switch forward. count: How many tabs to switch forward.
""" """
idx = self.currentIndex() idx = self.currentIndex()
if idx + count < self.count(): if idx + count < self.count():
@ -374,7 +360,6 @@ class TabbedBrowser(TabWidget):
Args: Args:
sel: True to use primary selection, False to use clipboard sel: True to use primary selection, False to use clipboard
""" """
# FIXME what happens for invalid URLs? # FIXME what happens for invalid URLs?
clip = QApplication.clipboard() clip = QApplication.clipboard()
@ -391,7 +376,6 @@ class TabbedBrowser(TabWidget):
Args: Args:
sel: True to use primary selection, False to use clipboard sel: True to use primary selection, False to use clipboard
""" """
# FIXME what happens for invalid URLs? # FIXME what happens for invalid URLs?
clip = QApplication.clipboard() clip = QApplication.clipboard()
@ -408,7 +392,6 @@ class TabbedBrowser(TabWidget):
Emit: Emit:
keypress: Always emitted. keypress: Always emitted.
""" """
self.keypress.emit(e) self.keypress.emit(e)
super().keyPressEvent(e) super().keyPressEvent(e)
@ -421,7 +404,6 @@ class TabbedBrowser(TabWidget):
Emit: Emit:
resize: Always emitted. resize: Always emitted.
""" """
super().resizeEvent(e) super().resizeEvent(e)
self.resized.emit(self.geometry()) self.resized.emit(self.geometry())
@ -438,7 +420,6 @@ class CurCommandDispatcher(QObject):
Signals: Signals:
temp_message: Connected to TabbedBrowser signal. temp_message: Connected to TabbedBrowser signal.
""" """
# FIXME maybe subclassing would be more clean? # FIXME maybe subclassing would be more clean?
@ -452,7 +433,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
parent: The TabbedBrowser for this dispatcher. parent: The TabbedBrowser for this dispatcher.
""" """
super().__init__(parent) super().__init__(parent)
self.tabs = parent self.tabs = parent
@ -464,7 +444,6 @@ class CurCommandDispatcher(QObject):
perc: How many percent to scroll, or None perc: How many percent to scroll, or None
count: How many percent to scroll, or None count: How many percent to scroll, or None
orientation: Qt.Horizontal or Qt.Vertical orientation: Qt.Horizontal or Qt.Vertical
""" """
if perc is None and count is None: if perc is None and count is None:
perc = 100 perc = 100
@ -488,7 +467,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
url: The URL to open. url: The URL to open.
count: The tab index to open the URL in, or None. count: The tab index to open the URL in, or None.
""" """
tab = self.tabs.cntwidget(count) tab = self.tabs.cntwidget(count)
if tab is None: if tab is None:
@ -510,7 +488,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
count: The tab index to reload, or None. count: The tab index to reload, or None.
""" """
tab = self.tabs.cntwidget(count) tab = self.tabs.cntwidget(count)
if tab is not None: if tab is not None:
@ -524,7 +501,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
count: The tab index to stop, or None. count: The tab index to stop, or None.
""" """
tab = self.tabs.cntwidget(count) tab = self.tabs.cntwidget(count)
if tab is not None: if tab is not None:
@ -538,7 +514,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
count: The tab index to print, or None. count: The tab index to print, or None.
""" """
# FIXME that does not what I expect # FIXME that does not what I expect
tab = self.tabs.cntwidget(count) tab = self.tabs.cntwidget(count)
@ -555,7 +530,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
count: How many pages to go back. count: How many pages to go back.
""" """
# FIXME display warning if beginning of history # FIXME display warning if beginning of history
for i in range(count): # pylint: disable=unused-variable for i in range(count): # pylint: disable=unused-variable
@ -569,7 +543,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
count: How many pages to go forward. count: How many pages to go forward.
""" """
# FIXME display warning if end of history # FIXME display warning if end of history
for i in range(count): # pylint: disable=unused-variable for i in range(count): # pylint: disable=unused-variable
@ -582,7 +555,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
text: The text to search for. text: The text to search for.
flags: The QWebPage::FindFlags. flags: The QWebPage::FindFlags.
""" """
self.tabs.currentWidget().findText(text, flags) self.tabs.currentWidget().findText(text, flags)
@ -596,7 +568,6 @@ class CurCommandDispatcher(QObject):
dx: How much to scroll in x-direction. dx: How much to scroll in x-direction.
dy: How much to scroll in x-direction. dy: How much to scroll in x-direction.
count: multiplier count: multiplier
""" """
dx = int(count) * float(dx) dx = int(count) * float(dx)
dy = int(count) * float(dy) dy = int(count) * float(dy)
@ -612,7 +583,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
perc: Percentage to scroll. perc: Percentage to scroll.
count: Percentage to scroll. count: Percentage to scroll.
""" """
self._scroll_percent(perc, count, Qt.Horizontal) self._scroll_percent(perc, count, Qt.Horizontal)
@ -626,7 +596,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
perc: Percentage to scroll. perc: Percentage to scroll.
count: Percentage to scroll. count: Percentage to scroll.
""" """
self._scroll_percent(perc, count, Qt.Vertical) self._scroll_percent(perc, count, Qt.Vertical)
@ -638,7 +607,6 @@ class CurCommandDispatcher(QObject):
mx: How many pages to scroll to the right. mx: How many pages to scroll to the right.
my: How many pages to scroll down. my: How many pages to scroll down.
count: multiplier count: multiplier
""" """
# FIXME this might not work with HTML frames # FIXME this might not work with HTML frames
page = self.tabs.currentWidget().page_ page = self.tabs.currentWidget().page_
@ -657,7 +625,6 @@ class CurCommandDispatcher(QObject):
Emit: Emit:
temp_message to display a temporary message. temp_message to display a temporary message.
""" """
clip = QApplication.clipboard() clip = QApplication.clipboard()
url = urlutils.urlstring(self.tabs.currentWidget().url()) url = urlutils.urlstring(self.tabs.currentWidget().url())
@ -677,7 +644,6 @@ class CurCommandDispatcher(QObject):
Emit: Emit:
temp_message to display a temporary message. temp_message to display a temporary message.
""" """
clip = QApplication.clipboard() clip = QApplication.clipboard()
title = self.tabs.tabText(self.tabs.currentIndex()) title = self.tabs.tabText(self.tabs.currentIndex())
@ -692,7 +658,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
count: How many steps to take. count: How many steps to take.
""" """
tab = self.tabs.currentWidget() tab = self.tabs.currentWidget()
tab.zoom(count) tab.zoom(count)
@ -703,7 +668,6 @@ class CurCommandDispatcher(QObject):
Args: Args:
count: How many steps to take. count: How many steps to take.
""" """
tab = self.tabs.currentWidget() tab = self.tabs.currentWidget()
tab.zoom(-count) tab.zoom(-count)

View File

@ -70,6 +70,7 @@ options = {
], ],
'pep257': [ 'pep257': [
'D102', # Docstring missing, will be handled by others 'D102', # Docstring missing, will be handled by others
'D209', # Blank line before closing """ (removed from PEP257)
], ],
}, },
'exclude': ['appdirs.py'], 'exclude': ['appdirs.py'],