From 63dfcb17a7b614c095c3a922046d574d792bb17f Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 17 Apr 2020 11:03:53 +0200 Subject: [PATCH] core: make mypy happy about importing fatfs --- core/src/trezor/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/trezor/__init__.py b/core/src/trezor/__init__.py index 25c858cdee..9f7e623d84 100644 --- a/core/src/trezor/__init__.py +++ b/core/src/trezor/__init__.py @@ -1,4 +1,10 @@ import trezorconfig as config # noqa: F401 import trezorio as io # noqa: F401 -fatfs = io.fatfs +if False: + import trezorio.fatfs as fatfs +else: + # a bug in mypy causes a crash at _usage site_ of the following: + fatfs = io.fatfs + # hence the if False branch that does what mypy understands - but which doesn't + # actually work because `trezorio.fatfs` is not importable.