Skip to content

Commit

Permalink
Use generic in xgboost model doc decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
MrEarle committed Dec 7, 2024
1 parent 4b2001e commit 57f252a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python-package/xgboost/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,14 @@ def task(i: int) -> float:
information) instead.
"""

TDoc = TypeVar("TDoc", bound=Type)

def xgboost_model_doc(
header: str,
items: List[str],
extra_parameters: Optional[str] = None,
end_note: Optional[str] = None,
) -> Callable[[Type], Type]:
) -> Callable[[TDoc], TDoc]:
"""Obtain documentation for Scikit-Learn wrappers
Parameters
Expand All @@ -568,7 +569,7 @@ def get_doc(item: str) -> str:
}
return __doc[item]

def adddoc(cls: Type) -> Type:
def adddoc(cls: TDoc) -> TDoc:
doc = [
"""
Parameters
Expand Down

0 comments on commit 57f252a

Please sign in to comment.