(cls)
| 242 | |
| 243 | |
| 244 | def inject_reduce_methods(cls): |
| 245 | methods = ( |
| 246 | [ |
| 247 | (name, getattr(duck_array_ops, f"array_{name}"), False) |
| 248 | for name in REDUCE_METHODS |
| 249 | ] |
| 250 | + [(name, getattr(duck_array_ops, name), True) for name in NAN_REDUCE_METHODS] |
| 251 | + [("count", duck_array_ops.count, False)] |
| 252 | ) |
| 253 | for name, f, include_skipna in methods: |
| 254 | numeric_only = getattr(f, "numeric_only", False) |
| 255 | available_min_count = getattr(f, "available_min_count", False) |
| 256 | skip_na_docs = _SKIPNA_DOCSTRING if include_skipna else "" |
| 257 | min_count_docs = _MINCOUNT_DOCSTRING if available_min_count else "" |
| 258 | |
| 259 | func = cls._reduce_method(f, include_skipna, numeric_only) |
| 260 | func.__name__ = name |
| 261 | func.__doc__ = _REDUCE_DOCSTRING_TEMPLATE.format( |
| 262 | name=name, |
| 263 | cls=cls.__name__, |
| 264 | extra_args=cls._reduce_extra_args_docstring.format(name=name), |
| 265 | skip_na_docs=skip_na_docs, |
| 266 | min_count_docs=min_count_docs, |
| 267 | ) |
| 268 | setattr(cls, name, func) |
| 269 | |
| 270 | |
| 271 | def op_str(name): |
no test coverage detected
searching dependent graphs…