Skip to content

Commit 5b094d5

Browse files
authored
Use new NamedTuples in mypy (#13130)
1 parent 7c6faf4 commit 5b094d5

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

mypy/fswatcher.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
from typing import AbstractSet, Dict, Iterable, List, NamedTuple, Optional, Set, Tuple
55

66

7-
FileData = NamedTuple('FileData', [('st_mtime', float),
8-
('st_size', int),
9-
('hash', str)])
7+
class FileData(NamedTuple):
8+
st_mtime: float
9+
st_size: int
10+
hash: str
1011

1112

1213
class FileSystemWatcher:

mypy/modulefinder.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,11 @@
3030

3131

3232
# Paths to be searched in find_module().
33-
SearchPaths = NamedTuple(
34-
'SearchPaths',
35-
[
36-
('python_path', Tuple[str, ...]), # where user code is found
37-
('mypy_path', Tuple[str, ...]), # from $MYPYPATH or config variable
38-
('package_path', Tuple[str, ...]), # from get_site_packages_dirs()
39-
('typeshed_path', Tuple[str, ...]), # paths in typeshed
40-
]
41-
)
33+
class SearchPaths(NamedTuple):
34+
python_path: Tuple[str, ...] # where user code is found
35+
mypy_path: Tuple[str, ...] # from $MYPYPATH or config variable
36+
package_path: Tuple[str, ...] # from get_site_packages_dirs()
37+
typeshed_path: Tuple[str, ...] # paths in typeshed
4238

4339

4440
# Package dirs are a two-tuple of path to search and whether to verify the module

0 commit comments

Comments
 (0)