Docstring grammar fixes
This commit is contained in:
parent
62f140cf88
commit
203fa3eb34
@ -84,7 +84,7 @@ class KeyParser(QObject):
|
|||||||
def _handle_modifier_key(self, e):
|
def _handle_modifier_key(self, e):
|
||||||
"""Handle a new keypress with modifiers.
|
"""Handle a new keypress with modifiers.
|
||||||
|
|
||||||
Returns True if the keypress has been handled, and False if not.
|
Return True if the keypress has been handled, and False if not.
|
||||||
|
|
||||||
e -- the KeyPressEvent from Qt
|
e -- the KeyPressEvent from Qt
|
||||||
|
|
||||||
@ -118,11 +118,11 @@ class KeyParser(QObject):
|
|||||||
def _handle_single_key(self, e):
|
def _handle_single_key(self, e):
|
||||||
"""Handle a new keypress with a single key (no modifiers).
|
"""Handle a new keypress with a single key (no modifiers).
|
||||||
|
|
||||||
Separates the keypress into count/command, then checks if it matches
|
Separate the keypress into count/command, then check if it matches
|
||||||
any possible command, and either runs the command, ignores it, or
|
any possible command, and either run the command, ignore it, or
|
||||||
displays an error.
|
display an error.
|
||||||
|
|
||||||
e -- the KeyPressEvent from Qt
|
e -- the KeyPressEvent from Qt.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# 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
|
||||||
|
@ -41,7 +41,7 @@ pyeval_output = None
|
|||||||
def handle(url):
|
def handle(url):
|
||||||
"""Handle about page with an url.
|
"""Handle about page with an url.
|
||||||
|
|
||||||
Returns HTML content.
|
Return HTML content.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not is_about_url(url):
|
if not is_about_url(url):
|
||||||
|
@ -49,7 +49,7 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def removeRows(self, position=0, count=1, parent=QModelIndex()):
|
def removeRows(self, position=0, count=1, parent=QModelIndex()):
|
||||||
"""Remove rows from the model.
|
"""Remove rows from the model.
|
||||||
|
|
||||||
Overrides QAbstractItemModel::removeRows.
|
Override QAbstractItemModel::removeRows.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
node = self._node(parent)
|
node = self._node(parent)
|
||||||
@ -60,7 +60,7 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def _node(self, index):
|
def _node(self, index):
|
||||||
"""Return the interal data representation for index.
|
"""Return the interal data representation for index.
|
||||||
|
|
||||||
Returns the CompletionItem for index, or the root CompletionItem if the
|
Return the CompletionItem for index, or the root CompletionItem if the
|
||||||
index was invalid.
|
index was invalid.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -72,7 +72,7 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def columnCount(self, parent=QModelIndex()):
|
def columnCount(self, parent=QModelIndex()):
|
||||||
"""Return the column count in the model.
|
"""Return the column count in the model.
|
||||||
|
|
||||||
Overrides QAbstractItemModel::columnCount.
|
Override QAbstractItemModel::columnCount.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
@ -81,8 +81,8 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def data(self, index, role=Qt.DisplayRole):
|
def data(self, index, role=Qt.DisplayRole):
|
||||||
"""Return the data for role/index as QVariant.
|
"""Return the data for role/index as QVariant.
|
||||||
|
|
||||||
Returns an invalid QVariant on error.
|
Return an invalid QVariant on error.
|
||||||
Overrides QAbstractItemModel::data.
|
Override QAbstractItemModel::data.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not index.isValid():
|
if not index.isValid():
|
||||||
@ -99,8 +99,8 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def flags(self, index):
|
def flags(self, index):
|
||||||
"""Return the item flags for index.
|
"""Return the item flags for index.
|
||||||
|
|
||||||
Returns Qt.NoItemFlags on error.
|
Return Qt.NoItemFlags on error.
|
||||||
Overrides QAbstractItemModel::flags.
|
Override QAbstractItemModel::flags.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# FIXME categories are not selectable, but moving via arrow keys still
|
# FIXME categories are not selectable, but moving via arrow keys still
|
||||||
@ -116,8 +116,8 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def headerData(self, section, orientation, role=Qt.DisplayRole):
|
def headerData(self, section, orientation, role=Qt.DisplayRole):
|
||||||
"""Return the header data for role/index as QVariant.
|
"""Return the header data for role/index as QVariant.
|
||||||
|
|
||||||
Returns an invalid QVariant on error.
|
Return an invalid QVariant on error.
|
||||||
Overrides QAbstractItemModel::headerData.
|
Override QAbstractItemModel::headerData.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
|
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
|
||||||
@ -127,8 +127,8 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def setData(self, index, value, role=Qt.EditRole):
|
def setData(self, index, value, role=Qt.EditRole):
|
||||||
"""Set the data for role/index to value.
|
"""Set the data for role/index to value.
|
||||||
|
|
||||||
Returns True on success, False on failure.
|
Return True on success, False on failure.
|
||||||
Overrides QAbstractItemModel::setData.
|
Override QAbstractItemModel::setData.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not index.isValid():
|
if not index.isValid():
|
||||||
@ -144,8 +144,8 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def index(self, row, column, parent=QModelIndex()):
|
def index(self, row, column, parent=QModelIndex()):
|
||||||
"""Return the QModelIndex for row/column/parent.
|
"""Return the QModelIndex for row/column/parent.
|
||||||
|
|
||||||
Returns an invalid QModelIndex on failure.
|
Return an invalid QModelIndex on failure.
|
||||||
Overrides QAbstractItemModel::index.
|
Override QAbstractItemModel::index.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if (0 <= row < self.rowCount(parent) and
|
if (0 <= row < self.rowCount(parent) and
|
||||||
@ -170,8 +170,8 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def parent(self, index):
|
def parent(self, index):
|
||||||
"""Return the QModelIndex of the parent of the object behind index.
|
"""Return the QModelIndex of the parent of the object behind index.
|
||||||
|
|
||||||
Returns an invalid QModelIndex on failure.
|
Return an invalid QModelIndex on failure.
|
||||||
Overrides QAbstractItemModel::parent.
|
Override QAbstractItemModel::parent.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not index.isValid():
|
if not index.isValid():
|
||||||
@ -184,8 +184,8 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def rowCount(self, parent=QModelIndex()):
|
def rowCount(self, parent=QModelIndex()):
|
||||||
"""Return the children count of an item.
|
"""Return the children count of an item.
|
||||||
|
|
||||||
Uses the root frame if parent is invalid.
|
Use the root frame if parent is invalid.
|
||||||
Overrides QAbstractItemModel::data.
|
Override QAbstractItemModel::rowCount.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if parent.column() > 0:
|
if parent.column() > 0:
|
||||||
@ -201,8 +201,8 @@ class CompletionModel(QAbstractItemModel):
|
|||||||
def sort(self, column, order=Qt.AscendingOrder):
|
def sort(self, column, order=Qt.AscendingOrder):
|
||||||
"""Sort the data in column according to order.
|
"""Sort the data in column according to order.
|
||||||
|
|
||||||
Raises NotImplementedError, should be overwritten in a superclass.
|
Raise NotImplementedError, should be overwritten in a superclass.
|
||||||
Overrides QAbstractItemModel::sort.
|
Override QAbstractItemModel::sort.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -355,12 +355,12 @@ class CompletionFilterModel(QSortFilterProxyModel):
|
|||||||
def filterAcceptsRow(self, row, parent):
|
def filterAcceptsRow(self, row, parent):
|
||||||
"""Custom filter implementation.
|
"""Custom filter implementation.
|
||||||
|
|
||||||
Overrides QSortFilterProxyModel::filterAcceptsRow.
|
Override QSortFilterProxyModel::filterAcceptsRow.
|
||||||
|
|
||||||
row -- The row of the item.
|
row -- The row of the item.
|
||||||
parent -- The parent item QModelIndex.
|
parent -- The parent item QModelIndex.
|
||||||
|
|
||||||
Returns True if self.pattern is contained in item, or if it's a root
|
Return True if self.pattern is contained in item, or if it's a root
|
||||||
item (category). Else returns False.
|
item (category). Else returns False.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -184,7 +184,7 @@ class ColorDict(dict):
|
|||||||
def getraw(self, key):
|
def getraw(self, key):
|
||||||
"""Get a value without the transformations done in __getitem__.
|
"""Get a value without the transformations done in __getitem__.
|
||||||
|
|
||||||
Returns a value, or None if the value wasn't found.
|
Return a value, or None if the value wasn't found.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@ -216,7 +216,7 @@ class FontDict(dict):
|
|||||||
def getraw(self, key):
|
def getraw(self, key):
|
||||||
"""Get a value without the transformations done in __getitem__.
|
"""Get a value without the transformations done in __getitem__.
|
||||||
|
|
||||||
Returns a value, or None if the value wasn't found.
|
Return a value, or None if the value wasn't found.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@ -258,7 +258,7 @@ class Config(ConfigParser):
|
|||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
"""Get an item from the configparser or default dict.
|
"""Get an item from the configparser or default dict.
|
||||||
|
|
||||||
Extends ConfigParser's __getitem__.
|
Extend ConfigParser's __getitem__.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@ -269,7 +269,7 @@ class Config(ConfigParser):
|
|||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
"""Get an item from the configparser or default dict.
|
"""Get an item from the configparser or default dict.
|
||||||
|
|
||||||
Extends ConfigParser's get().
|
Extend ConfigParser's get().
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if 'fallback' in kwargs:
|
if 'fallback' in kwargs:
|
||||||
|
@ -521,7 +521,7 @@ class BrowserTab(QWebView):
|
|||||||
def event(self, e):
|
def event(self, e):
|
||||||
"""Check if a link was clicked with the middle button or Ctrl.
|
"""Check if a link was clicked with the middle button or Ctrl.
|
||||||
|
|
||||||
Extends the superclass event().
|
Extend the superclass event().
|
||||||
|
|
||||||
This also is a bit of a hack, but it seems it's the only possible way.
|
This also is a bit of a hack, but it seems it's the only possible way.
|
||||||
Set the _open_new_tab attribute accordingly.
|
Set the _open_new_tab attribute accordingly.
|
||||||
|
@ -170,7 +170,7 @@ class CompletionView(QTreeView):
|
|||||||
def tab_handler(self, shift):
|
def tab_handler(self, shift):
|
||||||
"""Handle a tab press for the CompletionView.
|
"""Handle a tab press for the CompletionView.
|
||||||
|
|
||||||
Selects the previous/next item and writes the new text to the
|
Select the previous/next item and write the new text to the
|
||||||
statusbar. Called by key_(s)tab_handler in statusbar.command.
|
statusbar. Called by key_(s)tab_handler in statusbar.command.
|
||||||
|
|
||||||
shift -- Whether shift is pressed or not.
|
shift -- Whether shift is pressed or not.
|
||||||
@ -230,7 +230,7 @@ class CompletionItemDelegate(QStyledItemDelegate):
|
|||||||
def sizeHint(self, option, index):
|
def sizeHint(self, option, index):
|
||||||
"""Override sizeHint of QStyledItemDelegate.
|
"""Override sizeHint of QStyledItemDelegate.
|
||||||
|
|
||||||
Returns the cell size based on the QTextDocument size, but might not
|
Return the cell size based on the QTextDocument size, but might not
|
||||||
work correctly yet.
|
work correctly yet.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -290,7 +290,7 @@ class CommandValidator(QValidator):
|
|||||||
string -- The string to validate.
|
string -- The string to validate.
|
||||||
pos -- The current curser position.
|
pos -- The current curser position.
|
||||||
|
|
||||||
Returns a tuple (status, string, pos) as a QValidator should.
|
Return 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):
|
||||||
|
Loading…
Reference in New Issue
Block a user