Skip to content

Commit fcddbc9

Browse files
authored
FIx incorrect function name. (dmlc#8346)
1 parent 80e10e0 commit fcddbc9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

python-package/xgboost/core.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def ctypes2numpy(cptr: CNumericPtr, length: int, dtype: Type[np.number]) -> np.n
346346
if not isinstance(cptr, ctypes.POINTER(ctype)): # type: ignore
347347
raise RuntimeError(f"expected {ctype} pointer")
348348
res = np.zeros(length, dtype=dtype)
349-
if not ctypes.memmove(res.ctypes.data, cptr, length * res.strides[0]): # type: ignore
349+
if not ctypes.memmove(res.ctypes.data, cptr, length * res.strides[0]):
350350
raise RuntimeError("memmove failed")
351351
return res
352352

@@ -507,7 +507,7 @@ def _next_wrapper(self, this: None) -> int: # pylint: disable=unused-argument
507507
pointer.
508508
509509
"""
510-
@require_pos_args(True)
510+
@require_keyword_args(True)
511511
def input_data(
512512
data: Any,
513513
*,
@@ -559,7 +559,7 @@ def next(self, input_data: Callable) -> int:
559559
raise NotImplementedError()
560560

561561

562-
# Notice for `require_pos_args`
562+
# Notice for `require_keyword_args`
563563
# Authors: Olivier Grisel
564564
# Gael Varoquaux
565565
# Andreas Mueller
@@ -568,7 +568,9 @@ def next(self, input_data: Callable) -> int:
568568
# Nicolas Tresegnie
569569
# Sylvain Marie
570570
# License: BSD 3 clause
571-
def require_pos_args(error: bool) -> Callable[[Callable[..., _T]], Callable[..., _T]]:
571+
def require_keyword_args(
572+
error: bool,
573+
) -> Callable[[Callable[..., _T]], Callable[..., _T]]:
572574
"""Decorator for methods that issues warnings for positional arguments
573575
574576
Using the keyword-only argument syntax in pep 3102, arguments after the
@@ -583,7 +585,7 @@ def require_pos_args(error: bool) -> Callable[[Callable[..., _T]], Callable[...,
583585
"""
584586

585587
def throw_if(func: Callable[..., _T]) -> Callable[..., _T]:
586-
"""Throw error/warning if there are positional arguments after the asterisk.
588+
"""Throw an error/warning if there are positional arguments after the asterisk.
587589
588590
Parameters
589591
----------
@@ -624,7 +626,7 @@ def inner_f(*args: Any, **kwargs: Any) -> _T:
624626
return throw_if
625627

626628

627-
_deprecate_positional_args = require_pos_args(False)
629+
_deprecate_positional_args = require_keyword_args(False)
628630

629631

630632
class DMatrix: # pylint: disable=too-many-instance-attributes,too-many-public-methods

0 commit comments

Comments
 (0)