MCPcopy Index your code
hub / github.com/python/mypy / CacheMeta

Class CacheMeta

mypy/cache.py:79–241  ·  view source on GitHub ↗

Class representing cache metadata for a module. This class represents the data known after checking module interface only, i.e. this doesn't have: error messages and indirect dependencies, these are stored in CacheMetaEx.

Source from the content-addressed store, hash-verified

77
78
79class CacheMeta:
80 """Class representing cache metadata for a module.
81
82 This class represents the data known after checking module interface only, i.e.
83 this doesn't have: error messages and indirect dependencies, these are stored
84 in CacheMetaEx.
85 """
86
87 def __init__(
88 self,
89 *,
90 id: str,
91 path: str,
92 mtime: int,
93 size: int,
94 hash: str,
95 dependencies: list[str],
96 data_mtime: int,
97 data_file: str,
98 suppressed: list[str],
99 imports_ignored: dict[int, list[str]],
100 options: dict[str, object],
101 suppressed_deps_opts: bytes,
102 dep_prios: list[int],
103 dep_lines: list[int],
104 dep_hashes: list[bytes],
105 interface_hash: bytes,
106 trans_dep_hash: bytes,
107 version_id: str,
108 ignore_all: bool,
109 plugin_data: Any,
110 ) -> None:
111 self.id = id
112 self.path = path
113 self.mtime = mtime # source file mtime
114 self.size = size # source file size
115 self.hash = hash # source file hash (as a hex string for historical reasons)
116 self.dependencies = dependencies # names of imported modules
117 self.data_mtime = data_mtime # mtime of data_file
118 self.data_file = data_file # path of <id>.data.json or <id>.data.ff
119 self.suppressed = suppressed # dependencies that weren't imported
120 self.imports_ignored = imports_ignored # type ignore codes by line
121 self.options = options # build options snapshot
122 self.suppressed_deps_opts = suppressed_deps_opts # hash of import-related options
123 # dep_prios and dep_lines are both aligned with dependencies + suppressed
124 self.dep_prios = dep_prios
125 self.dep_lines = dep_lines
126 # dep_hashes list is aligned with dependencies only
127 self.dep_hashes = dep_hashes # list of interface_hash for dependencies
128 self.interface_hash = interface_hash # hash representing the public interface
129 self.trans_dep_hash = trans_dep_hash # hash of import structure (transitive)
130 self.version_id = version_id # mypy version for cache invalidation
131 self.ignore_all = ignore_all # if errors were ignored
132 self.plugin_data = plugin_data # config data from plugins
133
134 def serialize(self) -> dict[str, Any]:
135 return {
136 "id": self.id,

Callers 3

write_cacheFunction · 0.90
deserializeMethod · 0.85
readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…