Fix with black 24.1.1. (#10014)

This commit is contained in:
Jiaming Yuan 2024-01-30 17:24:11 +08:00 committed by GitHub
parent 65d7bf2dfe
commit 54b71c8fba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
46 changed files with 49 additions and 8 deletions

View File

@ -6,6 +6,7 @@ This demo uses 1D toy data and visualizes how XGBoost fits a tree ensemble. The
model starts out as a flat line and evolves into a step function in order to account for model starts out as a flat line and evolves into a step function in order to account for
all ranged labels. all ranged labels.
""" """
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np

View File

@ -3,6 +3,7 @@ Example of training with Dask on CPU
==================================== ====================================
""" """
from dask import array as da from dask import array as da
from dask.distributed import Client, LocalCluster from dask.distributed import Client, LocalCluster

View File

@ -2,6 +2,7 @@
Example of using callbacks with Dask Example of using callbacks with Dask
==================================== ====================================
""" """
import numpy as np import numpy as np
from dask.distributed import Client, LocalCluster from dask.distributed import Client, LocalCluster
from dask_ml.datasets import make_regression from dask_ml.datasets import make_regression

View File

@ -2,6 +2,7 @@
Example of training with Dask on GPU Example of training with Dask on GPU
==================================== ====================================
""" """
import cupy as cp import cupy as cp
import dask_cudf import dask_cudf
from dask import array as da from dask import array as da

View File

@ -2,6 +2,7 @@
Use scikit-learn regressor interface with CPU histogram tree method Use scikit-learn regressor interface with CPU histogram tree method
=================================================================== ===================================================================
""" """
from dask import array as da from dask import array as da
from dask.distributed import Client, LocalCluster from dask.distributed import Client, LocalCluster

View File

@ -4,6 +4,7 @@ Demo for using and defining callback functions
.. versionadded:: 1.3.0 .. versionadded:: 1.3.0
""" """
import argparse import argparse
import os import os
import tempfile import tempfile

View File

@ -13,6 +13,7 @@ See Also
- :ref:`sphx_glr_python_examples_cat_in_the_dat.py` - :ref:`sphx_glr_python_examples_cat_in_the_dat.py`
""" """
from typing import List, Tuple from typing import List, Tuple
import numpy as np import numpy as np

View File

@ -17,6 +17,7 @@ See Also
- :ref:`sphx_glr_python_examples_cat_pipeline.py` - :ref:`sphx_glr_python_examples_cat_pipeline.py`
""" """
from typing import Tuple from typing import Tuple
import numpy as np import numpy as np

View File

@ -11,6 +11,7 @@ instead of Quantile DMatrix. The feature is not ready for production use yet.
See :doc:`the tutorial </tutorials/external_memory>` for more details. See :doc:`the tutorial </tutorials/external_memory>` for more details.
""" """
import os import os
import tempfile import tempfile
from typing import Callable, List, Tuple from typing import Callable, List, Tuple

View File

@ -2,6 +2,7 @@
Demo for prediction using individual trees and model slices Demo for prediction using individual trees and model slices
=========================================================== ===========================================================
""" """
import os import os
import numpy as np import numpy as np

View File

@ -15,6 +15,7 @@ position debiasing training.
For an overview of learning to rank in XGBoost, please see For an overview of learning to rank in XGBoost, please see
:doc:`Learning to Rank </tutorials/learning_to_rank>`. :doc:`Learning to Rank </tutorials/learning_to_rank>`.
""" """
from __future__ import annotations from __future__ import annotations
import argparse import argparse

View File

@ -13,6 +13,7 @@ https://scikit-learn.org/stable/auto_examples/ensemble/plot_gradient_boosting_qu
crossing can happen due to limitation in the algorithm. crossing can happen due to limitation in the algorithm.
""" """
import argparse import argparse
from typing import Dict from typing import Dict

View File

@ -9,6 +9,7 @@ Created on 1 Apr 2015
@author: Jamie Hall @author: Jamie Hall
""" """
import pickle import pickle
import numpy as np import numpy as np

View File

@ -2,6 +2,7 @@
Demo for using xgboost with sklearn Demo for using xgboost with sklearn
=================================== ===================================
""" """
import multiprocessing import multiprocessing
from sklearn.datasets import fetch_california_housing from sklearn.datasets import fetch_california_housing

View File

@ -4,6 +4,7 @@ Collection of examples for using xgboost.spark estimator interface
@author: Weichen Xu @author: Weichen Xu
""" """
import sklearn.datasets import sklearn.datasets
from pyspark.ml.evaluation import MulticlassClassificationEvaluator, RegressionEvaluator from pyspark.ml.evaluation import MulticlassClassificationEvaluator, RegressionEvaluator
from pyspark.ml.linalg import Vectors from pyspark.ml.linalg import Vectors

View File

@ -2,6 +2,7 @@
Using rmm with Dask Using rmm with Dask
=================== ===================
""" """
import dask import dask
from dask.distributed import Client from dask.distributed import Client
from dask_cuda import LocalCUDACluster from dask_cuda import LocalCUDACluster

View File

@ -2,6 +2,7 @@
Using rmm on a single node device Using rmm on a single node device
================================= =================================
""" """
import rmm import rmm
from sklearn.datasets import make_classification from sklearn.datasets import make_classification

View File

@ -2,6 +2,7 @@
Custom hook to customize the behavior of Hatchling. Custom hook to customize the behavior of Hatchling.
Here, we customize the tag of the generated wheels. Here, we customize the tag of the generated wheels.
""" """
import sysconfig import sysconfig
from typing import Any, Dict from typing import Any, Dict

View File

@ -1,4 +1,5 @@
"""Build configuration""" """Build configuration"""
import dataclasses import dataclasses
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional

View File

@ -1,6 +1,7 @@
""" """
Functions for building libxgboost Functions for building libxgboost
""" """
import logging import logging
import os import os
import pathlib import pathlib

View File

@ -4,6 +4,7 @@ Builds source distribution and binary wheels, following PEP 517 / PEP 660.
Reuses components of Hatchling (https://github.com/pypa/hatch/tree/master/backend) for the sake Reuses components of Hatchling (https://github.com/pypa/hatch/tree/master/backend) for the sake
of brevity. of brevity.
""" """
import dataclasses import dataclasses
import logging import logging
import os import os

View File

@ -1,6 +1,7 @@
""" """
Functions for building sdist Functions for building sdist
""" """
import logging import logging
import pathlib import pathlib

View File

@ -1,6 +1,7 @@
""" """
Utility functions for implementing PEP 517 backend Utility functions for implementing PEP 517 backend
""" """
import logging import logging
import pathlib import pathlib
import shutil import shutil

View File

@ -1,4 +1,5 @@
"""XGBoost collective communication related API.""" """XGBoost collective communication related API."""
import ctypes import ctypes
import json import json
import logging import logging

View File

@ -64,13 +64,11 @@ class XGBoostError(ValueError):
@overload @overload
def from_pystr_to_cstr(data: str) -> bytes: def from_pystr_to_cstr(data: str) -> bytes: ...
...
@overload @overload
def from_pystr_to_cstr(data: List[str]) -> ctypes.Array: def from_pystr_to_cstr(data: List[str]) -> ctypes.Array: ...
...
def from_pystr_to_cstr(data: Union[str, List[str]]) -> Union[bytes, ctypes.Array]: def from_pystr_to_cstr(data: Union[str, List[str]]) -> Union[bytes, ctypes.Array]:

View File

@ -1146,9 +1146,9 @@ async def _direct_predict_impl( # pylint: disable=too-many-branches
if _can_output_df(isinstance(data, dd.DataFrame), output_shape): if _can_output_df(isinstance(data, dd.DataFrame), output_shape):
if base_margin is not None and isinstance(base_margin, da.Array): if base_margin is not None and isinstance(base_margin, da.Array):
# Easier for map_partitions # Easier for map_partitions
base_margin_df: Optional[ base_margin_df: Optional[Union[dd.DataFrame, dd.Series]] = (
Union[dd.DataFrame, dd.Series] base_margin.to_dask_dataframe()
] = base_margin.to_dask_dataframe() )
else: else:
base_margin_df = base_margin base_margin_df = base_margin
predictions = dd.map_partitions( predictions = dd.map_partitions(

View File

@ -1,4 +1,5 @@
"""Utilities for the XGBoost Dask interface.""" """Utilities for the XGBoost Dask interface."""
import logging import logging
from typing import TYPE_CHECKING, Any, Dict from typing import TYPE_CHECKING, Any, Dict

View File

@ -1,4 +1,5 @@
"""XGBoost pyspark integration submodule for core code.""" """XGBoost pyspark integration submodule for core code."""
import base64 import base64
# pylint: disable=fixme, too-many-ancestors, protected-access, no-member, invalid-name # pylint: disable=fixme, too-many-ancestors, protected-access, no-member, invalid-name

View File

@ -1,4 +1,5 @@
"""Xgboost pyspark integration submodule for estimator API.""" """Xgboost pyspark integration submodule for estimator API."""
# pylint: disable=too-many-ancestors # pylint: disable=too-many-ancestors
# pylint: disable=fixme, too-many-ancestors, protected-access, no-member, invalid-name # pylint: disable=fixme, too-many-ancestors, protected-access, no-member, invalid-name
# pylint: disable=unused-argument, too-many-locals # pylint: disable=unused-argument, too-many-locals

View File

@ -1,4 +1,5 @@
"""Xgboost pyspark integration submodule for params.""" """Xgboost pyspark integration submodule for params."""
from typing import Dict from typing import Dict
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
@ -55,7 +56,6 @@ class HasFeaturesCols(Params):
class HasEnableSparseDataOptim(Params): class HasEnableSparseDataOptim(Params):
""" """
This is a Params based class that is extended by _SparkXGBParams This is a Params based class that is extended by _SparkXGBParams
and holds the variable to store the boolean config of enabling sparse data optimization. and holds the variable to store the boolean config of enabling sparse data optimization.

View File

@ -1,4 +1,5 @@
"""Xgboost pyspark integration submodule for helper functions.""" """Xgboost pyspark integration submodule for helper functions."""
# pylint: disable=fixme # pylint: disable=fixme
import inspect import inspect

View File

@ -2,6 +2,7 @@
change without notice. change without notice.
""" """
# pylint: disable=invalid-name,missing-function-docstring,import-error # pylint: disable=invalid-name,missing-function-docstring,import-error
import gc import gc
import importlib.util import importlib.util

View File

@ -1,4 +1,5 @@
"""Tests for training continuation.""" """Tests for training continuation."""
import json import json
from typing import Any, Dict, TypeVar from typing import Any, Dict, TypeVar

View File

@ -1,4 +1,5 @@
"""Tests for dask shared by different test modules.""" """Tests for dask shared by different test modules."""
import numpy as np import numpy as np
import pandas as pd import pandas as pd
from dask import array as da from dask import array as da

View File

@ -1,4 +1,5 @@
"""Tests related to the `DataIter` interface.""" """Tests related to the `DataIter` interface."""
import numpy as np import numpy as np
import xgboost import xgboost

View File

@ -1,4 +1,5 @@
"""Tests for evaluation metrics.""" """Tests for evaluation metrics."""
from typing import Dict, List from typing import Dict, List
import numpy as np import numpy as np

View File

@ -1,4 +1,5 @@
"""Testing code shared by other tests.""" """Testing code shared by other tests."""
# pylint: disable=invalid-name # pylint: disable=invalid-name
import collections import collections
import importlib.util import importlib.util

View File

@ -1,4 +1,5 @@
"""Tests for updaters.""" """Tests for updaters."""
import json import json
from functools import partial, update_wrapper from functools import partial, update_wrapper
from typing import Any, Dict, List from typing import Any, Dict, List

View File

@ -7,6 +7,7 @@ needed, run CMake .
If this is a RC release, the version for JVM packages has the form If this is a RC release, the version for JVM packages has the form
<major>.<minor>.<patch>-RC1 <major>.<minor>.<patch>-RC1
""" """
import argparse import argparse
import datetime import datetime
import os import os

View File

@ -1,4 +1,5 @@
"""Utilities for packaging R code and running tests.""" """Utilities for packaging R code and running tests."""
import argparse import argparse
import os import os
import shutil import shutil

View File

@ -1,4 +1,5 @@
"""Utilities for the CI.""" """Utilities for the CI."""
import os import os
from datetime import datetime, timedelta from datetime import datetime, timedelta
from functools import wraps from functools import wraps

View File

@ -1,5 +1,6 @@
"""Loading a pickled model generated by test_pickling.py, only used by """Loading a pickled model generated by test_pickling.py, only used by
`test_gpu_with_dask.py`""" `test_gpu_with_dask.py`"""
import json import json
import os import os

View File

@ -1,4 +1,5 @@
"""Test model IO with pickle.""" """Test model IO with pickle."""
import os import os
import pickle import pickle
import subprocess import subprocess

View File

@ -1,4 +1,5 @@
"""Tests for running inplace prediction.""" """Tests for running inplace prediction."""
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
import numpy as np import numpy as np

View File

@ -1,4 +1,5 @@
"""Copyright 2019-2023, XGBoost contributors""" """Copyright 2019-2023, XGBoost contributors"""
import asyncio import asyncio
import json import json
from collections import OrderedDict from collections import OrderedDict

View File

@ -1,4 +1,5 @@
"""Copyright 2019-2022 XGBoost contributors""" """Copyright 2019-2022 XGBoost contributors"""
import asyncio import asyncio
import json import json
import os import os