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
all ranged labels.
"""
import matplotlib.pyplot as plt
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.distributed import Client, LocalCluster

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,6 +17,7 @@ See Also
- :ref:`sphx_glr_python_examples_cat_pipeline.py`
"""
from typing import Tuple
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.
"""
import os
import tempfile
from typing import Callable, List, Tuple

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
Demo for using xgboost with sklearn
===================================
"""
import multiprocessing
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
"""
import sklearn.datasets
from pyspark.ml.evaluation import MulticlassClassificationEvaluator, RegressionEvaluator
from pyspark.ml.linalg import Vectors

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
"""
Functions for building libxgboost
"""
import logging
import os
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
of brevity.
"""
import dataclasses
import logging
import os

View File

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

View File

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

View File

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

View File

@ -64,13 +64,11 @@ class XGBoostError(ValueError):
@overload
def from_pystr_to_cstr(data: str) -> bytes:
...
def from_pystr_to_cstr(data: str) -> bytes: ...
@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]:

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 base_margin is not None and isinstance(base_margin, da.Array):
# Easier for map_partitions
base_margin_df: Optional[
Union[dd.DataFrame, dd.Series]
] = base_margin.to_dask_dataframe()
base_margin_df: Optional[Union[dd.DataFrame, dd.Series]] = (
base_margin.to_dask_dataframe()
)
else:
base_margin_df = base_margin
predictions = dd.map_partitions(

View File

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

View File

@ -1,4 +1,5 @@
"""XGBoost pyspark integration submodule for core code."""
import base64
# 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."""
# pylint: disable=too-many-ancestors
# pylint: disable=fixme, too-many-ancestors, protected-access, no-member, invalid-name
# pylint: disable=unused-argument, too-many-locals

View File

@ -1,4 +1,5 @@
"""Xgboost pyspark integration submodule for params."""
from typing import Dict
# pylint: disable=too-few-public-methods
@ -55,7 +56,6 @@ class HasFeaturesCols(Params):
class HasEnableSparseDataOptim(Params):
"""
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.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
"""Tests for updaters."""
import json
from functools import partial, update_wrapper
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
<major>.<minor>.<patch>-RC1
"""
import argparse
import datetime
import os

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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