Skip to content

Commit 17ba4c9

Browse files
author
Mickaël Schoentgen
committed
NXDRIVE-1944: Fix mypy issues following the update to mypy 0.740
Fixed these errors: manager.py:636: Incompatible return value type (got "Optional[str]", expected "str") commandline.py:574: On Python 3 '{}'.format(b'abc') produces "b'abc'"; use !r if this is a desired behavior There is also a false positive ignored for now (should be fixed in the next mypy release, see python/mypy#7717).
1 parent 23b8e0a commit 17ba4c9

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

docs/changes/4.3.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Release date: `2019-xx-xx`
77
- [NXDRIVE-1932](https://jira.nuxeo.com/browse/NXDRIVE-1932): Send Direct Transfer analytics using its own category
88
- [NXDRIVE-1942](https://jira.nuxeo.com/browse/NXDRIVE-1942): Small Direct Edit improvements
99
- [NXDRIVE-1944](https://jira.nuxeo.com/browse/NXDRIVE-1944): Fix exception type when the parent folder is not yet sync on remote creation
10+
- [NXDRIVE-1945](https://jira.nuxeo.com/browse/NXDRIVE-1945): Fix mypy issues following the update to mypy 0.740
1011

1112
## GUI
1213

nxdrive/client/remote_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ def download(
333333
self.check_integrity(digest, action)
334334
else:
335335
with memoryview(resp.content) as view, file_out.open(mode="wb") as f:
336-
f.write(view)
336+
# TODO: NXDRIVE-1945, remove "type: ignore" when mypy 0.750 comes out
337+
f.write(view) # type: ignore
337338
# Force write of file to disk
338339
f.flush()
339340
os.fsync(f.fileno())

nxdrive/commandline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def _send_to_running_instance(self, payload: bytes, pid: int) -> None:
572572
named_pipe = f"{BUNDLE_IDENTIFIER}.protocol.{pid}"
573573
log.debug(
574574
f"Opening a local socket to the running instance on {named_pipe} "
575-
f"(payload={self.redact_payload(payload)})"
575+
f"(payload={self.redact_payload(payload)!r})"
576576
)
577577
client = QLocalSocket()
578578
try:

nxdrive/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ def bind_server(
633633

634634
def _get_engine_name(self, server_url: str) -> str:
635635
urlp = urlparse(server_url)
636-
return urlp.hostname
636+
return urlp.hostname or ""
637637

638638
def check_local_folder_available(self, path: Path) -> bool:
639639
if not self._engine_definitions:

0 commit comments

Comments
 (0)