Skip to content

Commit

Permalink
actually inherit from FileSystemCache to appease mypyc
Browse files Browse the repository at this point in the history
This means we could accidentally fallback to calling a FileSystemCache
method if stuff gets moved around.
  • Loading branch information
hauntsaninja committed Nov 22, 2020
1 parent dec730a commit dfaf104
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions mypy/fscache.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
import stat
from typing import Dict, List, Set
from mypy.util import hash_digest
from mypy_extensions import mypyc_attr


@mypyc_attr(allow_interpreted_subclasses=True) # for tests
class FileSystemCache:
def __init__(self) -> None:
# The package root is not flushed with the caches.
Expand Down
8 changes: 3 additions & 5 deletions mypy/test/test_find_sources.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from mypy.modulefinder import BuildSource
import os
from typing import Any, List, Optional, Set, Tuple, cast
from typing import List, Optional, Set, Tuple
from unittest import TestCase
from mypy.find_sources import SourceFinder
from mypy.fscache import FileSystemCache
from mypy.modulefinder import BuildSource
from mypy.options import Options


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


FakeFSCache = cast(Any, _FakeFSCache)


def normalise_build_source_list(sources: List[BuildSource]) -> List[Tuple[str, Optional[str]]]:
return sorted((s.module, s.base_dir) for s in sources)

Expand Down

0 comments on commit dfaf104

Please sign in to comment.