Fix some inconsistent returns
This commit is contained in:
parent
97a4e8d847
commit
016fc0ebb1
@ -103,6 +103,8 @@ def immediate_download_path(prompt_download_directory=None):
|
|||||||
if not prompt_download_directory:
|
if not prompt_download_directory:
|
||||||
return download_dir()
|
return download_dir()
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _path_suggestion(filename):
|
def _path_suggestion(filename):
|
||||||
"""Get the suggested file path.
|
"""Get the suggested file path.
|
||||||
|
@ -303,7 +303,6 @@ class DownloadItem(downloads.AbstractDownloadItem):
|
|||||||
"""Handle QNetworkReply errors."""
|
"""Handle QNetworkReply errors."""
|
||||||
if code == QNetworkReply.OperationCanceledError:
|
if code == QNetworkReply.OperationCanceledError:
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
self._die(self._reply.errorString())
|
self._die(self._reply.errorString())
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
@ -399,7 +398,7 @@ class DownloadManager(downloads.AbstractDownloadManager):
|
|||||||
"""
|
"""
|
||||||
if not url.isValid():
|
if not url.isValid():
|
||||||
urlutils.invalid_url_error(url, "start download")
|
urlutils.invalid_url_error(url, "start download")
|
||||||
return
|
return None
|
||||||
req = QNetworkRequest(url)
|
req = QNetworkRequest(url)
|
||||||
if user_agent is not None:
|
if user_agent is not None:
|
||||||
req.setHeader(QNetworkRequest.UserAgentHeader, user_agent)
|
req.setHeader(QNetworkRequest.UserAgentHeader, user_agent)
|
||||||
|
@ -132,5 +132,6 @@ class FileSchemeHandler(schemehandler.SchemeHandler):
|
|||||||
data = dirbrowser_html(path)
|
data = dirbrowser_html(path)
|
||||||
return networkreply.FixedDataNetworkReply(
|
return networkreply.FixedDataNetworkReply(
|
||||||
request, data, 'text/html', self.parent())
|
request, data, 'text/html', self.parent())
|
||||||
|
return None
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
return None
|
return None
|
||||||
|
@ -270,6 +270,7 @@ class _ContentDisposition:
|
|||||||
elif 'filename' in self.assocs:
|
elif 'filename' in self.assocs:
|
||||||
# XXX Reject non-ascii (parsed via qdtext) here?
|
# XXX Reject non-ascii (parsed via qdtext) here?
|
||||||
return self.assocs['filename']
|
return self.assocs['filename']
|
||||||
|
return None
|
||||||
|
|
||||||
def is_inline(self):
|
def is_inline(self):
|
||||||
"""Return if the file should be handled inline.
|
"""Return if the file should be handled inline.
|
||||||
|
@ -190,6 +190,7 @@ class Command:
|
|||||||
return True
|
return True
|
||||||
elif arg_info.win_id:
|
elif arg_info.win_id:
|
||||||
return True
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def _inspect_func(self):
|
def _inspect_func(self):
|
||||||
"""Inspect the function to get useful informations from it.
|
"""Inspect the function to get useful informations from it.
|
||||||
|
@ -107,12 +107,14 @@ class change_filter: # noqa: N801,N806 pylint: disable=invalid-name
|
|||||||
"""Call the underlying function."""
|
"""Call the underlying function."""
|
||||||
if self._check_match(option):
|
if self._check_match(option):
|
||||||
return func()
|
return func()
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def wrapper(wrapper_self, option=None):
|
def wrapper(wrapper_self, option=None):
|
||||||
"""Call the underlying function."""
|
"""Call the underlying function."""
|
||||||
if self._check_match(option):
|
if self._check_match(option):
|
||||||
return func(wrapper_self)
|
return func(wrapper_self)
|
||||||
|
return None
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
@ -463,7 +465,8 @@ class ConfigContainer:
|
|||||||
def __setattr__(self, attr, value):
|
def __setattr__(self, attr, value):
|
||||||
"""Set the given option in the config."""
|
"""Set the given option in the config."""
|
||||||
if attr.startswith('_'):
|
if attr.startswith('_'):
|
||||||
return super().__setattr__(attr, value)
|
super().__setattr__(attr, value)
|
||||||
|
return
|
||||||
|
|
||||||
name = self._join(attr)
|
name = self._join(attr)
|
||||||
with self._handle_error('setting', name):
|
with self._handle_error('setting', name):
|
||||||
|
@ -136,7 +136,7 @@ class YamlConfig(QObject):
|
|||||||
with open(self._filename, 'r', encoding='utf-8') as f:
|
with open(self._filename, 'r', encoding='utf-8') as f:
|
||||||
yaml_data = utils.yaml_load(f)
|
yaml_data = utils.yaml_load(f)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return {}
|
return
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
desc = configexc.ConfigErrorDesc("While reading", e)
|
desc = configexc.ConfigErrorDesc("While reading", e)
|
||||||
raise configexc.ConfigFileErrors('autoconfig.yml', [desc])
|
raise configexc.ConfigFileErrors('autoconfig.yml', [desc])
|
||||||
|
@ -218,7 +218,7 @@ class HintKeyParser(keyparser.CommandKeyParser):
|
|||||||
self._last_press = LastPress.none
|
self._last_press = LastPress.none
|
||||||
return True
|
return True
|
||||||
elif match == self.Match.other:
|
elif match == self.Match.other:
|
||||||
pass
|
return None
|
||||||
elif match == self.Match.none:
|
elif match == self.Match.none:
|
||||||
# We couldn't find a keychain so we check if it's a special key.
|
# We couldn't find a keychain so we check if it's a special key.
|
||||||
return self._handle_special_key(e)
|
return self._handle_special_key(e)
|
||||||
|
@ -171,7 +171,7 @@ class PromptQueue(QObject):
|
|||||||
# just queue it up for later.
|
# just queue it up for later.
|
||||||
log.prompt.debug("Adding {} to queue.".format(question))
|
log.prompt.debug("Adding {} to queue.".format(question))
|
||||||
self._queue.append(question)
|
self._queue.append(question)
|
||||||
return
|
return None
|
||||||
|
|
||||||
if blocking:
|
if blocking:
|
||||||
# If we're blocking we save the old question on the stack, so we
|
# If we're blocking we save the old question on the stack, so we
|
||||||
@ -207,6 +207,7 @@ class PromptQueue(QObject):
|
|||||||
return question.answer
|
return question.answer
|
||||||
else:
|
else:
|
||||||
question.completed.connect(self._pop_later)
|
question.completed.connect(self._pop_later)
|
||||||
|
return None
|
||||||
|
|
||||||
@pyqtSlot(usertypes.KeyMode)
|
@pyqtSlot(usertypes.KeyMode)
|
||||||
def _on_mode_left(self, mode):
|
def _on_mode_left(self, mode):
|
||||||
|
@ -291,7 +291,7 @@ class SessionManager(QObject):
|
|||||||
data = self._last_window_session
|
data = self._last_window_session
|
||||||
if data is None:
|
if data is None:
|
||||||
log.sessions.error("last_window_session is None while saving!")
|
log.sessions.error("last_window_session is None while saving!")
|
||||||
return
|
return None
|
||||||
else:
|
else:
|
||||||
data = self._save_all(only_window=only_window,
|
data = self._save_all(only_window=only_window,
|
||||||
with_private=with_private)
|
with_private=with_private)
|
||||||
|
Loading…
Reference in New Issue
Block a user