Skip to content

Commit

Permalink
mypy: Don't use bytes() on QByteArrays
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Compiler committed May 9, 2020
1 parent d848c51 commit 60dd59d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion qutebrowser/browser/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _load_state_geometry(self):

def closeEvent(self, e):
"""Save the geometry when closed."""
data = bytes(self.saveGeometry())
data = self.saveGeometry().data()
geom = base64.b64encode(data).decode('ASCII')
configfiles.state['geometry']['inspector'] = geom

Expand Down
2 changes: 1 addition & 1 deletion qutebrowser/mainwindow/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def _load_state_geometry(self):

def _save_geometry(self):
"""Save the window geometry to the state config."""
data = bytes(self.saveGeometry())
data = self.saveGeometry().data()
geom = base64.b64encode(data).decode('ASCII')
configfiles.state['geometry']['mainwindow'] = geom

Expand Down
4 changes: 2 additions & 2 deletions qutebrowser/misc/guiprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def _on_finished(self, code, status):
code, status))

encoding = locale.getpreferredencoding(do_setlocale=False)
stderr = bytes(self._proc.readAllStandardError()).decode(
stderr = self._proc.readAllStandardError().data().decode(
encoding, 'replace')
stdout = bytes(self._proc.readAllStandardOutput()).decode(
stdout = self._proc.readAllStandardOutput().data().decode(
encoding, 'replace')

if self._output_messages:
Expand Down
2 changes: 1 addition & 1 deletion qutebrowser/utils/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def connect_log_slot(obj: QObject) -> None:
meta_method = metaobj.method(i)
qtutils.ensure_valid(meta_method)
if meta_method.methodType() == QMetaMethod.Signal:
name = bytes(meta_method.name()).decode('ascii')
name = meta_method.name().data().decode('ascii')
if name != 'destroyed':
signal = getattr(obj, name)
try:
Expand Down
2 changes: 1 addition & 1 deletion qutebrowser/utils/urlutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def encoded_url(url: QUrl) -> str:
Args:
url: The url to encode as QUrl.
"""
return bytes(url.toEncoded()).decode('ascii')
return url.toEncoded().data().decode('ascii')


def file_url(path: str) -> QUrl:
Expand Down

0 comments on commit 60dd59d

Please sign in to comment.