(api: TypeChecker, defn: FuncItem, info: TypeInfo)
| 1108 | |
| 1109 | |
| 1110 | def check_post_init(api: TypeChecker, defn: FuncItem, info: TypeInfo) -> None: |
| 1111 | if defn.type is None: |
| 1112 | return |
| 1113 | assert isinstance(defn.type, FunctionLike) |
| 1114 | |
| 1115 | ideal_sig_method = info.get_method(_INTERNAL_POST_INIT_SYM_NAME) |
| 1116 | assert ideal_sig_method is not None and ideal_sig_method.type is not None |
| 1117 | ideal_sig = ideal_sig_method.type |
| 1118 | assert isinstance(ideal_sig, ProperType) # we set it ourselves |
| 1119 | assert isinstance(ideal_sig, CallableType) |
| 1120 | ideal_sig = ideal_sig.copy_modified(name="__post_init__") |
| 1121 | |
| 1122 | api.check_override( |
| 1123 | override=defn.type, |
| 1124 | original=ideal_sig, |
| 1125 | name="__post_init__", |
| 1126 | name_in_super="__post_init__", |
| 1127 | supertype="dataclass", |
| 1128 | original_class_or_static=False, |
| 1129 | override_class_or_static=False, |
| 1130 | node=defn, |
| 1131 | ) |
nothing calls this directly
no test coverage detected
searching dependent graphs…