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