Returns True if obj is an instance of a namedtuple. Note: This function checks for the existence of the methods and attributes that make up the namedtuple API, so it will return True IFF obj's type implements that API.
(obj: Any)
| 2203 | |
| 2204 | |
| 2205 | def is_namedtuple_instance(obj: Any) -> bool: |
| 2206 | """Returns True if obj is an instance of a namedtuple. |
| 2207 | |
| 2208 | Note: This function checks for the existence of the methods and |
| 2209 | attributes that make up the namedtuple API, so it will return True |
| 2210 | IFF obj's type implements that API. |
| 2211 | """ |
| 2212 | return ( |
| 2213 | isinstance(obj, tuple) |
| 2214 | and hasattr(obj, "_make") |
| 2215 | and hasattr(obj, "_asdict") |
| 2216 | and hasattr(obj, "_replace") |
| 2217 | and hasattr(obj, "_fields") |
| 2218 | and hasattr(obj, "_field_defaults") |
| 2219 | ) |
| 2220 | |
| 2221 | |
| 2222 | def get_default_shuffle_method() -> str: |
no outgoing calls
no test coverage detected
searching dependent graphs…