Builds counting functions from keyword arguments. Keyword argument filter, prepares a simple ``ordering_func`` from a ``count_from`` argument, otherwise passes ``ordering_func`` on unchanged.
(**kw: Any)
| 229 | |
| 230 | |
| 231 | def _unsugar_count_from(**kw: Any) -> Dict[str, Any]: |
| 232 | """Builds counting functions from keyword arguments. |
| 233 | |
| 234 | Keyword argument filter, prepares a simple ``ordering_func`` from a |
| 235 | ``count_from`` argument, otherwise passes ``ordering_func`` on unchanged. |
| 236 | """ |
| 237 | |
| 238 | count_from = kw.pop("count_from", None) |
| 239 | if kw.get("ordering_func", None) is None and count_from is not None: |
| 240 | if count_from == 0: |
| 241 | kw["ordering_func"] = count_from_0 |
| 242 | elif count_from == 1: |
| 243 | kw["ordering_func"] = count_from_1 |
| 244 | else: |
| 245 | kw["ordering_func"] = count_from_n_factory(count_from) |
| 246 | return kw |
| 247 | |
| 248 | |
| 249 | class OrderingList(List[_T]): |
no test coverage detected