Fix consistency and spelling in docstrings/comments

This commit is contained in:
Florian Bruhin 2014-05-15 16:27:34 +02:00
parent 537c45f518
commit 326280f910
10 changed files with 48 additions and 48 deletions

View File

@ -328,7 +328,7 @@ class QuteBrowser(QApplication):
logging.debug("Startup cmd {}".format(e))
self.commandmanager.run_safely(e.lstrip(':'))
else:
logging.debug("Startup url {}".format(e))
logging.debug("Startup URL {}".format(e))
self._opened_urls.append(e)
self.mainwindow.tabs.tabopen(e)

View File

@ -46,7 +46,7 @@ class CookieJar(QNetworkCookieJar):
url: The URL to set the cookies for.
Return:
True if one or more cookies are set for url, otherwise False.
True if one or more cookies are set for 'url', otherwise False.
"""
if config.get('network', 'accept-cookies') == 'never':
return False

View File

@ -94,7 +94,7 @@ class CurCommandDispatcher(QObject):
@cmdutils.register(instance='mainwindow.tabs.cur', name='open',
split=False)
def openurl(self, url, count=None):
"""Open an url in the current/[count]th tab.
"""Open a URL in the current/[count]th tab.
Command handler for :open.
@ -105,7 +105,7 @@ class CurCommandDispatcher(QObject):
tab = self._tabs.cntwidget(count)
if tab is None:
if count is None:
# We want to open an URL in the current tab, but none exists
# We want to open a URL in the current tab, but none exists
# yet.
self._tabs.tabopen(url)
else:
@ -116,7 +116,7 @@ class CurCommandDispatcher(QObject):
@pyqtSlot('QUrl', bool)
def openurl_slot(self, url, newtab):
"""Open an URL, used as a slot.
"""Open a URL, used as a slot.
Args:
url: The URL to open.
@ -345,7 +345,7 @@ class CurCommandDispatcher(QObject):
@cmdutils.register(instance='mainwindow.tabs.cur')
def yank(self, sel=False):
"""Yank the current url to the clipboard or primary selection.
"""Yank the current URL to the clipboard or primary selection.
Command handler for :yank.
@ -377,7 +377,7 @@ class CurCommandDispatcher(QObject):
@cmdutils.register(instance='mainwindow.tabs.cur', name='zoomin')
def zoom_in(self, count=1):
"""Zoom in in the current tab.
"""Increase the zoom level for the current tab.
Args:
count: How many steps to take.
@ -387,7 +387,7 @@ class CurCommandDispatcher(QObject):
@cmdutils.register(instance='mainwindow.tabs.cur', name='zoomout')
def zoom_out(self, count=1):
"""Zoom out in the current tab.
"""Decrease the zoom level for the current tab.
Args:
count: How many steps to take.
@ -397,7 +397,7 @@ class CurCommandDispatcher(QObject):
@cmdutils.register(instance='mainwindow.tabs.cur', name='zoom')
def zoom_perc(self, zoom=None, count=None):
"""Zoom the current tab to [count] or 100 percent.
"""Set the zoom level for the current tab to [count] or 100 percent.
Args:
count: How many steps to take.

View File

@ -66,7 +66,7 @@ class HintManager(QObject):
arg: A list of hint strings.
mouse_event: Mouse event to be posted in the web view.
arg: A QMouseEvent
openurl: Open a new url
openurl: Open a new URL
arg 0: URL to open as QUrl.
arg 1: True if it should be opened in a new tab, else False.
set_open_target: Set a new target to open the links in.

View File

@ -157,7 +157,7 @@ class register: # pylint: disable=invalid-name
"given!".format(mainname))
count, nargs = self._get_nargs_count(argspec)
if func.__doc__ is not None:
desc = func.__doc__.splitlines()[0].strip().rstrip('.')
desc = func.__doc__.splitlines()[0].strip()
else:
desc = ""
cmd = Command(name=mainname, split=self.split,

View File

@ -755,7 +755,7 @@ class WebSettingsFile(File):
class AutoSearch(BaseType):
"""Whether to start a search when something else than an URL is entered."""
"""Whether to start a search when something else than a URL is entered."""
valid_values = ValidValues(('naive', "Use simple/naive check."),
('dns', "Use DNS requests (might be slow!)."),

View File

@ -60,10 +60,10 @@ FIRST_COMMENT = r"""
SECTION_DESC = {
'general': "General/misc. options",
'general': "General/misc. options.",
'input': "Options related to input modes.",
'network': "Settings related to the network.",
'completion': "Options related to completion and command history .",
'completion': "Options related to completion and command history.",
'tabbar': "Configuration of the tab bar.",
'webkit': "Webkit settings.",
'hints': "Hinting settings.",
@ -71,7 +71,7 @@ SECTION_DESC = {
"Definitions of search engines which can be used via the address "
"bar.\n"
"The searchengine named DEFAULT is used when general.auto-search "
"is true and something else than an URL was entered to be opened. "
"is true and something else than a URL was entered to be opened. "
"Other search engines can be used via the bang-syntax, e.g. "
'"qutebrowser !google". The string "{}" will be replaced by the '
'search term, use "{{" and "}}" for literal {/} signs.'),
@ -103,7 +103,7 @@ SECTION_DESC = {
" follow_hint: Follow the currently selected hint.\n"
" leave_mode: Leave the command mode."),
'keybind.passthrough': (
"Keybindings for hint mode.\n"
"Keybindings for passthrough mode.\n"
"Since normal keypresses are passed through, only special keys are "
"supported in this mode.\n"
"An useful command to map here is the hidden command leave_mode."),
@ -163,11 +163,11 @@ DATA = OrderedDict([
('startpage',
SettingValue(types.List(), 'http://www.duckduckgo.com'),
"The default page(s) to open at the start, separated with commas."),
"The default page(s) to open at the start, separated by commas."),
('auto-search',
SettingValue(types.AutoSearch(), 'naive'),
"Whether to start a search when something else than an URL is "
"Whether to start a search when something else than a URL is "
"entered."),
('zoom-levels',
@ -186,12 +186,12 @@ DATA = OrderedDict([
('background-tabs',
SettingValue(types.Bool(), 'false'),
"Whether to open new tabs (middleclick/ctrl+click) in background"),
"Whether to open new tabs (middleclick/ctrl+click) in background."),
('window-open-behaviour',
SettingValue(types.WindowOpenBehaviour(), 'new-tab'),
"What to do when the WebView requests a new window to be opened "
"(e.g. via javascript)"),
"(e.g. via javascript)."),
('editor',
SettingValue(types.ShellCommand(placeholder=True), 'gvim -f "{}"'),
@ -331,7 +331,7 @@ DATA = OrderedDict([
('plugins-enabled',
SettingValue(types.Bool(), 'false'),
"Enables or disables plugins in Web pages"),
"Enables or disables plugins in Web pages."),
('private-browsing-enabled',
SettingValue(types.Bool(), 'false'),
@ -353,7 +353,7 @@ DATA = OrderedDict([
('developer-extras-enabled',
SettingValue(types.Bool(), 'false'),
"Enables extra tools for Web developers (e.g. webinspector)"),
"Enables extra tools for Web developers (e.g. webinspector)."),
('spatial-navigation-enabled',
SettingValue(types.Bool(), 'false'),
@ -375,17 +375,17 @@ DATA = OrderedDict([
('print-element-backgrounds',
SettingValue(types.Bool(), 'true'),
"Specifies whether the background color and images are also drawn "
"when the page is printed. "),
"when the page is printed."),
('offline-storage-database-enabled',
SettingValue(types.Bool(), 'false'),
"Specifies whether support for the HTML 5 offline storage feature is "
"enabled or not. "),
"enabled or not."),
('offline-web-application-storage-enabled',
SettingValue(types.Bool(), 'false'),
"Specifies whether support for the HTML 5 web application cache "
"feature is enabled or not. "),
"feature is enabled or not."),
('local-storage-enabled',
SettingValue(types.Bool(), 'false'),
@ -414,7 +414,7 @@ DATA = OrderedDict([
# "This feature, when used in conjunction with QGraphicsWebView, "
# "accelerates animations of web content. CSS animations of the "
# "transform and opacity properties will be rendered by composing the "
# "cached content of the animated elements. "),
# "cached content of the animated elements."),
#('tiled-backing-store-enabled',
# SettingValue(types.Bool(), 'false'),
@ -502,7 +502,7 @@ DATA = OrderedDict([
''),
"Specifies the capacities for the memory cache for dead objects "
"such as stylesheets or scripts. Three values are expected: "
"cacheMinDeadCapacity, cacheMaxDead, totalCapacity"),
"cacheMinDeadCapacity, cacheMaxDead, totalCapacity."),
('offline-storage-default-quota',
SettingValue(types.WebKitBytes(maxsize=MAXVALS['int64']), ''),
@ -524,7 +524,7 @@ DATA = OrderedDict([
('mode',
SettingValue(types.HintMode(), 'letter'),
"Mode to use for hints, 'number' or 'letter'."),
"Mode to use for hints."),
('chars',
SettingValue(types.String(minlen=2), 'asdfghjkl'),

View File

@ -65,13 +65,13 @@ def _get_search_url(txt):
def _is_url_naive(url):
"""Naive check if given url is really an url.
"""Naive check if given URL is really a URL.
Args:
url: The URL to check for.
Return:
True if the url really is an URL, False otherwise.
True if the URL really is a URL, False otherwise.
"""
protocols = ['http', 'https']
u = qurl(url)
@ -92,13 +92,13 @@ def _is_url_naive(url):
def _is_url_dns(url):
"""Check if an url (QUrl) is really an url via DNS.
"""Check if a URL (QUrl) is really a URL via DNS.
Args:
url: The URL to check for.
Return:
True if the url really is an URL, False otherwise.
True if the URL really is a URL, False otherwise.
"""
host = url.host()
logging.debug("DNS request for {}".format(host))
@ -109,7 +109,7 @@ def _is_url_dns(url):
def qurl(url):
"""Get a QUrl from an url string.
"""Get a QUrl from a URL string.
Args:
The URL as string or QUrl.
@ -144,15 +144,15 @@ def fuzzy_url(url):
urlstr = urlstring(url)
if is_url(urlstr):
# probably an address
logging.debug("url is a fuzzy address")
logging.debug("URL is a fuzzy address")
newurl = QUrl.fromUserInput(urlstr)
else: # probably a search term
logging.debug("url is a fuzzy search term")
logging.debug("URL is a fuzzy search term")
try:
newurl = _get_search_url(urlstr)
except ValueError: # invalid search engine
newurl = QUrl.fromUserInput(urlstr)
logging.debug("Converting fuzzy term {} to url -> {}".format(
logging.debug("Converting fuzzy term {} to URL -> {}".format(
urlstr, urlstring(newurl)))
return newurl
@ -170,7 +170,7 @@ def is_url(url):
url: The URL as QUrl or string.
Return:
True if it is a valid url, False otherwise.
True if it is a valid URL, False otherwise.
Raise:
ValueError if the autosearch config value is invalid.
@ -179,16 +179,16 @@ def is_url(url):
autosearch = config.get('general', 'auto-search')
logging.debug("Checking if '{}' is an URL (autosearch={}).".format(
logging.debug("Checking if '{}' is a URL (autosearch={}).".format(
urlstr, autosearch))
if not autosearch:
# no autosearch, so everything is an URL.
# no autosearch, so everything is a URL.
return True
if ' ' in urlstr:
# An URL will never contain a space
logging.debug("Contains space -> no url")
# A URL will never contain a space
logging.debug("Contains space -> no URL")
return False
elif is_special_url(url):
# Special URLs are always URLs, even with autosearch=False

View File

@ -222,7 +222,7 @@ class TabbedBrowser(TabWidget):
@pyqtSlot(str, bool)
def tabopen(self, url=None, background=None):
"""Open a new tab with a given url.
"""Open a new tab with a given URL.
Inner logic for tabopen and backtabopen.
Also connect all the signals we need to _filter_signals.
@ -235,7 +235,7 @@ class TabbedBrowser(TabWidget):
Return:
The opened WebView instance.
"""
logging.debug("Creating new tab with url {}".format(url))
logging.debug("Creating new tab with URL {}".format(url))
tab = WebView(self)
self._connect_tab_signals(tab)
self._tabs.append(tab)
@ -346,7 +346,7 @@ class TabbedBrowser(TabWidget):
@cmdutils.register(instance='mainwindow.tabs', name='undo')
def undo_close(self):
"""Switch to the previous tab, or skip [count] tabs.
"""Re-open a closed tab (optionally skipping [count] tabs).
Command handler for :undo.
"""
@ -357,7 +357,7 @@ class TabbedBrowser(TabWidget):
@cmdutils.register(instance='mainwindow.tabs', name='tabprev')
def switch_prev(self, count=1):
"""Switch to the ([count]th) previous tab.
"""Switch to the previous tab, or skip [count] tabs.
Command handler for :tabprev.
@ -423,7 +423,7 @@ class TabbedBrowser(TabWidget):
@cmdutils.register(instance='mainwindow.tabs')
def focus_tab(self, index=None, count=None):
"""Select the tab given as argument or in count.
"""Select the tab given as argument/[count].
Args:
index: The tab index to focus, starting with 1.

View File

@ -222,7 +222,7 @@ class WebView(QWebView):
logging.debug("Normal click, setting normal target")
def openurl(self, url):
"""Open an URL in the browser.
"""Open a URL in the browser.
Args:
url: The URL to load, as string or QUrl.
@ -317,7 +317,7 @@ class WebView(QWebView):
tab (middle-click or control) or not, and does so.
Args:
url: The url to handle, as string or QUrl.
url: The URL to handle, as string or QUrl.
"""
if self._open_target == Target.tab:
self.tabbedbrowser.tabopen(url, False)