Docstring grammar fixes

This commit is contained in:
Florian Bruhin 2014-02-13 18:57:19 +01:00
parent 62f140cf88
commit 203fa3eb34
7 changed files with 35 additions and 35 deletions

View File

@ -84,7 +84,7 @@ class KeyParser(QObject):
def _handle_modifier_key(self, e):
"""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
@ -118,11 +118,11 @@ class KeyParser(QObject):
def _handle_single_key(self, e):
"""Handle a new keypress with a single key (no modifiers).
Separates the keypress into count/command, then checks if it matches
any possible command, and either runs the command, ignores it, or
displays an error.
Separate the keypress into count/command, then check if it matches
any possible command, and either run the command, ignore it, or
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

View File

@ -41,7 +41,7 @@ pyeval_output = None
def handle(url):
"""Handle about page with an url.
Returns HTML content.
Return HTML content.
"""
if not is_about_url(url):

View File

@ -49,7 +49,7 @@ class CompletionModel(QAbstractItemModel):
def removeRows(self, position=0, count=1, parent=QModelIndex()):
"""Remove rows from the model.
Overrides QAbstractItemModel::removeRows.
Override QAbstractItemModel::removeRows.
"""
node = self._node(parent)
@ -60,7 +60,7 @@ class CompletionModel(QAbstractItemModel):
def _node(self, 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.
"""
@ -72,7 +72,7 @@ class CompletionModel(QAbstractItemModel):
def columnCount(self, parent=QModelIndex()):
"""Return the column count in the model.
Overrides QAbstractItemModel::columnCount.
Override QAbstractItemModel::columnCount.
"""
# pylint: disable=unused-argument
@ -81,8 +81,8 @@ class CompletionModel(QAbstractItemModel):
def data(self, index, role=Qt.DisplayRole):
"""Return the data for role/index as QVariant.
Returns an invalid QVariant on error.
Overrides QAbstractItemModel::data.
Return an invalid QVariant on error.
Override QAbstractItemModel::data.
"""
if not index.isValid():
@ -99,8 +99,8 @@ class CompletionModel(QAbstractItemModel):
def flags(self, index):
"""Return the item flags for index.
Returns Qt.NoItemFlags on error.
Overrides QAbstractItemModel::flags.
Return Qt.NoItemFlags on error.
Override QAbstractItemModel::flags.
"""
# 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):
"""Return the header data for role/index as QVariant.
Returns an invalid QVariant on error.
Overrides QAbstractItemModel::headerData.
Return an invalid QVariant on error.
Override QAbstractItemModel::headerData.
"""
if orientation == Qt.Horizontal and role == Qt.DisplayRole:
@ -127,8 +127,8 @@ class CompletionModel(QAbstractItemModel):
def setData(self, index, value, role=Qt.EditRole):
"""Set the data for role/index to value.
Returns True on success, False on failure.
Overrides QAbstractItemModel::setData.
Return True on success, False on failure.
Override QAbstractItemModel::setData.
"""
if not index.isValid():
@ -144,8 +144,8 @@ class CompletionModel(QAbstractItemModel):
def index(self, row, column, parent=QModelIndex()):
"""Return the QModelIndex for row/column/parent.
Returns an invalid QModelIndex on failure.
Overrides QAbstractItemModel::index.
Return an invalid QModelIndex on failure.
Override QAbstractItemModel::index.
"""
if (0 <= row < self.rowCount(parent) and
@ -170,8 +170,8 @@ class CompletionModel(QAbstractItemModel):
def parent(self, index):
"""Return the QModelIndex of the parent of the object behind index.
Returns an invalid QModelIndex on failure.
Overrides QAbstractItemModel::parent.
Return an invalid QModelIndex on failure.
Override QAbstractItemModel::parent.
"""
if not index.isValid():
@ -184,8 +184,8 @@ class CompletionModel(QAbstractItemModel):
def rowCount(self, parent=QModelIndex()):
"""Return the children count of an item.
Uses the root frame if parent is invalid.
Overrides QAbstractItemModel::data.
Use the root frame if parent is invalid.
Override QAbstractItemModel::rowCount.
"""
if parent.column() > 0:
@ -201,8 +201,8 @@ class CompletionModel(QAbstractItemModel):
def sort(self, column, order=Qt.AscendingOrder):
"""Sort the data in column according to order.
Raises NotImplementedError, should be overwritten in a superclass.
Overrides QAbstractItemModel::sort.
Raise NotImplementedError, should be overwritten in a superclass.
Override QAbstractItemModel::sort.
"""
raise NotImplementedError
@ -355,12 +355,12 @@ class CompletionFilterModel(QSortFilterProxyModel):
def filterAcceptsRow(self, row, parent):
"""Custom filter implementation.
Overrides QSortFilterProxyModel::filterAcceptsRow.
Override QSortFilterProxyModel::filterAcceptsRow.
row -- The row of the item.
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.
"""

View File

@ -184,7 +184,7 @@ class ColorDict(dict):
def getraw(self, key):
"""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:
@ -216,7 +216,7 @@ class FontDict(dict):
def getraw(self, key):
"""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:
@ -258,7 +258,7 @@ class Config(ConfigParser):
def __getitem__(self, key):
"""Get an item from the configparser or default dict.
Extends ConfigParser's __getitem__.
Extend ConfigParser's __getitem__.
"""
try:
@ -269,7 +269,7 @@ class Config(ConfigParser):
def get(self, *args, **kwargs):
"""Get an item from the configparser or default dict.
Extends ConfigParser's get().
Extend ConfigParser's get().
"""
if 'fallback' in kwargs:

View File

@ -521,7 +521,7 @@ class BrowserTab(QWebView):
def event(self, e):
"""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.
Set the _open_new_tab attribute accordingly.

View File

@ -170,7 +170,7 @@ class CompletionView(QTreeView):
def tab_handler(self, shift):
"""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.
shift -- Whether shift is pressed or not.
@ -230,7 +230,7 @@ class CompletionItemDelegate(QStyledItemDelegate):
def sizeHint(self, option, index):
"""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.
"""

View File

@ -290,7 +290,7 @@ class CommandValidator(QValidator):
string -- The string to validate.
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):