Check if a given class is a named tuple. It can be either a `typing.NamedTuple` or `collections.namedtuple`
(type_: Type[Any])
| 455 | |
| 456 | |
| 457 | def is_namedtuple(type_: Type[Any]) -> bool: |
| 458 | """ |
| 459 | Check if a given class is a named tuple. |
| 460 | It can be either a `typing.NamedTuple` or `collections.namedtuple` |
| 461 | """ |
| 462 | from pydantic.v1.utils import lenient_issubclass |
| 463 | |
| 464 | return lenient_issubclass(type_, tuple) and hasattr(type_, '_fields') |
| 465 | |
| 466 | |
| 467 | def is_typeddict(type_: Type[Any]) -> bool: |
no test coverage detected