Skip to content

Commit

Permalink
apply
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Sep 3, 2024
1 parent ece32bc commit 79eab86
Show file tree
Hide file tree
Showing 79 changed files with 152 additions and 156 deletions.
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -129,6 +129,7 @@ repos:
rev: v0.4.8
hooks:
- id: ruff
args: ["--fix"]
files: python/.*$
- id: ruff-format
files: python/.*$
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ ignore = [
"E203",
# line-too-long (due to Copyright header)
"E501",
# [*] Import block is un-sorted or un-formatted
"I001",
]
fixable = ["ALL"]
exclude = [
# TODO: Remove this in a follow-up where we fix __all__.
"__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"]
Expand Down
1 change: 0 additions & 1 deletion python/cudf/cudf/core/_internals/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import functools

import pyarrow as pa

import pylibcudf as plc
from pylibcudf.expressions import (
ASTOperator,
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/_internals/timezones.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/core/buffer/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/core/buffer/spillable_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions python/cudf/cudf/core/byte_pair_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
7 changes: 4 additions & 3 deletions python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 (
Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/core/column/numerical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/core/column/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/core/df_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/core/indexed_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion python/cudf/cudf/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions python/cudf/cudf/core/subword_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
2 changes: 2 additions & 0 deletions python/cudf/cudf/core/tokenize_vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
4 changes: 3 additions & 1 deletion python/cudf/cudf/core/udf/masked_lowering.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2023, NVIDIA CORPORATION.
# Copyright (c) 2021-2024, NVIDIA CORPORATION.

import operator

Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions python/cudf/cudf/core/udf/strings_lowering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/core/udf/strings_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/core/udf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
30 changes: 29 additions & 1 deletion python/cudf/cudf/pandas/_wrappers/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion python/cudf/cudf/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import cupy as cp
import numpy as np
import pytest

import rmm # noqa: F401

import cudf
Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/tests/indexes/datetime/test_indexing.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/tests/series/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/tests/test_binops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions python/cudf/cudf/tests/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/tests/test_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading

0 comments on commit 79eab86

Please sign in to comment.