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

Method analyze_class_decorator

mypy/semanal.py:2236–2248  ·  view source on GitHub ↗
(self, defn: ClassDef, decorator: Expression)

Source from the content-addressed store, hash-verified

2234 self.missing_names.pop()
2235
2236 def analyze_class_decorator(self, defn: ClassDef, decorator: Expression) -> None:
2237 decorator.accept(self)
2238 self.analyze_class_decorator_common(defn, defn.info, decorator)
2239 if isinstance(decorator, RefExpr):
2240 if decorator.fullname in RUNTIME_PROTOCOL_DECOS:
2241 if defn.info.is_protocol:
2242 defn.info.runtime_protocol = True
2243 else:
2244 self.fail("@runtime_checkable can only be used with protocol classes", defn)
2245 elif isinstance(decorator, CallExpr) and refers_to_fullname(
2246 decorator.callee, DATACLASS_TRANSFORM_NAMES
2247 ):
2248 defn.info.dataclass_transform_spec = self.parse_dataclass_transform_spec(decorator)
2249
2250 def analyze_class_decorator_common(
2251 self, defn: ClassDef, info: TypeInfo, decorator: Expression

Callers 1

analyze_classMethod · 0.95

Calls 6

failMethod · 0.95
isinstanceFunction · 0.85
refers_to_fullnameFunction · 0.85
acceptMethod · 0.45

Tested by

no test coverage detected