+ @staticmethod
+ def _get_item(target_class: Any
+ ) -> Callable[..., Callable[[TaskHandler],
+ dict[str, object]]]:
+ def decorator(f: Callable[..., dict[str, object]]
+ ) -> Callable[[TaskHandler], dict[str, object]]:
+ def wrapper(self: TaskHandler) -> dict[str, object]:
+ # pylint: disable=protected-access
+ # (because pylint here fails to detect the use of wrapper as a
+ # method to self with respective access privileges)
+ id_ = self._params.get_int_or_none('id')
+ if target_class.can_create_by_id:
+ item = target_class.by_id_or_create(self.conn, id_)
+ else:
+ item = target_class.by_id(self.conn, id_)
+ return f(self, item)
+ return wrapper
+ return decorator
+