From 79eab8633b13cc5a9cce036b7fa7df1a0da1a776 Mon Sep 17 00:00:00 2001 From: jirka Date: Wed, 4 Sep 2024 00:03:37 +0200 Subject: [PATCH] apply --- .pre-commit-config.yaml | 3 +- pyproject.toml | 5 ++-- .../cudf/cudf/core/_internals/expressions.py | 1 - python/cudf/cudf/core/_internals/timezones.py | 2 +- python/cudf/cudf/core/buffer/buffer.py | 3 +- .../cudf/cudf/core/buffer/spillable_buffer.py | 3 +- python/cudf/cudf/core/byte_pair_encoding.py | 2 ++ python/cudf/cudf/core/column/column.py | 7 +++-- python/cudf/cudf/core/column/numerical.py | 3 +- python/cudf/cudf/core/column/string.py | 3 +- python/cudf/cudf/core/df_protocol.py | 3 +- python/cudf/cudf/core/indexed_frame.py | 3 +- python/cudf/cudf/core/series.py | 4 ++- python/cudf/cudf/core/subword_tokenizer.py | 2 ++ python/cudf/cudf/core/tokenize_vocabulary.py | 2 ++ python/cudf/cudf/core/udf/masked_lowering.py | 4 ++- python/cudf/cudf/core/udf/strings_lowering.py | 2 ++ python/cudf/cudf/core/udf/strings_typing.py | 3 +- python/cudf/cudf/core/udf/utils.py | 3 +- python/cudf/cudf/pandas/_wrappers/pandas.py | 30 ++++++++++++++++++- python/cudf/cudf/tests/conftest.py | 1 - .../tests/indexes/datetime/test_indexing.py | 3 +- .../indexes/datetime/test_time_specific.py | 3 +- .../cudf/tests/series/test_datetimelike.py | 2 +- python/cudf/cudf/tests/test_binops.py | 3 +- python/cudf/cudf/tests/test_dataframe.py | 3 +- python/cudf/cudf/tests/test_groupby.py | 3 +- python/cudf/cudf/tests/test_indexing.py | 3 +- python/cudf/cudf/tests/test_parquet.py | 3 +- .../cudf/tests/test_performance_tracking.py | 1 - python/cudf/cudf/tests/test_reductions.py | 3 +- python/cudf/cudf/tests/test_repr.py | 3 +- python/cudf/cudf/tests/test_scalar.py | 3 +- python/cudf/cudf/tests/test_serialize.py | 3 +- python/cudf/cudf/tests/test_spilling.py | 1 - python/cudf/cudf/tests/test_string_udfs.py | 3 +- python/cudf/cudf/tests/test_timedelta.py | 3 +- python/cudf/cudf/tests/test_unaops.py | 3 +- python/cudf/cudf/utils/gpu_utils.py | 1 - .../cudf/cudf/utils/performance_tracking.py | 1 - python/cudf/cudf/utils/utils.py | 1 - .../tests/test_dask.py | 3 +- .../tests/test_stumpy_distributed.py | 3 +- python/custreamz/custreamz/kafka.py | 4 +-- python/custreamz/custreamz/tests/conftest.py | 1 + .../custreamz/tests/test_dataframes.py | 2 -- python/dask_cudf/dask_cudf/backends.py | 5 ++-- python/dask_cudf/dask_cudf/core.py | 8 ++--- .../dask_cudf/dask_cudf/expr/_collection.py | 13 +++++--- python/dask_cudf/dask_cudf/expr/_expr.py | 5 ++-- python/dask_cudf/dask_cudf/expr/_groupby.py | 7 +++-- python/dask_cudf/dask_cudf/groupby.py | 4 +-- python/dask_cudf/dask_cudf/io/csv.py | 5 ++-- python/dask_cudf/dask_cudf/io/json.py | 6 ++-- python/dask_cudf/dask_cudf/io/orc.py | 10 +++---- python/dask_cudf/dask_cudf/io/parquet.py | 4 +-- .../dask_cudf/dask_cudf/io/tests/test_csv.py | 4 +-- .../dask_cudf/dask_cudf/io/tests/test_json.py | 5 ++-- .../dask_cudf/dask_cudf/io/tests/test_orc.py | 4 +-- .../dask_cudf/io/tests/test_parquet.py | 4 +-- .../dask_cudf/dask_cudf/io/tests/test_s3.py | 1 - .../dask_cudf/dask_cudf/io/tests/test_text.py | 4 +-- python/dask_cudf/dask_cudf/sorting.py | 1 - .../dask_cudf/tests/test_accessor.py | 8 ++--- .../dask_cudf/tests/test_applymap.py | 3 +- .../dask_cudf/dask_cudf/tests/test_binops.py | 4 +-- python/dask_cudf/dask_cudf/tests/test_core.py | 8 ++--- .../dask_cudf/tests/test_delayed_io.py | 4 +-- .../dask_cudf/tests/test_dispatch.py | 1 - .../dask_cudf/tests/test_distributed.py | 6 ++-- .../dask_cudf/dask_cudf/tests/test_groupby.py | 6 ++-- python/dask_cudf/dask_cudf/tests/test_join.py | 2 -- .../dask_cudf/dask_cudf/tests/test_onehot.py | 2 -- .../dask_cudf/tests/test_reductions.py | 4 +-- python/dask_cudf/dask_cudf/tests/test_sort.py | 4 +-- .../dask_cudf/dask_cudf/tests/test_struct.py | 3 +- python/dask_cudf/dask_cudf/tests/utils.py | 6 ++-- .../tests/test_column_from_device.py | 3 +- .../pylibcudf/tests/test_null_mask.py | 3 +- 79 files changed, 152 insertions(+), 156 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79bcd6955e8..ed20c825adf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: hooks: - id: cython-lint - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.10.0' + rev: v1.10.0 hooks: - id: mypy additional_dependencies: [types-cachetools] @@ -129,6 +129,7 @@ repos: rev: v0.4.8 hooks: - id: ruff + args: ["--fix"] files: python/.*$ - id: ruff-format files: python/.*$ diff --git a/pyproject.toml b/pyproject.toml index 8ee84382c46..37217e12a25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,8 +98,6 @@ ignore = [ "E203", # line-too-long (due to Copyright header) "E501", - # [*] Import block is un-sorted or un-formatted - "I001", ] fixable = ["ALL"] exclude = [ @@ -107,6 +105,9 @@ exclude = [ "__init__.py", ] +[tool.ruff.lint.isort] +known-first-party = ["cudf*", "dask_cudf", "custreamz"] + [tool.ruff.lint.per-file-ignores] # Lots of pytest implicitly injected attributes in conftest-patch.py "python/cudf/cudf/pandas/scripts/conftest-patch.py" = ["F821"] diff --git a/python/cudf/cudf/core/_internals/expressions.py b/python/cudf/cudf/core/_internals/expressions.py index 67bde5a72b2..a1d443afac9 100644 --- a/python/cudf/cudf/core/_internals/expressions.py +++ b/python/cudf/cudf/core/_internals/expressions.py @@ -5,7 +5,6 @@ import functools import pyarrow as pa - import pylibcudf as plc from pylibcudf.expressions import ( ASTOperator, diff --git a/python/cudf/cudf/core/_internals/timezones.py b/python/cudf/cudf/core/_internals/timezones.py index fd89904e766..cdd2e64e945 100644 --- a/python/cudf/cudf/core/_internals/timezones.py +++ b/python/cudf/cudf/core/_internals/timezones.py @@ -3,12 +3,12 @@ import datetime import os -import zoneinfo from functools import lru_cache from typing import TYPE_CHECKING, Literal import numpy as np import pandas as pd +import zoneinfo import cudf from cudf._lib.timezone import make_timezone_transition_table diff --git a/python/cudf/cudf/core/buffer/buffer.py b/python/cudf/cudf/core/buffer/buffer.py index 32ae8c5ee53..57bb69f2b8d 100644 --- a/python/cudf/cudf/core/buffer/buffer.py +++ b/python/cudf/cudf/core/buffer/buffer.py @@ -9,10 +9,9 @@ from typing import Any, Literal, Mapping import numpy -from typing_extensions import Self - import pylibcudf import rmm +from typing_extensions import Self import cudf from cudf.core.abc import Serializable diff --git a/python/cudf/cudf/core/buffer/spillable_buffer.py b/python/cudf/cudf/core/buffer/spillable_buffer.py index 4c9e524ee05..66dba2404a9 100644 --- a/python/cudf/cudf/core/buffer/spillable_buffer.py +++ b/python/cudf/cudf/core/buffer/spillable_buffer.py @@ -11,9 +11,8 @@ import numpy import nvtx -from typing_extensions import Self - import rmm +from typing_extensions import Self from cudf.core.buffer.buffer import ( Buffer, diff --git a/python/cudf/cudf/core/byte_pair_encoding.py b/python/cudf/cudf/core/byte_pair_encoding.py index 6ca64a0a2be..1f684ea160e 100644 --- a/python/cudf/cudf/core/byte_pair_encoding.py +++ b/python/cudf/cudf/core/byte_pair_encoding.py @@ -5,6 +5,8 @@ import cudf from cudf._lib.nvtext.byte_pair_encode import ( BPEMergePairs as cpp_merge_pairs, +) +from cudf._lib.nvtext.byte_pair_encode import ( byte_pair_encoding as cpp_byte_pair_encoding, ) diff --git a/python/cudf/cudf/core/column/column.py b/python/cudf/cudf/core/column/column.py index 7674565e2c3..a94f0e78019 100644 --- a/python/cudf/cudf/core/column/column.py +++ b/python/cudf/cudf/core/column/column.py @@ -14,12 +14,11 @@ import pandas as pd import pyarrow as pa import pyarrow.compute as pc +import rmm from numba import cuda from pandas.core.arrays.arrow.extension_types import ArrowIntervalType from typing_extensions import Self -import rmm - import cudf from cudf import _lib as libcudf from cudf._lib.column import Column @@ -31,10 +30,12 @@ from cudf._lib.scalar import as_device_scalar from cudf._lib.stream_compaction import ( apply_boolean_mask, - distinct_count as cpp_distinct_count, drop_duplicates, drop_nulls, ) +from cudf._lib.stream_compaction import ( + distinct_count as cpp_distinct_count, +) from cudf._lib.transform import bools_to_mask from cudf._lib.types import size_type_dtype from cudf.api.types import ( diff --git a/python/cudf/cudf/core/column/numerical.py b/python/cudf/cudf/core/column/numerical.py index 78d2814ed26..3ae49d91c72 100644 --- a/python/cudf/cudf/core/column/numerical.py +++ b/python/cudf/cudf/core/column/numerical.py @@ -7,9 +7,8 @@ import numpy as np import pandas as pd -from typing_extensions import Self - import pylibcudf +from typing_extensions import Self import cudf from cudf import _lib as libcudf diff --git a/python/cudf/cudf/core/column/string.py b/python/cudf/cudf/core/column/string.py index 16e6908f308..b2a89d2d01f 100644 --- a/python/cudf/cudf/core/column/string.py +++ b/python/cudf/cudf/core/column/string.py @@ -14,7 +14,8 @@ import cudf import cudf.api.types from cudf import _lib as libcudf -from cudf._lib import string_casting as str_cast, strings as libstrings +from cudf._lib import string_casting as str_cast +from cudf._lib import strings as libstrings from cudf._lib.column import Column from cudf._lib.types import size_type_dtype from cudf.api.types import is_integer, is_scalar, is_string_dtype diff --git a/python/cudf/cudf/core/df_protocol.py b/python/cudf/cudf/core/df_protocol.py index 5250a741d3d..15efd6a0a3e 100644 --- a/python/cudf/cudf/core/df_protocol.py +++ b/python/cudf/cudf/core/df_protocol.py @@ -7,9 +7,8 @@ import cupy as cp import numpy as np -from numba.cuda import as_cuda_array - import rmm +from numba.cuda import as_cuda_array import cudf from cudf.core.buffer import Buffer, as_buffer diff --git a/python/cudf/cudf/core/indexed_frame.py b/python/cudf/cudf/core/indexed_frame.py index fd6bf37f0e6..4fbb7a0a615 100644 --- a/python/cudf/cudf/core/indexed_frame.py +++ b/python/cudf/cudf/core/indexed_frame.py @@ -22,9 +22,8 @@ import cupy as cp import numpy as np import pandas as pd -from typing_extensions import Self - import pylibcudf +from typing_extensions import Self import cudf import cudf._lib as libcudf diff --git a/python/cudf/cudf/core/series.py b/python/cudf/cudf/core/series.py index 48445f018d3..4b4a2b3bde9 100644 --- a/python/cudf/cudf/core/series.py +++ b/python/cudf/cudf/core/series.py @@ -39,9 +39,11 @@ ) from cudf.core.column.categorical import ( _DEFAULT_CATEGORICAL_VALUE, - CategoricalAccessor as CategoricalAccessor, CategoricalColumn, ) +from cudf.core.column.categorical import ( + CategoricalAccessor as CategoricalAccessor, +) from cudf.core.column.column import concat_columns from cudf.core.column.lists import ListMethods from cudf.core.column.string import StringMethods diff --git a/python/cudf/cudf/core/subword_tokenizer.py b/python/cudf/cudf/core/subword_tokenizer.py index 9e59b134b73..77324bfabfc 100644 --- a/python/cudf/cudf/core/subword_tokenizer.py +++ b/python/cudf/cudf/core/subword_tokenizer.py @@ -8,6 +8,8 @@ from cudf._lib.nvtext.subword_tokenize import ( Hashed_Vocabulary as cpp_hashed_vocabulary, +) +from cudf._lib.nvtext.subword_tokenize import ( subword_tokenize_inmem_hash as cpp_subword_tokenize, ) diff --git a/python/cudf/cudf/core/tokenize_vocabulary.py b/python/cudf/cudf/core/tokenize_vocabulary.py index 99d85c0c5c0..1c8fbd48de5 100644 --- a/python/cudf/cudf/core/tokenize_vocabulary.py +++ b/python/cudf/cudf/core/tokenize_vocabulary.py @@ -5,6 +5,8 @@ import cudf from cudf._lib.nvtext.tokenize import ( TokenizeVocabulary as cpp_tokenize_vocabulary, +) +from cudf._lib.nvtext.tokenize import ( tokenize_with_vocabulary as cpp_tokenize_with_vocabulary, ) diff --git a/python/cudf/cudf/core/udf/masked_lowering.py b/python/cudf/cudf/core/udf/masked_lowering.py index ae09294e3f9..10abff85d3c 100644 --- a/python/cudf/cudf/core/udf/masked_lowering.py +++ b/python/cudf/cudf/core/udf/masked_lowering.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. import operator @@ -7,6 +7,8 @@ from numba.core.typing import signature as nb_signature from numba.cuda.cudaimpl import ( lower as cuda_lower, +) +from numba.cuda.cudaimpl import ( registry as cuda_lowering_registry, ) from numba.extending import lower_builtin, types diff --git a/python/cudf/cudf/core/udf/strings_lowering.py b/python/cudf/cudf/core/udf/strings_lowering.py index 3c02ee52b25..53c06de9677 100644 --- a/python/cudf/cudf/core/udf/strings_lowering.py +++ b/python/cudf/cudf/core/udf/strings_lowering.py @@ -9,6 +9,8 @@ from numba.core.typing import signature as nb_signature from numba.cuda.cudaimpl import ( lower as cuda_lower, +) +from numba.cuda.cudaimpl import ( registry as cuda_lowering_registry, ) diff --git a/python/cudf/cudf/core/udf/strings_typing.py b/python/cudf/cudf/core/udf/strings_typing.py index 43604ab21a7..e34a116659a 100644 --- a/python/cudf/cudf/core/udf/strings_typing.py +++ b/python/cudf/cudf/core/udf/strings_typing.py @@ -3,14 +3,13 @@ import operator import numpy as np +import rmm from numba import types from numba.core.extending import models, register_model from numba.core.typing import signature as nb_signature from numba.core.typing.templates import AbstractTemplate, AttributeTemplate from numba.cuda.cudadecl import registry as cuda_decl_registry -import rmm - # libcudf size_type size_type = types.int32 diff --git a/python/cudf/cudf/core/udf/utils.py b/python/cudf/cudf/core/udf/utils.py index 6d7362952c9..057149a8c51 100644 --- a/python/cudf/cudf/core/udf/utils.py +++ b/python/cudf/cudf/core/udf/utils.py @@ -9,6 +9,7 @@ import cupy as cp import llvmlite.binding as ll import numpy as np +import rmm from cuda import cudart from numba import cuda, typeof from numba.core.datamodel import default_manager, models @@ -17,8 +18,6 @@ from numba.np import numpy_support from numba.types import CPointer, Poison, Record, Tuple, boolean, int64, void -import rmm - from cudf._lib import strings_udf from cudf.api.types import is_scalar from cudf.core.column.column import as_column diff --git a/python/cudf/cudf/pandas/_wrappers/pandas.py b/python/cudf/cudf/pandas/_wrappers/pandas.py index 6d03063fa27..3e414a0b29a 100644 --- a/python/cudf/cudf/pandas/_wrappers/pandas.py +++ b/python/cudf/cudf/pandas/_wrappers/pandas.py @@ -11,17 +11,41 @@ import pandas as pd from pandas.tseries.holiday import ( AbstractHolidayCalendar as pd_AbstractHolidayCalendar, +) +from pandas.tseries.holiday import ( EasterMonday as pd_EasterMonday, +) +from pandas.tseries.holiday import ( GoodFriday as pd_GoodFriday, +) +from pandas.tseries.holiday import ( Holiday as pd_Holiday, +) +from pandas.tseries.holiday import ( HolidayCalendarFactory as pd_HolidayCalendarFactory, +) +from pandas.tseries.holiday import ( HolidayCalendarMetaClass as pd_HolidayCalendarMetaClass, +) +from pandas.tseries.holiday import ( USColumbusDay as pd_USColumbusDay, +) +from pandas.tseries.holiday import ( USFederalHolidayCalendar as pd_USFederalHolidayCalendar, +) +from pandas.tseries.holiday import ( USLaborDay as pd_USLaborDay, +) +from pandas.tseries.holiday import ( USMartinLutherKingJr as pd_USMartinLutherKingJr, +) +from pandas.tseries.holiday import ( USMemorialDay as pd_USMemorialDay, +) +from pandas.tseries.holiday import ( USPresidentsDay as pd_USPresidentsDay, +) +from pandas.tseries.holiday import ( USThanksgivingDay as pd_USThanksgivingDay, ) @@ -36,9 +60,13 @@ _FastSlowAttribute, _FunctionProxy, _Unusable, + register_proxy_func, +) +from ..fast_slow_proxy import ( make_final_proxy_type as _make_final_proxy_type, +) +from ..fast_slow_proxy import ( make_intermediate_proxy_type as _make_intermediate_proxy_type, - register_proxy_func, ) from .common import ( array_function_method, diff --git a/python/cudf/cudf/tests/conftest.py b/python/cudf/cudf/tests/conftest.py index 437bc4cba67..cbeafb10e73 100644 --- a/python/cudf/cudf/tests/conftest.py +++ b/python/cudf/cudf/tests/conftest.py @@ -7,7 +7,6 @@ import cupy as cp import numpy as np import pytest - import rmm # noqa: F401 import cudf diff --git a/python/cudf/cudf/tests/indexes/datetime/test_indexing.py b/python/cudf/cudf/tests/indexes/datetime/test_indexing.py index 4c0ce2ed191..ba4f4096e60 100644 --- a/python/cudf/cudf/tests/indexes/datetime/test_indexing.py +++ b/python/cudf/cudf/tests/indexes/datetime/test_indexing.py @@ -1,7 +1,6 @@ # Copyright (c) 2023-2024, NVIDIA CORPORATION. -import zoneinfo - import pandas as pd +import zoneinfo import cudf from cudf.testing import assert_eq diff --git a/python/cudf/cudf/tests/indexes/datetime/test_time_specific.py b/python/cudf/cudf/tests/indexes/datetime/test_time_specific.py index 7cc629270b1..c750f66f497 100644 --- a/python/cudf/cudf/tests/indexes/datetime/test_time_specific.py +++ b/python/cudf/cudf/tests/indexes/datetime/test_time_specific.py @@ -1,7 +1,6 @@ # Copyright (c) 2022-2024, NVIDIA CORPORATION. -import zoneinfo - import pandas as pd +import zoneinfo import cudf from cudf.testing import assert_eq diff --git a/python/cudf/cudf/tests/series/test_datetimelike.py b/python/cudf/cudf/tests/series/test_datetimelike.py index cea86a5499e..697834c5d4c 100644 --- a/python/cudf/cudf/tests/series/test_datetimelike.py +++ b/python/cudf/cudf/tests/series/test_datetimelike.py @@ -2,10 +2,10 @@ import datetime import os -import zoneinfo import pandas as pd import pytest +import zoneinfo import cudf from cudf import date_range diff --git a/python/cudf/cudf/tests/test_binops.py b/python/cudf/cudf/tests/test_binops.py index 4256ec872e6..d45d2513010 100644 --- a/python/cudf/cudf/tests/test_binops.py +++ b/python/cudf/cudf/tests/test_binops.py @@ -15,7 +15,8 @@ from cudf import Index, Series from cudf.core._compat import PANDAS_CURRENT_SUPPORTED_VERSION, PANDAS_VERSION from cudf.core.buffer.spill_manager import get_global_manager -from cudf.testing import _utils as utils, assert_eq +from cudf.testing import _utils as utils +from cudf.testing import assert_eq from cudf.utils.dtypes import ( BOOL_TYPES, DATETIME_TYPES, diff --git a/python/cudf/cudf/tests/test_dataframe.py b/python/cudf/cudf/tests/test_dataframe.py index 9122a1074ac..ac97c43980c 100644 --- a/python/cudf/cudf/tests/test_dataframe.py +++ b/python/cudf/cudf/tests/test_dataframe.py @@ -30,7 +30,8 @@ from cudf.core.buffer.spill_manager import get_global_manager from cudf.core.column import column from cudf.errors import MixedTypeError -from cudf.testing import _utils as utils, assert_eq, assert_neq +from cudf.testing import _utils as utils +from cudf.testing import assert_eq, assert_neq from cudf.testing._utils import ( ALL_TYPES, DATETIME_TYPES, diff --git a/python/cudf/cudf/tests/test_groupby.py b/python/cudf/cudf/tests/test_groupby.py index 74f04c0584f..b127c246050 100644 --- a/python/cudf/cudf/tests/test_groupby.py +++ b/python/cudf/cudf/tests/test_groupby.py @@ -12,11 +12,10 @@ import numpy as np import pandas as pd import pytest +import rmm from numba import cuda from numpy.testing import assert_array_equal -import rmm - import cudf from cudf import DataFrame, Series from cudf.api.extensions import no_default diff --git a/python/cudf/cudf/tests/test_indexing.py b/python/cudf/cudf/tests/test_indexing.py index 9df2852dde8..eb874dbd2b1 100644 --- a/python/cudf/cudf/tests/test_indexing.py +++ b/python/cudf/cudf/tests/test_indexing.py @@ -11,7 +11,8 @@ import cudf from cudf.core._compat import PANDAS_CURRENT_SUPPORTED_VERSION, PANDAS_VERSION -from cudf.testing import _utils as utils, assert_eq +from cudf.testing import _utils as utils +from cudf.testing import assert_eq from cudf.testing._utils import ( INTEGER_TYPES, assert_exceptions_equal, diff --git a/python/cudf/cudf/tests/test_parquet.py b/python/cudf/cudf/tests/test_parquet.py index 6623c537ddf..8aa0511c2db 100644 --- a/python/cudf/cudf/tests/test_parquet.py +++ b/python/cudf/cudf/tests/test_parquet.py @@ -28,7 +28,8 @@ ParquetWriter, merge_parquet_filemetadata, ) -from cudf.testing import assert_eq, dataset_generator as dg +from cudf.testing import assert_eq +from cudf.testing import dataset_generator as dg from cudf.testing._utils import TIMEDELTA_TYPES, set_random_null_mask_inplace diff --git a/python/cudf/cudf/tests/test_performance_tracking.py b/python/cudf/cudf/tests/test_performance_tracking.py index e886b77af3f..515af5d412c 100644 --- a/python/cudf/cudf/tests/test_performance_tracking.py +++ b/python/cudf/cudf/tests/test_performance_tracking.py @@ -3,7 +3,6 @@ from io import StringIO import pytest - import rmm.mr import rmm.statistics diff --git a/python/cudf/cudf/tests/test_reductions.py b/python/cudf/cudf/tests/test_reductions.py index a70a2ea15dd..82559c4761a 100644 --- a/python/cudf/cudf/tests/test_reductions.py +++ b/python/cudf/cudf/tests/test_reductions.py @@ -11,7 +11,8 @@ import cudf from cudf import Series from cudf.core.dtypes import Decimal32Dtype, Decimal64Dtype, Decimal128Dtype -from cudf.testing import _utils as utils, assert_eq +from cudf.testing import _utils as utils +from cudf.testing import assert_eq from cudf.testing._utils import NUMERIC_TYPES, expect_warning_if, gen_rand params_dtype = NUMERIC_TYPES diff --git a/python/cudf/cudf/tests/test_repr.py b/python/cudf/cudf/tests/test_repr.py index 95e19fae501..c8bf501e032 100644 --- a/python/cudf/cudf/tests/test_repr.py +++ b/python/cudf/cudf/tests/test_repr.py @@ -6,7 +6,8 @@ import numpy as np import pandas as pd import pytest -from hypothesis import given, settings, strategies as st +from hypothesis import given, settings +from hypothesis import strategies as st import cudf from cudf.testing import _utils as utils diff --git a/python/cudf/cudf/tests/test_scalar.py b/python/cudf/cudf/tests/test_scalar.py index f2faf4343b6..fd390c7a509 100644 --- a/python/cudf/cudf/tests/test_scalar.py +++ b/python/cudf/cudf/tests/test_scalar.py @@ -8,9 +8,8 @@ import pandas as pd import pyarrow as pa import pytest -from packaging import version - import rmm +from packaging import version import cudf from cudf._lib.copying import get_element diff --git a/python/cudf/cudf/tests/test_serialize.py b/python/cudf/cudf/tests/test_serialize.py index 0b892a51895..417913bff7f 100644 --- a/python/cudf/cudf/tests/test_serialize.py +++ b/python/cudf/cudf/tests/test_serialize.py @@ -9,7 +9,8 @@ import pytest import cudf -from cudf.testing import _utils as utils, assert_eq +from cudf.testing import _utils as utils +from cudf.testing import assert_eq @pytest.mark.parametrize( diff --git a/python/cudf/cudf/tests/test_spilling.py b/python/cudf/cudf/tests/test_spilling.py index 7af83a99d60..089718b321d 100644 --- a/python/cudf/cudf/tests/test_spilling.py +++ b/python/cudf/cudf/tests/test_spilling.py @@ -14,7 +14,6 @@ import pandas import pandas.testing import pytest - import rmm import cudf diff --git a/python/cudf/cudf/tests/test_string_udfs.py b/python/cudf/cudf/tests/test_string_udfs.py index 69876d97aad..0c5fe495462 100644 --- a/python/cudf/cudf/tests/test_string_udfs.py +++ b/python/cudf/cudf/tests/test_string_udfs.py @@ -4,12 +4,11 @@ import numpy as np import pandas as pd import pytest +import rmm from numba import cuda from numba.core.typing import signature as nb_signature from numba.types import CPointer, void -import rmm - import cudf from cudf._lib.strings_udf import ( column_from_udf_string_array, diff --git a/python/cudf/cudf/tests/test_timedelta.py b/python/cudf/cudf/tests/test_timedelta.py index d622ff6b94e..25ae6959187 100644 --- a/python/cudf/cudf/tests/test_timedelta.py +++ b/python/cudf/cudf/tests/test_timedelta.py @@ -9,7 +9,8 @@ import pytest import cudf -from cudf.testing import _utils as utils, assert_eq +from cudf.testing import _utils as utils +from cudf.testing import assert_eq from cudf.testing._utils import assert_exceptions_equal _TIMEDELTA_DATA = [ diff --git a/python/cudf/cudf/tests/test_unaops.py b/python/cudf/cudf/tests/test_unaops.py index 5f5d79c1dce..3ba8f562d8e 100644 --- a/python/cudf/cudf/tests/test_unaops.py +++ b/python/cudf/cudf/tests/test_unaops.py @@ -10,7 +10,8 @@ import cudf from cudf import Series -from cudf.testing import _utils as utils, assert_eq +from cudf.testing import _utils as utils +from cudf.testing import assert_eq _unaops = [operator.abs, operator.invert, operator.neg, np.ceil, np.floor] diff --git a/python/cudf/cudf/utils/gpu_utils.py b/python/cudf/cudf/utils/gpu_utils.py index b5387ddeb5f..e86ee57ba51 100644 --- a/python/cudf/cudf/utils/gpu_utils.py +++ b/python/cudf/cudf/utils/gpu_utils.py @@ -16,7 +16,6 @@ def validate_setup(): import warnings from cuda.cudart import cudaDeviceAttr, cudaError_t - from rmm._cuda.gpu import ( CUDARuntimeError, deviceGetName, diff --git a/python/cudf/cudf/utils/performance_tracking.py b/python/cudf/cudf/utils/performance_tracking.py index 30c891d0d5a..de7d7bfbbe9 100644 --- a/python/cudf/cudf/utils/performance_tracking.py +++ b/python/cudf/cudf/utils/performance_tracking.py @@ -8,7 +8,6 @@ import sys import nvtx - import rmm.statistics from cudf.options import get_option diff --git a/python/cudf/cudf/utils/utils.py b/python/cudf/cudf/utils/utils.py index 7347ec7866a..679bf7da796 100644 --- a/python/cudf/cudf/utils/utils.py +++ b/python/cudf/cudf/utils/utils.py @@ -9,7 +9,6 @@ import numpy as np import pandas as pd - import rmm import cudf diff --git a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_dask.py b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_dask.py index c34778dfded..dbc5a34dd91 100644 --- a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_dask.py +++ b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_dask.py @@ -1,7 +1,6 @@ # Copyright (c) 2023-2024, NVIDIA CORPORATION. -import pandas as pd - import dask.dataframe as dd +import pandas as pd def test_sum(): diff --git a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_stumpy_distributed.py b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_stumpy_distributed.py index 37e3cc34856..addf292da49 100644 --- a/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_stumpy_distributed.py +++ b/python/cudf/cudf_pandas_tests/third_party_integration_tests/tests/test_stumpy_distributed.py @@ -4,9 +4,8 @@ import pandas as pd import pytest import stumpy -from pandas._testing import assert_equal - from dask.distributed import Client, LocalCluster +from pandas._testing import assert_equal def stumpy_assert_equal(expected, got): diff --git a/python/custreamz/custreamz/kafka.py b/python/custreamz/custreamz/kafka.py index 0def0ba746e..7651bf98dda 100644 --- a/python/custreamz/custreamz/kafka.py +++ b/python/custreamz/custreamz/kafka.py @@ -1,8 +1,8 @@ -# Copyright (c) 2020-2023, NVIDIA CORPORATION. +# Copyright (c) 2020-2024, NVIDIA CORPORATION. import confluent_kafka as ck -from cudf_kafka._lib.kafka import KafkaDatasource import cudf +from cudf_kafka._lib.kafka import KafkaDatasource # Base class for anything class that needs to interact with Apache Kafka diff --git a/python/custreamz/custreamz/tests/conftest.py b/python/custreamz/custreamz/tests/conftest.py index 1cda9b71387..c5135bc6414 100644 --- a/python/custreamz/custreamz/tests/conftest.py +++ b/python/custreamz/custreamz/tests/conftest.py @@ -2,6 +2,7 @@ import socket import pytest + from custreamz import kafka diff --git a/python/custreamz/custreamz/tests/test_dataframes.py b/python/custreamz/custreamz/tests/test_dataframes.py index bae4b051cae..caf143ca238 100644 --- a/python/custreamz/custreamz/tests/test_dataframes.py +++ b/python/custreamz/custreamz/tests/test_dataframes.py @@ -11,10 +11,8 @@ import numpy as np import pandas as pd import pytest - from dask.dataframe.utils import assert_eq from distributed import Client - from streamz import Stream from streamz.dask import DaskStream from streamz.dataframe import Aggregation, DataFrame, DataFrames, Series diff --git a/python/dask_cudf/dask_cudf/backends.py b/python/dask_cudf/dask_cudf/backends.py index 9347ebba5de..1c30912f183 100644 --- a/python/dask_cudf/dask_cudf/backends.py +++ b/python/dask_cudf/dask_cudf/backends.py @@ -5,12 +5,10 @@ from functools import partial import cupy as cp +import dask.dataframe as dd import numpy as np import pandas as pd import pyarrow as pa -from pandas.api.types import is_scalar - -import dask.dataframe as dd from dask import config from dask.array.dispatch import percentile_lookup from dask.dataframe.backends import ( @@ -40,6 +38,7 @@ ) from dask.sizeof import sizeof as sizeof_dispatch from dask.utils import Dispatch, is_arraylike +from pandas.api.types import is_scalar import cudf from cudf.api.types import is_string_dtype diff --git a/python/dask_cudf/dask_cudf/core.py b/python/dask_cudf/dask_cudf/core.py index 3181c8d69ec..aa3f7706eda 100644 --- a/python/dask_cudf/dask_cudf/core.py +++ b/python/dask_cudf/dask_cudf/core.py @@ -6,24 +6,24 @@ import numpy as np import pandas as pd -from tlz import partition_all - from dask import dataframe as dd from dask.base import normalize_token, tokenize from dask.dataframe.core import ( Scalar, handle_out, - make_meta as dask_make_meta, map_partitions, ) +from dask.dataframe.core import ( + make_meta as dask_make_meta, +) from dask.dataframe.utils import raise_on_meta_error from dask.highlevelgraph import HighLevelGraph from dask.utils import M, OperatorMethodMixin, apply, derived_from, funcname +from tlz import partition_all import cudf from cudf import _lib as libcudf from cudf.utils.performance_tracking import _dask_cudf_performance_tracking - from dask_cudf import sorting from dask_cudf.accessors import ListMethods, StructMethods from dask_cudf.sorting import _deprecate_shuffle_kwarg, _get_shuffle_method diff --git a/python/dask_cudf/dask_cudf/expr/_collection.py b/python/dask_cudf/dask_cudf/expr/_collection.py index f60e4ff81ef..612be68f8e4 100644 --- a/python/dask_cudf/dask_cudf/expr/_collection.py +++ b/python/dask_cudf/dask_cudf/expr/_collection.py @@ -3,19 +3,24 @@ import warnings from functools import cached_property +from dask import config +from dask.dataframe.core import is_dataframe_like from dask_expr import ( DataFrame as DXDataFrame, +) +from dask_expr import ( FrameBase, + get_collection_type, +) +from dask_expr import ( Index as DXIndex, +) +from dask_expr import ( Series as DXSeries, - get_collection_type, ) from dask_expr._collection import new_collection from dask_expr._util import _raise_if_object_series -from dask import config -from dask.dataframe.core import is_dataframe_like - import cudf _LEGACY_WORKAROUND = ( diff --git a/python/dask_cudf/dask_cudf/expr/_expr.py b/python/dask_cudf/dask_cudf/expr/_expr.py index 8a2c50d3fe7..f690417eabf 100644 --- a/python/dask_cudf/dask_cudf/expr/_expr.py +++ b/python/dask_cudf/dask_cudf/expr/_expr.py @@ -2,14 +2,13 @@ import functools import dask_expr._shuffle as _shuffle_module +from dask.dataframe.core import is_dataframe_like, make_meta, meta_nonempty +from dask.dataframe.dispatch import is_categorical_dtype from dask_expr import new_collection from dask_expr._cumulative import CumulativeBlockwise from dask_expr._expr import Elemwise, Expr, VarColumns from dask_expr._reductions import Reduction, Var -from dask.dataframe.core import is_dataframe_like, make_meta, meta_nonempty -from dask.dataframe.dispatch import is_categorical_dtype - import cudf ## diff --git a/python/dask_cudf/dask_cudf/expr/_groupby.py b/python/dask_cudf/dask_cudf/expr/_groupby.py index 65688115b59..0497eb45d57 100644 --- a/python/dask_cudf/dask_cudf/expr/_groupby.py +++ b/python/dask_cudf/dask_cudf/expr/_groupby.py @@ -1,14 +1,17 @@ # Copyright (c) 2024, NVIDIA CORPORATION. +from dask.dataframe.groupby import Aggregation from dask_expr._groupby import ( GroupBy as DXGroupBy, +) +from dask_expr._groupby import ( SeriesGroupBy as DXSeriesGroupBy, +) +from dask_expr._groupby import ( SingleAggregation, ) from dask_expr._util import is_scalar -from dask.dataframe.groupby import Aggregation - from cudf.core.groupby.groupby import _deprecate_collect ## diff --git a/python/dask_cudf/dask_cudf/groupby.py b/python/dask_cudf/dask_cudf/groupby.py index bbbcde17b51..e320aecf66d 100644 --- a/python/dask_cudf/dask_cudf/groupby.py +++ b/python/dask_cudf/dask_cudf/groupby.py @@ -5,9 +5,10 @@ import numpy as np import pandas as pd - from dask.dataframe.core import ( DataFrame as DaskDataFrame, +) +from dask.dataframe.core import ( aca, split_out_on_cols, ) @@ -17,7 +18,6 @@ import cudf from cudf.core.groupby.groupby import _deprecate_collect from cudf.utils.performance_tracking import _dask_cudf_performance_tracking - from dask_cudf.sorting import _deprecate_shuffle_kwarg # aggregations that are dask-cudf optimized diff --git a/python/dask_cudf/dask_cudf/io/csv.py b/python/dask_cudf/dask_cudf/io/csv.py index fa5400344f9..c37834007eb 100644 --- a/python/dask_cudf/dask_cudf/io/csv.py +++ b/python/dask_cudf/dask_cudf/io/csv.py @@ -1,15 +1,14 @@ -# Copyright (c) 2020-2023, NVIDIA CORPORATION. +# Copyright (c) 2020-2024, NVIDIA CORPORATION. import os from glob import glob from warnings import warn -from fsspec.utils import infer_compression - from dask import dataframe as dd from dask.base import tokenize from dask.dataframe.io.csv import make_reader from dask.utils import apply, parse_bytes +from fsspec.utils import infer_compression import cudf diff --git a/python/dask_cudf/dask_cudf/io/json.py b/python/dask_cudf/dask_cudf/io/json.py index 98c5ceedb76..eca98db9233 100644 --- a/python/dask_cudf/dask_cudf/io/json.py +++ b/python/dask_cudf/dask_cudf/io/json.py @@ -2,16 +2,14 @@ from functools import partial -import numpy as np -from fsspec.core import get_compression, get_fs_token_paths - import dask +import numpy as np from dask.utils import parse_bytes +from fsspec.core import get_compression, get_fs_token_paths import cudf from cudf.core.column import as_column from cudf.utils.ioutils import _is_local_filesystem - from dask_cudf.backends import _default_backend diff --git a/python/dask_cudf/dask_cudf/io/orc.py b/python/dask_cudf/dask_cudf/io/orc.py index bed69f038b0..cb94f4db59d 100644 --- a/python/dask_cudf/dask_cudf/io/orc.py +++ b/python/dask_cudf/dask_cudf/io/orc.py @@ -2,13 +2,12 @@ from io import BufferedWriter, IOBase -from fsspec.core import get_fs_token_paths -from fsspec.utils import stringify_path -from pyarrow import orc as orc - from dask import dataframe as dd from dask.base import tokenize from dask.dataframe.io.utils import _get_pyarrow_dtypes +from fsspec.core import get_fs_token_paths +from fsspec.utils import stringify_path +from pyarrow import orc as orc import cudf @@ -162,7 +161,8 @@ def to_orc( """ - from dask import compute as dask_compute, delayed + from dask import compute as dask_compute + from dask import delayed # TODO: Use upstream dask implementation once available # (see: Dask Issue#5596) diff --git a/python/dask_cudf/dask_cudf/io/parquet.py b/python/dask_cudf/dask_cudf/io/parquet.py index e793d4381d1..3826e41bc43 100644 --- a/python/dask_cudf/dask_cudf/io/parquet.py +++ b/python/dask_cudf/dask_cudf/io/parquet.py @@ -6,10 +6,10 @@ import numpy as np import pandas as pd -from pyarrow import dataset as pa_ds, parquet as pq - from dask import dataframe as dd from dask.dataframe.io.parquet.arrow import ArrowDatasetEngine +from pyarrow import dataset as pa_ds +from pyarrow import parquet as pq try: from dask.dataframe.io.parquet import ( diff --git a/python/dask_cudf/dask_cudf/io/tests/test_csv.py b/python/dask_cudf/dask_cudf/io/tests/test_csv.py index a35a9f1be48..12812e1520c 100644 --- a/python/dask_cudf/dask_cudf/io/tests/test_csv.py +++ b/python/dask_cudf/dask_cudf/io/tests/test_csv.py @@ -4,15 +4,13 @@ import os import warnings +import dask import numpy as np import pandas as pd import pytest - -import dask from dask import dataframe as dd import cudf - import dask_cudf diff --git a/python/dask_cudf/dask_cudf/io/tests/test_json.py b/python/dask_cudf/dask_cudf/io/tests/test_json.py index abafbffd197..08ba8c16763 100644 --- a/python/dask_cudf/dask_cudf/io/tests/test_json.py +++ b/python/dask_cudf/dask_cudf/io/tests/test_json.py @@ -3,11 +3,10 @@ import math import os -import pandas as pd -import pytest - import dask import dask.dataframe as dd +import pandas as pd +import pytest from dask.utils import tmpfile import dask_cudf diff --git a/python/dask_cudf/dask_cudf/io/tests/test_orc.py b/python/dask_cudf/dask_cudf/io/tests/test_orc.py index 457e5546bd9..8bc51c88c08 100644 --- a/python/dask_cudf/dask_cudf/io/tests/test_orc.py +++ b/python/dask_cudf/dask_cudf/io/tests/test_orc.py @@ -4,13 +4,11 @@ import os from datetime import datetime, timezone -import pytest - import dask +import pytest from dask import dataframe as dd import cudf - import dask_cudf from dask_cudf.tests.utils import skip_dask_expr diff --git a/python/dask_cudf/dask_cudf/io/tests/test_parquet.py b/python/dask_cudf/dask_cudf/io/tests/test_parquet.py index 620a917109e..e6de4c86469 100644 --- a/python/dask_cudf/dask_cudf/io/tests/test_parquet.py +++ b/python/dask_cudf/dask_cudf/io/tests/test_parquet.py @@ -4,16 +4,14 @@ import math import os +import dask import numpy as np import pandas as pd import pytest - -import dask from dask import dataframe as dd from dask.utils import natural_sort_key import cudf - import dask_cudf from dask_cudf.tests.utils import skip_dask_expr, xfail_dask_expr diff --git a/python/dask_cudf/dask_cudf/io/tests/test_s3.py b/python/dask_cudf/dask_cudf/io/tests/test_s3.py index a14ffbc37dc..4659aeb9a7c 100644 --- a/python/dask_cudf/dask_cudf/io/tests/test_s3.py +++ b/python/dask_cudf/dask_cudf/io/tests/test_s3.py @@ -8,7 +8,6 @@ import fsspec import pandas as pd import pytest - from dask.dataframe import assert_eq import dask_cudf diff --git a/python/dask_cudf/dask_cudf/io/tests/test_text.py b/python/dask_cudf/dask_cudf/io/tests/test_text.py index 8912b7d5da6..1aa50e1a739 100644 --- a/python/dask_cudf/dask_cudf/io/tests/test_text.py +++ b/python/dask_cudf/dask_cudf/io/tests/test_text.py @@ -2,12 +2,10 @@ import os -import pytest - import dask.dataframe as dd +import pytest import cudf - import dask_cudf from dask_cudf.tests.utils import skip_dask_expr diff --git a/python/dask_cudf/dask_cudf/sorting.py b/python/dask_cudf/dask_cudf/sorting.py index a2ba4d1878e..8b9e379829d 100644 --- a/python/dask_cudf/dask_cudf/sorting.py +++ b/python/dask_cudf/dask_cudf/sorting.py @@ -7,7 +7,6 @@ import cupy import numpy as np import tlz as toolz - from dask import config from dask.base import tokenize from dask.dataframe import methods diff --git a/python/dask_cudf/dask_cudf/tests/test_accessor.py b/python/dask_cudf/dask_cudf/tests/test_accessor.py index 6f04b5737da..ca80b5379fe 100644 --- a/python/dask_cudf/dask_cudf/tests/test_accessor.py +++ b/python/dask_cudf/dask_cudf/tests/test_accessor.py @@ -1,18 +1,16 @@ # Copyright (c) 2019-2024, NVIDIA CORPORATION. +import dask import numpy as np import pandas as pd import pytest -from pandas.testing import assert_series_equal - -import dask from dask import dataframe as dd +from pandas.testing import assert_series_equal +import dask_cudf from cudf import DataFrame, Series, date_range from cudf.testing import assert_eq from cudf.testing._utils import does_not_raise - -import dask_cudf from dask_cudf.tests.utils import xfail_dask_expr ############################################################################# diff --git a/python/dask_cudf/dask_cudf/tests/test_applymap.py b/python/dask_cudf/dask_cudf/tests/test_applymap.py index d84235481c3..d8d0f87fbc8 100644 --- a/python/dask_cudf/dask_cudf/tests/test_applymap.py +++ b/python/dask_cudf/dask_cudf/tests/test_applymap.py @@ -1,9 +1,8 @@ # Copyright (c) 2022-2024, NVIDIA CORPORATION. import pytest -from pandas import NA - from dask import dataframe as dd +from pandas import NA from dask_cudf.tests.utils import _make_random_frame diff --git a/python/dask_cudf/dask_cudf/tests/test_binops.py b/python/dask_cudf/dask_cudf/tests/test_binops.py index 87bd401accd..5769fab8b29 100644 --- a/python/dask_cudf/dask_cudf/tests/test_binops.py +++ b/python/dask_cudf/dask_cudf/tests/test_binops.py @@ -1,15 +1,13 @@ -# Copyright (c) 2022, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. import operator import numpy as np import pandas as pd import pytest - from dask import dataframe as dd import cudf - from dask_cudf.tests.utils import _make_random_frame diff --git a/python/dask_cudf/dask_cudf/tests/test_core.py b/python/dask_cudf/dask_cudf/tests/test_core.py index 905d8c08135..3e49bad0231 100644 --- a/python/dask_cudf/dask_cudf/tests/test_core.py +++ b/python/dask_cudf/dask_cudf/tests/test_core.py @@ -3,17 +3,16 @@ import random import cupy as cp +import dask import numpy as np import pandas as pd import pytest - -import dask from dask import dataframe as dd -from dask.dataframe.core import make_meta as dask_make_meta, meta_nonempty +from dask.dataframe.core import make_meta as dask_make_meta +from dask.dataframe.core import meta_nonempty from dask.utils import M import cudf - import dask_cudf from dask_cudf.tests.utils import ( require_dask_expr, @@ -914,7 +913,6 @@ def test_correct_meta(): # Need these local imports in this specific order. # For context: https://github.com/rapidsai/cudf/issues/7946 import pandas as pd - from dask import dataframe as dd import dask_cudf # noqa: F401 diff --git a/python/dask_cudf/dask_cudf/tests/test_delayed_io.py b/python/dask_cudf/dask_cudf/tests/test_delayed_io.py index e6fb58ad6df..89ede64b3f9 100644 --- a/python/dask_cudf/dask_cudf/tests/test_delayed_io.py +++ b/python/dask_cudf/dask_cudf/tests/test_delayed_io.py @@ -6,12 +6,10 @@ import numpy as np import pytest -from pandas.testing import assert_frame_equal - from dask.delayed import delayed +from pandas.testing import assert_frame_equal import cudf - import dask_cudf diff --git a/python/dask_cudf/dask_cudf/tests/test_dispatch.py b/python/dask_cudf/dask_cudf/tests/test_dispatch.py index a12481a7bb4..8696b0c6f38 100644 --- a/python/dask_cudf/dask_cudf/tests/test_dispatch.py +++ b/python/dask_cudf/dask_cudf/tests/test_dispatch.py @@ -5,7 +5,6 @@ import numpy as np import pandas as pd import pytest - from dask.base import tokenize from dask.dataframe import assert_eq from dask.dataframe.methods import is_categorical_dtype diff --git a/python/dask_cudf/dask_cudf/tests/test_distributed.py b/python/dask_cudf/dask_cudf/tests/test_distributed.py index be10b0d4843..1a56bf7e129 100644 --- a/python/dask_cudf/dask_cudf/tests/test_distributed.py +++ b/python/dask_cudf/dask_cudf/tests/test_distributed.py @@ -1,17 +1,15 @@ # Copyright (c) 2020-2024, NVIDIA CORPORATION. +import dask import numba.cuda import pytest - -import dask from dask import dataframe as dd from dask.distributed import Client from distributed.utils_test import cleanup, loop, loop_in_thread # noqa: F401 import cudf -from cudf.testing import assert_eq - import dask_cudf +from cudf.testing import assert_eq dask_cuda = pytest.importorskip("dask_cuda") diff --git a/python/dask_cudf/dask_cudf/tests/test_groupby.py b/python/dask_cudf/dask_cudf/tests/test_groupby.py index cf916b713b2..d9e0f227d5d 100644 --- a/python/dask_cudf/dask_cudf/tests/test_groupby.py +++ b/python/dask_cudf/dask_cudf/tests/test_groupby.py @@ -1,17 +1,15 @@ # Copyright (c) 2021-2024, NVIDIA CORPORATION. +import dask import numpy as np import pandas as pd import pytest - -import dask from dask import dataframe as dd from dask.utils_test import hlg_layer import cudf -from cudf.testing._utils import expect_warning_if - import dask_cudf +from cudf.testing._utils import expect_warning_if from dask_cudf.groupby import OPTIMIZED_AGGS, _aggs_optimized from dask_cudf.tests.utils import QUERY_PLANNING_ON, xfail_dask_expr diff --git a/python/dask_cudf/dask_cudf/tests/test_join.py b/python/dask_cudf/dask_cudf/tests/test_join.py index 3e078c47cdd..f37f7656d2f 100644 --- a/python/dask_cudf/dask_cudf/tests/test_join.py +++ b/python/dask_cudf/dask_cudf/tests/test_join.py @@ -5,11 +5,9 @@ import numpy as np import pandas as pd import pytest - from dask import dataframe as dd import cudf - import dask_cudf param_nrows = [5, 10, 50, 100] diff --git a/python/dask_cudf/dask_cudf/tests/test_onehot.py b/python/dask_cudf/dask_cudf/tests/test_onehot.py index 0b7c7855e07..9e9f6c032b3 100644 --- a/python/dask_cudf/dask_cudf/tests/test_onehot.py +++ b/python/dask_cudf/dask_cudf/tests/test_onehot.py @@ -2,11 +2,9 @@ import pandas as pd import pytest - from dask import dataframe as dd import cudf - import dask_cudf from dask_cudf.tests.utils import xfail_dask_expr diff --git a/python/dask_cudf/dask_cudf/tests/test_reductions.py b/python/dask_cudf/dask_cudf/tests/test_reductions.py index 88b15718382..60d8a715a17 100644 --- a/python/dask_cudf/dask_cudf/tests/test_reductions.py +++ b/python/dask_cudf/dask_cudf/tests/test_reductions.py @@ -1,14 +1,12 @@ # Copyright (c) 2021-2024, NVIDIA CORPORATION. +import dask import numpy as np import pandas as pd import pytest - -import dask from dask import dataframe as dd import cudf - import dask_cudf diff --git a/python/dask_cudf/dask_cudf/tests/test_sort.py b/python/dask_cudf/dask_cudf/tests/test_sort.py index 9bbbbc79561..5c2fb10eb51 100644 --- a/python/dask_cudf/dask_cudf/tests/test_sort.py +++ b/python/dask_cudf/dask_cudf/tests/test_sort.py @@ -1,14 +1,12 @@ # Copyright (c) 2019-2024, NVIDIA CORPORATION. import cupy as cp +import dask import numpy as np import pytest - -import dask from dask import dataframe as dd import cudf - import dask_cudf from dask_cudf.tests.utils import xfail_dask_expr diff --git a/python/dask_cudf/dask_cudf/tests/test_struct.py b/python/dask_cudf/dask_cudf/tests/test_struct.py index 6abac4cf53b..21323fae732 100644 --- a/python/dask_cudf/dask_cudf/tests/test_struct.py +++ b/python/dask_cudf/dask_cudf/tests/test_struct.py @@ -1,9 +1,8 @@ -# Copyright (c) 2021-2022, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. import pytest import cudf - import dask_cudf diff --git a/python/dask_cudf/dask_cudf/tests/utils.py b/python/dask_cudf/dask_cudf/tests/utils.py index cc0c6899804..454600a0ed1 100644 --- a/python/dask_cudf/dask_cudf/tests/utils.py +++ b/python/dask_cudf/dask_cudf/tests/utils.py @@ -1,15 +1,13 @@ # Copyright (c) 2022-2024, NVIDIA CORPORATION. +import dask +import dask.dataframe as dd import numpy as np import pandas as pd import pytest from packaging.version import Version -import dask -import dask.dataframe as dd - import cudf - from dask_cudf.expr import QUERY_PLANNING_ON if QUERY_PLANNING_ON: diff --git a/python/pylibcudf/pylibcudf/tests/test_column_from_device.py b/python/pylibcudf/pylibcudf/tests/test_column_from_device.py index 0e129fdf0ef..30f28eb9e05 100644 --- a/python/pylibcudf/pylibcudf/tests/test_column_from_device.py +++ b/python/pylibcudf/pylibcudf/tests/test_column_from_device.py @@ -3,9 +3,8 @@ import pyarrow as pa import pylibcudf as plc import pytest -from utils import assert_column_eq - import rmm +from utils import assert_column_eq VALID_TYPES = [ pa.int8(), diff --git a/python/pylibcudf/pylibcudf/tests/test_null_mask.py b/python/pylibcudf/pylibcudf/tests/test_null_mask.py index 3edcae59edc..0f03a296af8 100644 --- a/python/pylibcudf/pylibcudf/tests/test_null_mask.py +++ b/python/pylibcudf/pylibcudf/tests/test_null_mask.py @@ -3,9 +3,8 @@ import pyarrow as pa import pylibcudf as plc import pytest -from pylibcudf.null_mask import MaskState - import rmm +from pylibcudf.null_mask import MaskState @pytest.fixture(params=[False, True])