(annotation: type[Any] | None)
| 107 | |
| 108 | |
| 109 | def field_annotation_is_scalar_sequence(annotation: type[Any] | None) -> bool: |
| 110 | origin = get_origin(annotation) |
| 111 | if origin is Union or origin is UnionType: |
| 112 | at_least_one_scalar_sequence = False |
| 113 | for arg in get_args(annotation): |
| 114 | if field_annotation_is_scalar_sequence(arg): |
| 115 | at_least_one_scalar_sequence = True |
| 116 | continue |
| 117 | elif not field_annotation_is_scalar(arg): |
| 118 | return False |
| 119 | return at_least_one_scalar_sequence |
| 120 | return field_annotation_is_sequence(annotation) and all( |
| 121 | field_annotation_is_scalar(sub_annotation) |
| 122 | for sub_annotation in get_args(annotation) |
| 123 | ) |
| 124 | |
| 125 | |
| 126 | def is_bytes_or_nonable_bytes_annotation(annotation: Any) -> bool: |
no test coverage detected