Skip to content

Commit dfaf104

Browse files
author
hauntsaninja
committed
actually inherit from FileSystemCache to appease mypyc
This means we could accidentally fallback to calling a FileSystemCache method if stuff gets moved around.
1 parent dec730a commit dfaf104

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

mypy/fscache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@
3232
import stat
3333
from typing import Dict, List, Set
3434
from mypy.util import hash_digest
35+
from mypy_extensions import mypyc_attr
3536

3637

38+
@mypyc_attr(allow_interpreted_subclasses=True) # for tests
3739
class FileSystemCache:
3840
def __init__(self) -> None:
3941
# The package root is not flushed with the caches.

mypy/test/test_find_sources.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from mypy.modulefinder import BuildSource
22
import os
3-
from typing import Any, List, Optional, Set, Tuple, cast
3+
from typing import List, Optional, Set, Tuple
44
from unittest import TestCase
55
from mypy.find_sources import SourceFinder
6+
from mypy.fscache import FileSystemCache
67
from mypy.modulefinder import BuildSource
78
from mypy.options import Options
89

910

10-
class _FakeFSCache:
11+
class FakeFSCache(FileSystemCache):
1112
def __init__(self, files: Set[str]) -> None:
1213
assert all(os.path.isabs(f) for f in files)
1314
self.files = files
@@ -29,9 +30,6 @@ def init_under_package_root(self, file: str) -> bool:
2930
return False
3031

3132

32-
FakeFSCache = cast(Any, _FakeFSCache)
33-
34-
3533
def normalise_build_source_list(sources: List[BuildSource]) -> List[Tuple[str, Optional[str]]]:
3634
return sorted((s.module, s.base_dir) for s in sources)
3735

0 commit comments

Comments
 (0)