Check if the given type has the attribute when awaited.
(
name: str, typ: Type, mx: MemberContext, override_info: TypeInfo | None = None
)
| 282 | |
| 283 | |
| 284 | def may_be_awaitable_attribute( |
| 285 | name: str, typ: Type, mx: MemberContext, override_info: TypeInfo | None = None |
| 286 | ) -> bool: |
| 287 | """Check if the given type has the attribute when awaited.""" |
| 288 | if mx.chk.checking_missing_await: |
| 289 | # Avoid infinite recursion. |
| 290 | return False |
| 291 | with mx.chk.checking_await_set(), mx.msg.filter_errors() as local_errors: |
| 292 | aw_type = mx.chk.get_precise_awaitable_type(typ, local_errors) |
| 293 | if aw_type is None: |
| 294 | return False |
| 295 | _ = _analyze_member_access( |
| 296 | name, aw_type, mx.copy_modified(self_type=aw_type), override_info |
| 297 | ) |
| 298 | return not local_errors.has_new_errors() |
| 299 | |
| 300 | |
| 301 | def report_missing_attribute( |
no test coverage detected
searching dependent graphs…