Is this one of builtin byte types, or a union that contains it?
(typ: Type)
| 6933 | |
| 6934 | |
| 6935 | def has_bytes_component(typ: Type) -> bool: |
| 6936 | """Is this one of builtin byte types, or a union that contains it?""" |
| 6937 | typ = get_proper_type(typ) |
| 6938 | byte_types = {"builtins.bytes", "builtins.bytearray"} |
| 6939 | if isinstance(typ, UnionType): |
| 6940 | return any(has_bytes_component(t) for t in typ.items) |
| 6941 | if isinstance(typ, Instance) and typ.type.fullname in byte_types: |
| 6942 | return True |
| 6943 | return False |
| 6944 | |
| 6945 | |
| 6946 | def type_info_from_type(typ: Type) -> TypeInfo | None: |
no test coverage detected
searching dependent graphs…