Skip to content

Commit

Permalink
[py] Use generic in xgboost model doc decorator (dmlc#11071)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrEarle authored Dec 11, 2024
1 parent b202ebe commit a584757
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python-package/xgboost/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,13 +536,15 @@ 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 +570,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 a584757

Please sign in to comment.