Skip to content

Commit 042938b

Browse files
author
Thomas Preud'homme
committed
Fix __all__ mypy warnings
mypy warns about the unknown type for empty __all__. This commit adds type info for them. Import errors for typing module in LNT needs to be ignored because LNT module is imported from setup before all required package are guaranteed to be installed. Reviewed By: PrzemekWirkus Differential Revision: https://reviews.llvm.org/D94666
1 parent 711a02c commit 042938b

File tree

9 files changed

+31
-9
lines changed

9 files changed

+31
-9
lines changed

lnt/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,11 @@
33
__versioninfo__ = (0, 4, 2)
44
__version__ = '.'.join(map(str, __versioninfo__)) + '.dev0'
55

6-
__all__ = []
6+
# lnt module is imported from the setup script before modules are installed so
7+
# modules might not be available.
8+
try:
9+
from typing import Sequence
10+
except Exception:
11+
pass
12+
13+
__all__ = [] # type: Sequence[str]

lnt/external/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__all__ = []
1+
from typing import Sequence
2+
3+
__all__ = [] # type: Sequence[str]

lnt/server/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__all__ = []
1+
from typing import Sequence
2+
3+
__all__ = [] # type: Sequence[str]

lnt/server/db/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__all__ = []
1+
from typing import Sequence
2+
3+
__all__ = [] # type: Sequence[str]

lnt/server/db/rules/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__all__ = []
1+
from typing import Sequence
2+
3+
__all__ = [] # type: Sequence[str]

lnt/server/reporting/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__all__ = []
1+
from typing import Sequence
2+
3+
__all__ = [] # type: Sequence[str]

lnt/server/ui/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
__all__ = []
1+
from typing import Sequence
2+
3+
__all__ = [] # type: Sequence[str]

lnt/testing/util/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
Miscellaneous utilities for generating test data.
33
"""
44

5-
__all__ = []
5+
from typing import Sequence
6+
7+
__all__ = [] # type: Sequence[str]

lnt/util/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
2+
from typing import Sequence
23

34
logger = logging.getLogger("lnt.server.ui.app")
45

5-
__all__ = []
6+
__all__ = [] # type: Sequence[str]

0 commit comments

Comments
 (0)