From fa28aa0a0eb159fc1bed2bfc7060ffc676233886 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Fri, 28 Oct 2022 02:44:50 -0500 Subject: [PATCH 1/3] Add pre-commit configuration for cython-lint. --- .pre-commit-config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b4e57947cf9..06a69719517 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,10 @@ repos: types: [file] types_or: [python, cython] additional_dependencies: ["flake8-force"] + - repo: https://github.com/MarcoGorelli/cython-lint + rev: v0.1.10 + hooks: + - id: cython-lint - repo: https://github.com/pre-commit/mirrors-mypy rev: 'v0.971' hooks: From fc532e7c3cd4aeaecc32889ce981e5064d92ac5b Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Fri, 28 Oct 2022 03:10:18 -0500 Subject: [PATCH 2/3] Apply cython-lint. --- python/cudf/cudf/_lib/aggregation.pyx | 4 ---- python/cudf/cudf/_lib/binaryop.pyx | 3 --- python/cudf/cudf/_lib/column.pyx | 16 +--------------- python/cudf/cudf/_lib/copying.pyx | 5 +---- python/cudf/cudf/_lib/csv.pyx | 7 ++----- python/cudf/cudf/_lib/expressions.pyx | 1 - python/cudf/cudf/_lib/filling.pyx | 5 ----- python/cudf/cudf/_lib/groupby.pyx | 11 ----------- python/cudf/cudf/_lib/hash.pyx | 2 -- python/cudf/cudf/_lib/interop.pyx | 5 ----- python/cudf/cudf/_lib/io/utils.pyx | 4 ---- python/cudf/cudf/_lib/join.pyx | 7 ------- python/cudf/cudf/_lib/json.pyx | 4 +--- python/cudf/cudf/_lib/labeling.pyx | 7 ------- python/cudf/cudf/_lib/lists.pyx | 7 ------- python/cudf/cudf/_lib/merge.pyx | 1 - python/cudf/cudf/_lib/nvtext/edit_distance.pyx | 1 - .../cudf/cudf/_lib/nvtext/subword_tokenize.pyx | 3 +-- python/cudf/cudf/_lib/nvtext/tokenize.pyx | 1 - python/cudf/cudf/_lib/orc.pyx | 6 ------ python/cudf/cudf/_lib/parquet.pyx | 11 ++--------- python/cudf/cudf/_lib/partitioning.pyx | 1 - python/cudf/cudf/_lib/quantiles.pyx | 2 -- python/cudf/cudf/_lib/reduce.pyx | 10 +--------- python/cudf/cudf/_lib/reshape.pyx | 1 - python/cudf/cudf/_lib/rolling.pyx | 4 ---- python/cudf/cudf/_lib/scalar.pyx | 2 -- python/cudf/cudf/_lib/sort.pyx | 7 +------ python/cudf/cudf/_lib/stream_compaction.pyx | 4 ---- python/cudf/cudf/_lib/string_casting.pyx | 6 ------ python/cudf/cudf/_lib/strings/combine.pyx | 2 -- .../_lib/strings/convert/convert_fixed_point.pyx | 7 ------- .../cudf/_lib/strings/convert/convert_floats.pyx | 1 - .../_lib/strings/convert/convert_integers.pyx | 1 - python/cudf/cudf/_lib/strings/extract.pyx | 2 -- python/cudf/cudf/_lib/strings/findall.pyx | 1 - python/cudf/cudf/_lib/strings/json.pyx | 2 -- python/cudf/cudf/_lib/strings/padding.pyx | 2 -- python/cudf/cudf/_lib/strings/replace.pyx | 1 - .../cudf/cudf/_lib/strings/split/partition.pyx | 4 ---- python/cudf/cudf/_lib/strings/split/split.pyx | 1 - python/cudf/cudf/_lib/strings/strip.pyx | 2 -- python/cudf/cudf/_lib/text.pyx | 5 +---- python/cudf/cudf/_lib/transform.pyx | 4 ---- python/cudf/cudf/_lib/types.pyx | 1 - python/cudf/cudf/_lib/unary.pyx | 15 +++------------ python/cudf/cudf/_lib/utils.pyx | 1 - .../strings_udf/_lib/cudf_jit_udf.pyx | 2 +- 48 files changed, 15 insertions(+), 187 deletions(-) diff --git a/python/cudf/cudf/_lib/aggregation.pyx b/python/cudf/cudf/_lib/aggregation.pyx index 84dd9c3a576..86febf9727f 100644 --- a/python/cudf/cudf/_lib/aggregation.pyx +++ b/python/cudf/cudf/_lib/aggregation.pyx @@ -2,17 +2,13 @@ from enum import Enum, IntEnum -import numba -import numpy as np import pandas as pd -from libcpp.memory cimport unique_ptr from libcpp.string cimport string from libcpp.utility cimport move from libcpp.vector cimport vector from cudf._lib.types import ( - LIBCUDF_TO_SUPPORTED_NUMPY_TYPES, SUPPORTED_NUMPY_TO_LIBCUDF_TYPES, NullHandling, ) diff --git a/python/cudf/cudf/_lib/binaryop.pyx b/python/cudf/cudf/_lib/binaryop.pyx index 8728437541d..995fdc7e315 100644 --- a/python/cudf/cudf/_lib/binaryop.pyx +++ b/python/cudf/cudf/_lib/binaryop.pyx @@ -2,8 +2,6 @@ from enum import IntEnum -import numpy as np - from libcpp.memory cimport unique_ptr from libcpp.string cimport string from libcpp.utility cimport move @@ -11,7 +9,6 @@ from libcpp.utility cimport move from cudf._lib.binaryop cimport underlying_type_t_binary_operator from cudf._lib.column cimport Column -from cudf._lib.replace import replace_nulls from cudf._lib.scalar import as_device_scalar from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/column.pyx b/python/cudf/cudf/_lib/column.pyx index 78125c027dd..3385e97f9d9 100644 --- a/python/cudf/cudf/_lib/column.pyx +++ b/python/cudf/cudf/_lib/column.pyx @@ -2,38 +2,25 @@ import cupy as cp import numpy as np -import pandas as pd import rmm import cudf import cudf._lib as libcudf -from cudf.api.types import is_categorical_dtype, is_list_dtype, is_struct_dtype +from cudf.api.types import is_categorical_dtype from cudf.core.buffer import Buffer, DeviceBufferLike, as_device_buffer_like from cpython.buffer cimport PyObject_CheckBuffer from libc.stdint cimport uintptr_t -from libcpp cimport bool from libcpp.memory cimport make_unique, unique_ptr -from libcpp.pair cimport pair from libcpp.utility cimport move from libcpp.vector cimport vector from rmm._lib.device_buffer cimport DeviceBuffer -from cudf._lib.cpp.strings.convert.convert_integers cimport ( - from_integers as cpp_from_integers, -) - -from cudf._lib.types import ( - LIBCUDF_TO_SUPPORTED_NUMPY_TYPES, - SUPPORTED_NUMPY_TO_LIBCUDF_TYPES, -) - from cudf._lib.types cimport ( dtype_from_column_view, dtype_to_data_type, - underlying_type_t_type_id, ) from cudf._lib.null_mask import bitmask_allocation_size_bytes @@ -46,7 +33,6 @@ from cudf._lib.cpp.column.column_factories cimport ( make_numeric_column, ) from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/copying.pyx b/python/cudf/cudf/_lib/copying.pyx index a9cfbbbe223..26ec2fbcdfc 100644 --- a/python/cudf/cudf/_lib/copying.pyx +++ b/python/cudf/cudf/_lib/copying.pyx @@ -3,9 +3,7 @@ import pickle import warnings -import pandas as pd - -from libc.stdint cimport int32_t, int64_t, uint8_t, uintptr_t +from libc.stdint cimport int32_t, uint8_t, uintptr_t from libcpp cimport bool from libcpp.memory cimport make_shared, make_unique, shared_ptr, unique_ptr from libcpp.utility cimport move @@ -42,7 +40,6 @@ from cudf._lib.utils cimport ( columns_from_table_view, columns_from_unique_ptr, data_from_table_view, - data_from_unique_ptr, table_view_from_columns, ) diff --git a/python/cudf/cudf/_lib/csv.pyx b/python/cudf/cudf/_lib/csv.pyx index f1a75baa951..52b9ab9efc0 100644 --- a/python/cudf/cudf/_lib/csv.pyx +++ b/python/cudf/cudf/_lib/csv.pyx @@ -2,13 +2,13 @@ from libcpp cimport bool from libcpp.map cimport map -from libcpp.memory cimport make_unique, unique_ptr +from libcpp.memory cimport unique_ptr from libcpp.string cimport string from libcpp.utility cimport move from libcpp.vector cimport vector cimport cudf._lib.cpp.types as libcudf_types -from cudf._lib.cpp.types cimport data_type, type_id +from cudf._lib.cpp.types cimport data_type from cudf._lib.io.datasource cimport Datasource, NativeFileDatasource from cudf._lib.types cimport dtype_to_data_type @@ -47,7 +47,6 @@ from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.io.utils cimport make_sink_info, make_source_info from cudf._lib.utils cimport ( data_from_unique_ptr, - table_view_from_columns, table_view_from_table, ) @@ -121,8 +120,6 @@ cdef csv_reader_options make_csv_reader_options( ) except *: cdef source_info c_source_info = make_source_info([datasource]) cdef compression_type c_compression - cdef size_type c_header - cdef string c_prefix cdef vector[string] c_names cdef size_t c_byte_range_offset = ( byte_range[0] if byte_range is not None else 0 diff --git a/python/cudf/cudf/_lib/expressions.pyx b/python/cudf/cudf/_lib/expressions.pyx index f069bcdbe73..269318240b2 100644 --- a/python/cudf/cudf/_lib/expressions.pyx +++ b/python/cudf/cudf/_lib/expressions.pyx @@ -5,7 +5,6 @@ from enum import Enum from cython.operator cimport dereference from libc.stdint cimport int64_t from libcpp.memory cimport make_unique, unique_ptr -from libcpp.utility cimport move from cudf._lib.cpp cimport expressions as libcudf_exp from cudf._lib.cpp.types cimport size_type diff --git a/python/cudf/cudf/_lib/filling.pyx b/python/cudf/cudf/_lib/filling.pyx index 592d56158a1..7644cfee190 100644 --- a/python/cudf/cudf/_lib/filling.pyx +++ b/python/cudf/cudf/_lib/filling.pyx @@ -1,8 +1,5 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -import numpy as np - -from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move @@ -17,7 +14,6 @@ from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar from cudf._lib.utils cimport ( columns_from_unique_ptr, - data_from_unique_ptr, table_view_from_columns, ) @@ -64,7 +60,6 @@ def repeat(list inp, object count): def _repeat_via_column(list inp, Column count): cdef table_view c_inp = table_view_from_columns(inp) cdef column_view c_count = count.view() - cdef bool c_check_count = False cdef unique_ptr[table] c_result with nogil: diff --git a/python/cudf/cudf/_lib/groupby.pyx b/python/cudf/cudf/_lib/groupby.pyx index 08a1d74f80f..6f32494033a 100644 --- a/python/cudf/cudf/_lib/groupby.pyx +++ b/python/cudf/cudf/_lib/groupby.pyx @@ -1,12 +1,7 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -from collections import defaultdict - -import numpy as np from pandas.core.groupby.groupby import DataError -import rmm - from cudf.api.types import ( is_categorical_dtype, is_decimal_dtype, @@ -22,15 +17,11 @@ from libcpp.pair cimport pair from libcpp.utility cimport move from libcpp.vector cimport vector -import cudf - from cudf._lib.column cimport Column from cudf._lib.scalar cimport DeviceScalar from cudf._lib.utils cimport ( columns_from_unique_ptr, - data_from_unique_ptr, table_view_from_columns, - table_view_from_table, ) from cudf._lib.scalar import as_device_scalar @@ -44,13 +35,11 @@ from cudf._lib.aggregation cimport ( make_groupby_scan_aggregation, ) from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.libcpp.functional cimport reference_wrapper from cudf._lib.cpp.replace cimport replace_policy from cudf._lib.cpp.scalar.scalar cimport scalar from cudf._lib.cpp.table.table cimport table, table_view from cudf._lib.cpp.types cimport size_type -from cudf._lib.cpp.utilities.host_span cimport host_span # The sets below define the possible aggregations that can be performed on # different dtypes. These strings must be elements of the AggregationKind enum. diff --git a/python/cudf/cudf/_lib/hash.pyx b/python/cudf/cudf/_lib/hash.pyx index 1eba3a2f6b5..03033cd1a7e 100644 --- a/python/cudf/cudf/_lib/hash.pyx +++ b/python/cudf/cudf/_lib/hash.pyx @@ -1,7 +1,5 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -from libc.stdint cimport uint32_t -from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.pair cimport pair from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/interop.pyx b/python/cudf/cudf/_lib/interop.pyx index ee5ce165f95..92840561563 100644 --- a/python/cudf/cudf/_lib/interop.pyx +++ b/python/cudf/cudf/_lib/interop.pyx @@ -1,11 +1,7 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -import cudf - from cpython cimport pycapsule -from libcpp cimport bool from libcpp.memory cimport shared_ptr, unique_ptr -from libcpp.string cimport string from libcpp.utility cimport move from libcpp.vector cimport vector from pyarrow.lib cimport CTable, pyarrow_unwrap_table, pyarrow_wrap_table @@ -18,7 +14,6 @@ from cudf._lib.cpp.interop cimport ( to_arrow as cpp_to_arrow, to_dlpack as cpp_to_dlpack, ) -from cudf._lib.cpp.io.types cimport column_in_metadata from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.utils cimport columns_from_unique_ptr, table_view_from_columns diff --git a/python/cudf/cudf/_lib/io/utils.pyx b/python/cudf/cudf/_lib/io/utils.pyx index 21939ff39b6..7dbe395be79 100644 --- a/python/cudf/cudf/_lib/io/utils.pyx +++ b/python/cudf/cudf/_lib/io/utils.pyx @@ -2,9 +2,7 @@ from cpython.buffer cimport PyBUF_READ from cpython.memoryview cimport PyMemoryView_FromMemory -from libcpp.map cimport map from libcpp.memory cimport unique_ptr -from libcpp.pair cimport pair from libcpp.string cimport string from libcpp.utility cimport move from libcpp.vector cimport vector @@ -15,7 +13,6 @@ from cudf._lib.cpp.io.types cimport ( data_sink, datasource, host_buffer, - io_type, sink_info, source_info, ) @@ -26,7 +23,6 @@ import errno import io import os -import cudf from cudf.api.types import is_struct_dtype diff --git a/python/cudf/cudf/_lib/join.pyx b/python/cudf/cudf/_lib/join.pyx index 1baef266dab..ff5f6e1afcc 100644 --- a/python/cudf/cudf/_lib/join.pyx +++ b/python/cudf/cudf/_lib/join.pyx @@ -1,19 +1,12 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -from itertools import chain - -import cudf - -from libcpp cimport bool from libcpp.memory cimport make_unique, unique_ptr from libcpp.pair cimport pair from libcpp.utility cimport move -from libcpp.vector cimport vector cimport cudf._lib.cpp.join as cpp_join from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport data_type, size_type, type_id from cudf._lib.utils cimport table_view_from_columns diff --git a/python/cudf/cudf/_lib/json.pyx b/python/cudf/cudf/_lib/json.pyx index 5efe40ed2e9..533329bd856 100644 --- a/python/cudf/cudf/_lib/json.pyx +++ b/python/cudf/cudf/_lib/json.pyx @@ -2,7 +2,6 @@ # cython: boundscheck = False - import io import os from collections import abc @@ -16,13 +15,12 @@ from libcpp.utility cimport move from libcpp.vector cimport vector cimport cudf._lib.cpp.io.types as cudf_io_types -cimport cudf._lib.cpp.types as libcudf_types from cudf._lib.cpp.io.json cimport ( json_reader_options, read_json as libcudf_read_json, schema_element, ) -from cudf._lib.cpp.types cimport data_type, size_type, type_id +from cudf._lib.cpp.types cimport data_type, size_type from cudf._lib.io.utils cimport make_source_info, update_struct_field_names from cudf._lib.types cimport dtype_to_data_type from cudf._lib.utils cimport data_from_unique_ptr diff --git a/python/cudf/cudf/_lib/labeling.pyx b/python/cudf/cudf/_lib/labeling.pyx index 088942064a8..c458cc09851 100644 --- a/python/cudf/cudf/_lib/labeling.pyx +++ b/python/cudf/cudf/_lib/labeling.pyx @@ -1,18 +1,11 @@ # Copyright (c) 2021, NVIDIA CORPORATION. -from enum import IntEnum - -import numpy as np - -from libc.stdint cimport uint32_t from libcpp cimport bool as cbool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move from cudf._lib.column cimport Column -from cudf._lib.replace import replace_nulls - from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.labeling cimport inclusive, label_bins as cpp_label_bins diff --git a/python/cudf/cudf/_lib/lists.pyx b/python/cudf/cudf/_lib/lists.pyx index 581207c97a5..03723fe8a32 100644 --- a/python/cudf/cudf/_lib/lists.pyx +++ b/python/cudf/cudf/_lib/lists.pyx @@ -26,17 +26,10 @@ from cudf._lib.cpp.types cimport ( nan_equality, null_equality, null_order, - null_policy, order, size_type, ) from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.types cimport ( - underlying_type_t_null_order, - underlying_type_t_order, -) - -from cudf.core.dtypes import ListDtype from cudf._lib.cpp.lists.contains cimport contains, index_of as cpp_index_of from cudf._lib.cpp.lists.extract cimport extract_list_element diff --git a/python/cudf/cudf/_lib/merge.pyx b/python/cudf/cudf/_lib/merge.pyx index dae2c466266..935d8c69adc 100644 --- a/python/cudf/cudf/_lib/merge.pyx +++ b/python/cudf/cudf/_lib/merge.pyx @@ -6,7 +6,6 @@ from libcpp.utility cimport move from libcpp.vector cimport vector cimport cudf._lib.cpp.types as libcudf_types -from cudf._lib.column cimport Column from cudf._lib.cpp.merge cimport merge as cpp_merge from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view diff --git a/python/cudf/cudf/_lib/nvtext/edit_distance.pyx b/python/cudf/cudf/_lib/nvtext/edit_distance.pyx index f1e15570e9f..8578d3b0ef7 100644 --- a/python/cudf/cudf/_lib/nvtext/edit_distance.pyx +++ b/python/cudf/cudf/_lib/nvtext/edit_distance.pyx @@ -1,6 +1,5 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx b/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx index 426744ee46c..15dbc63dcd1 100644 --- a/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx +++ b/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx @@ -1,13 +1,12 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -from libc.stdint cimport uint32_t, uintptr_t +from libc.stdint cimport uint32_t from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.string cimport string from libcpp.utility cimport move from cudf._lib.column cimport Column -from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.nvtext.subword_tokenize cimport ( hashed_vocabulary as cpp_hashed_vocabulary, diff --git a/python/cudf/cudf/_lib/nvtext/tokenize.pyx b/python/cudf/cudf/_lib/nvtext/tokenize.pyx index 5fc852c2ab0..aeafc3bd59b 100644 --- a/python/cudf/cudf/_lib/nvtext/tokenize.pyx +++ b/python/cudf/cudf/_lib/nvtext/tokenize.pyx @@ -13,7 +13,6 @@ from cudf._lib.cpp.nvtext.tokenize cimport ( tokenize as cpp_tokenize, ) from cudf._lib.cpp.scalar.scalar cimport string_scalar -from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/orc.pyx b/python/cudf/cudf/_lib/orc.pyx index be7b29da515..894c9dba19c 100644 --- a/python/cudf/cudf/_lib/orc.pyx +++ b/python/cudf/cudf/_lib/orc.pyx @@ -19,7 +19,6 @@ except ImportError: cimport cudf._lib.cpp.io.types as cudf_io_types from cudf._lib.column cimport Column -from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.io.orc cimport ( chunked_orc_writer_options, orc_chunked_writer, @@ -34,7 +33,6 @@ from cudf._lib.cpp.io.orc_metadata cimport ( ) from cudf._lib.cpp.io.types cimport ( column_in_metadata, - column_name_info, compression_type, data_sink, sink_info, @@ -49,18 +47,14 @@ from cudf._lib.io.utils cimport ( make_sink_info, make_source_info, update_column_struct_field_names, - update_struct_field_names, ) from cudf._lib.types import SUPPORTED_NUMPY_TO_LIBCUDF_TYPES from cudf._lib.types cimport underlying_type_t_type_id -import numpy as np - from cudf._lib.utils cimport ( data_from_unique_ptr, - get_column_names, table_view_from_table, ) diff --git a/python/cudf/cudf/_lib/parquet.pyx b/python/cudf/cudf/_lib/parquet.pyx index 891f259a828..6de84ce90c3 100644 --- a/python/cudf/cudf/_lib/parquet.pyx +++ b/python/cudf/cudf/_lib/parquet.pyx @@ -2,9 +2,7 @@ # cython: boundscheck = False -import errno import io -import os import pyarrow as pa @@ -20,20 +18,17 @@ import numpy as np from cython.operator cimport dereference from cudf.api.types import ( - is_categorical_dtype, is_decimal_dtype, is_list_dtype, is_list_like, is_struct_dtype, ) -from cudf.utils.dtypes import np_to_pa_dtype -from cudf._lib.utils cimport data_from_unique_ptr, get_column_names +from cudf._lib.utils cimport data_from_unique_ptr from cudf._lib.utils import _index_level_name, generate_pandas_metadata from libc.stdint cimport uint8_t -from libc.stdlib cimport free from libcpp cimport bool from libcpp.map cimport map from libcpp.memory cimport make_unique, unique_ptr @@ -47,7 +42,6 @@ cimport cudf._lib.cpp.types as cudf_types from cudf._lib.column cimport Column from cudf._lib.cpp.io.parquet cimport ( chunked_parquet_writer_options, - chunked_parquet_writer_options_builder, merge_row_group_metadata as parquet_merge_metadata, parquet_chunked_writer as cpp_parquet_chunked_writer, parquet_reader_options, @@ -59,9 +53,8 @@ from cudf._lib.cpp.io.types cimport column_in_metadata, table_input_metadata from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport data_type, size_type -from cudf._lib.io.datasource cimport Datasource, NativeFileDatasource +from cudf._lib.io.datasource cimport NativeFileDatasource from cudf._lib.io.utils cimport ( - make_sink_info, make_sinks_info, make_source_info, update_struct_field_names, diff --git a/python/cudf/cudf/_lib/partitioning.pyx b/python/cudf/cudf/_lib/partitioning.pyx index f2f5a92aca1..233551c5134 100644 --- a/python/cudf/cudf/_lib/partitioning.pyx +++ b/python/cudf/cudf/_lib/partitioning.pyx @@ -1,6 +1,5 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.pair cimport pair from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/quantiles.pyx b/python/cudf/cudf/_lib/quantiles.pyx index f65c29a55a8..49587478215 100644 --- a/python/cudf/cudf/_lib/quantiles.pyx +++ b/python/cudf/cudf/_lib/quantiles.pyx @@ -6,7 +6,6 @@ from libcpp.utility cimport move from libcpp.vector cimport vector from cudf._lib.column cimport Column -from cudf._lib.scalar cimport DeviceScalar from cudf._lib.types cimport ( underlying_type_t_interpolation, underlying_type_t_null_order, @@ -28,7 +27,6 @@ from cudf._lib.cpp.types cimport ( interpolation, null_order, order, - order_info, sorted, ) from cudf._lib.utils cimport columns_from_unique_ptr, table_view_from_columns diff --git a/python/cudf/cudf/_lib/reduce.pyx b/python/cudf/cudf/_lib/reduce.pyx index ec338eeee70..8496a5b03e7 100644 --- a/python/cudf/cudf/_lib/reduce.pyx +++ b/python/cudf/cudf/_lib/reduce.pyx @@ -3,18 +3,15 @@ from cython.operator import dereference import cudf -from cudf.api.types import is_decimal_dtype from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.reduce cimport cpp_minmax, cpp_reduce, cpp_scan, scan_type from cudf._lib.cpp.scalar.scalar cimport scalar -from cudf._lib.cpp.types cimport data_type, type_id +from cudf._lib.cpp.types cimport data_type from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.types import SUPPORTED_NUMPY_TO_LIBCUDF_TYPES - from libcpp.memory cimport unique_ptr from libcpp.utility cimport move, pair @@ -27,13 +24,8 @@ from cudf._lib.aggregation cimport ( from cudf._lib.types cimport ( dtype_to_data_type, is_decimal_type_id, - underlying_type_t_type_id, ) -import numpy as np - -cimport cudf._lib.cpp.types as libcudf_types - def reduce(reduction_op, Column incol, dtype=None, **kwargs): """ diff --git a/python/cudf/cudf/_lib/reshape.pyx b/python/cudf/cudf/_lib/reshape.pyx index 29223947eea..84bad039199 100644 --- a/python/cudf/cudf/_lib/reshape.pyx +++ b/python/cudf/cudf/_lib/reshape.pyx @@ -5,7 +5,6 @@ from libcpp.utility cimport move from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.reshape cimport ( interleave_columns as cpp_interleave_columns, tile as cpp_tile, diff --git a/python/cudf/cudf/_lib/rolling.pyx b/python/cudf/cudf/_lib/rolling.pyx index d12b096bc08..7b0da6957a0 100644 --- a/python/cudf/cudf/_lib/rolling.pyx +++ b/python/cudf/cudf/_lib/rolling.pyx @@ -1,9 +1,5 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -import pandas as pd - -import cudf - from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/scalar.pyx b/python/cudf/cudf/_lib/scalar.pyx index 9b422b77eeb..3d781ea89f8 100644 --- a/python/cudf/cudf/_lib/scalar.pyx +++ b/python/cudf/cudf/_lib/scalar.pyx @@ -71,9 +71,7 @@ from cudf._lib.cpp.wrappers.timestamps cimport ( ) from cudf._lib.utils cimport ( columns_from_table_view, - data_from_table_view, table_view_from_columns, - table_view_from_table, ) diff --git a/python/cudf/cudf/_lib/sort.pyx b/python/cudf/cudf/_lib/sort.pyx index 8074c7c5d3a..eb3aed80700 100644 --- a/python/cudf/cudf/_lib/sort.pyx +++ b/python/cudf/cudf/_lib/sort.pyx @@ -5,8 +5,6 @@ from libcpp.memory cimport unique_ptr from libcpp.utility cimport move from libcpp.vector cimport vector -from enum import IntEnum - from cudf._lib.column cimport Column from cudf._lib.cpp.aggregation cimport ( rank_method, @@ -20,10 +18,9 @@ from cudf._lib.cpp.sorting cimport ( rank, sorted_order, ) -from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport null_order, null_policy, order -from cudf._lib.utils cimport columns_from_unique_ptr, table_view_from_columns +from cudf._lib.utils cimport table_view_from_columns def is_sorted( @@ -198,8 +195,6 @@ def rank_columns(list source_columns, object method, str na_option, """ Compute numerical data ranks (1 through n) of each column in the dataframe """ - cdef table_view source_table_view = table_view_from_columns(source_columns) - cdef rank_method c_rank_method = < rank_method > ( < underlying_type_t_rank_method > method ) diff --git a/python/cudf/cudf/_lib/stream_compaction.pyx b/python/cudf/cudf/_lib/stream_compaction.pyx index b645fcd59d0..268cb773a1d 100644 --- a/python/cudf/cudf/_lib/stream_compaction.pyx +++ b/python/cudf/cudf/_lib/stream_compaction.pyx @@ -1,7 +1,5 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -import pandas as pd - from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move @@ -29,9 +27,7 @@ from cudf._lib.cpp.types cimport ( ) from cudf._lib.utils cimport ( columns_from_unique_ptr, - data_from_unique_ptr, table_view_from_columns, - table_view_from_table, ) diff --git a/python/cudf/cudf/_lib/string_casting.pyx b/python/cudf/cudf/_lib/string_casting.pyx index f9e98efbbd9..092d1d64353 100644 --- a/python/cudf/cudf/_lib/string_casting.pyx +++ b/python/cudf/cudf/_lib/string_casting.pyx @@ -1,7 +1,5 @@ # Copyright (c) 2020, NVIDIA CORPORATION. -import numpy as np - from cudf._lib.column cimport Column from cudf._lib.scalar import as_device_scalar @@ -46,10 +44,6 @@ from cudf._lib.cpp.strings.convert.convert_ipv4 cimport ( ipv4_to_integers as cpp_ipv4_to_integers, is_ipv4 as cpp_is_ipv4, ) -from cudf._lib.cpp.strings.convert.convert_urls cimport ( - url_decode as cpp_url_decode, - url_encode as cpp_url_encode, -) from cudf._lib.cpp.types cimport data_type, type_id from cudf._lib.types cimport underlying_type_t_type_id diff --git a/python/cudf/cudf/_lib/strings/combine.pyx b/python/cudf/cudf/_lib/strings/combine.pyx index eeb39f70728..141732b4c75 100644 --- a/python/cudf/cudf/_lib/strings/combine.pyx +++ b/python/cudf/cudf/_lib/strings/combine.pyx @@ -1,7 +1,6 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr -from libcpp.string cimport string from libcpp.utility cimport move from cudf._lib.column cimport Column @@ -16,7 +15,6 @@ from cudf._lib.cpp.strings.combine cimport ( separator_on_nulls as separator_on_nulls, ) from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar from cudf._lib.utils cimport table_view_from_columns diff --git a/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx b/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx index dfc9cae915f..8f313539313 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx @@ -1,15 +1,10 @@ # Copyright (c) 2021-2022, NVIDIA CORPORATION. -import numpy as np - import cudf from cudf._lib.column cimport Column -from cudf._lib.types import SUPPORTED_NUMPY_TO_LIBCUDF_TYPES - from libcpp.memory cimport unique_ptr -from libcpp.string cimport string from libcpp.utility cimport move from cudf._lib.cpp.column.column cimport column @@ -24,9 +19,7 @@ from cudf._lib.cpp.types cimport ( DECIMAL64, DECIMAL128, data_type, - type_id, ) -from cudf._lib.types cimport underlying_type_t_type_id def from_decimal(Column input_col): diff --git a/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx b/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx index d47b1e6e651..87b5a6f6f51 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx @@ -1,6 +1,5 @@ # Copyright (c) 2021, NVIDIA CORPORATION. -from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx b/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx index 08bcca93086..cda1855f0ed 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx @@ -1,6 +1,5 @@ # Copyright (c) 2021, NVIDIA CORPORATION. -from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/strings/extract.pyx b/python/cudf/cudf/_lib/strings/extract.pyx index bac282dccc5..439c1546381 100644 --- a/python/cudf/cudf/_lib/strings/extract.pyx +++ b/python/cudf/cudf/_lib/strings/extract.pyx @@ -6,12 +6,10 @@ from libcpp.string cimport string from libcpp.utility cimport move from cudf._lib.column cimport Column -from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.extract cimport extract as cpp_extract from cudf._lib.cpp.strings.regex_flags cimport regex_flags from cudf._lib.cpp.table.table cimport table -from cudf._lib.scalar cimport DeviceScalar from cudf._lib.utils cimport data_from_unique_ptr diff --git a/python/cudf/cudf/_lib/strings/findall.pyx b/python/cudf/cudf/_lib/strings/findall.pyx index bb4159ba309..be34ce1fb18 100644 --- a/python/cudf/cudf/_lib/strings/findall.pyx +++ b/python/cudf/cudf/_lib/strings/findall.pyx @@ -10,7 +10,6 @@ from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.findall cimport findall as cpp_findall from cudf._lib.cpp.strings.regex_flags cimport regex_flags -from cudf._lib.utils cimport data_from_unique_ptr def findall(Column source_strings, object pattern, uint32_t flags): diff --git a/python/cudf/cudf/_lib/strings/json.pyx b/python/cudf/cudf/_lib/strings/json.pyx index 1b1a9717e44..9dbc932d842 100644 --- a/python/cudf/cudf/_lib/strings/json.pyx +++ b/python/cudf/cudf/_lib/strings/json.pyx @@ -1,6 +1,5 @@ # Copyright (c) 2021-2022, NVIDIA CORPORATION. -from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move @@ -12,7 +11,6 @@ from cudf._lib.cpp.strings.json cimport ( get_json_object as cpp_get_json_object, get_json_object_options, ) -from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/strings/padding.pyx b/python/cudf/cudf/_lib/strings/padding.pyx index 9377870c1c1..99270b340eb 100644 --- a/python/cudf/cudf/_lib/strings/padding.pyx +++ b/python/cudf/cudf/_lib/strings/padding.pyx @@ -5,9 +5,7 @@ from libcpp.utility cimport move from cudf._lib.column cimport Column from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.types cimport size_type -from cudf._lib.scalar cimport DeviceScalar from enum import IntEnum diff --git a/python/cudf/cudf/_lib/strings/replace.pyx b/python/cudf/cudf/_lib/strings/replace.pyx index f5c47d2a2ed..8dbf5f13fea 100644 --- a/python/cudf/cudf/_lib/strings/replace.pyx +++ b/python/cudf/cudf/_lib/strings/replace.pyx @@ -12,7 +12,6 @@ from cudf._lib.cpp.strings.replace cimport ( replace as cpp_replace, replace_slice as cpp_replace_slice, ) -from cudf._lib.cpp.strings.substring cimport slice_strings as cpp_slice_strings from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/strings/split/partition.pyx b/python/cudf/cudf/_lib/strings/split/partition.pyx index b145b9ee52d..cf61ea53a90 100644 --- a/python/cudf/cudf/_lib/strings/split/partition.pyx +++ b/python/cudf/cudf/_lib/strings/split/partition.pyx @@ -1,11 +1,9 @@ # Copyright (c) 2020, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr -from libcpp.string cimport string from libcpp.utility cimport move from cudf._lib.column cimport Column -from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.split.partition cimport ( @@ -13,8 +11,6 @@ from cudf._lib.cpp.strings.split.partition cimport ( rpartition as cpp_rpartition, ) from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar from cudf._lib.utils cimport data_from_unique_ptr diff --git a/python/cudf/cudf/_lib/strings/split/split.pyx b/python/cudf/cudf/_lib/strings/split/split.pyx index ce066aa6aec..e96c911e83a 100644 --- a/python/cudf/cudf/_lib/strings/split/split.pyx +++ b/python/cudf/cudf/_lib/strings/split/split.pyx @@ -19,7 +19,6 @@ from cudf._lib.cpp.strings.split.split cimport ( split_record_re as cpp_split_record_re, ) from cudf._lib.cpp.table.table cimport table -from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar from cudf._lib.utils cimport data_from_unique_ptr diff --git a/python/cudf/cudf/_lib/strings/strip.pyx b/python/cudf/cudf/_lib/strings/strip.pyx index 93dfbcedb83..da3efe33786 100644 --- a/python/cudf/cudf/_lib/strings/strip.pyx +++ b/python/cudf/cudf/_lib/strings/strip.pyx @@ -1,7 +1,6 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr -from libcpp.string cimport string from libcpp.utility cimport move from cudf._lib.column cimport Column @@ -10,7 +9,6 @@ from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.scalar.scalar cimport string_scalar from cudf._lib.cpp.strings.side_type cimport side_type from cudf._lib.cpp.strings.strip cimport strip as cpp_strip -from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar diff --git a/python/cudf/cudf/_lib/text.pyx b/python/cudf/cudf/_lib/text.pyx index be11132497e..a7346cdd586 100644 --- a/python/cudf/cudf/_lib/text.pyx +++ b/python/cudf/cudf/_lib/text.pyx @@ -2,11 +2,9 @@ from io import TextIOBase -import cudf - from cython.operator cimport dereference from libc.stdint cimport uint64_t -from libcpp.memory cimport make_unique, unique_ptr +from libcpp.memory cimport unique_ptr from libcpp.string cimport string from libcpp.utility cimport move @@ -43,7 +41,6 @@ def read_text(object filepaths_or_buffers, cdef size_t c_byte_range_offset cdef size_t c_byte_range_size - cdef byte_range_info c_byte_range cdef uint64_t c_compression_begin_offset cdef uint64_t c_compression_end_offset cdef parse_options c_options diff --git a/python/cudf/cudf/_lib/transform.pyx b/python/cudf/cudf/_lib/transform.pyx index 5fa45f68357..e1612855dae 100644 --- a/python/cudf/cudf/_lib/transform.pyx +++ b/python/cudf/cudf/_lib/transform.pyx @@ -1,6 +1,5 @@ # Copyright (c) 2020-2022, NVIDIA CORPORATION. -import numpy as np from numba.np import numpy_support import cudf @@ -31,9 +30,7 @@ from cudf._lib.types cimport underlying_type_t_type_id from cudf._lib.utils cimport ( columns_from_unique_ptr, data_from_table_view, - data_from_unique_ptr, table_view_from_columns, - table_view_from_table, ) @@ -45,7 +42,6 @@ def bools_to_mask(Column col): cdef column_view col_view = col.view() cdef pair[unique_ptr[device_buffer], size_type] cpp_out cdef unique_ptr[device_buffer] up_db - cdef size_type null_count with nogil: cpp_out = move(libcudf_transform.bools_to_mask(col_view)) diff --git a/python/cudf/cudf/_lib/types.pyx b/python/cudf/cudf/_lib/types.pyx index aa70ab99ebd..c306d398123 100644 --- a/python/cudf/cudf/_lib/types.pyx +++ b/python/cudf/cudf/_lib/types.pyx @@ -11,7 +11,6 @@ from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view from cudf._lib.types cimport ( underlying_type_t_interpolation, - underlying_type_t_null_order, underlying_type_t_order, underlying_type_t_sorted, ) diff --git a/python/cudf/cudf/_lib/unary.pyx b/python/cudf/cudf/_lib/unary.pyx index acca61cf9d1..0f30b070e93 100644 --- a/python/cudf/cudf/_lib/unary.pyx +++ b/python/cudf/cudf/_lib/unary.pyx @@ -4,7 +4,6 @@ from enum import IntEnum from cudf.api.types import is_decimal_dtype -from libcpp cimport bool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move @@ -12,21 +11,13 @@ import numpy as np from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport column_view, mutable_column_view +from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.types import SUPPORTED_NUMPY_TO_LIBCUDF_TYPES +from cudf._lib.cpp.types cimport data_type -from cudf._lib.cpp.types cimport data_type, size_type, type_id - -from cudf._lib.column import ( - LIBCUDF_TO_SUPPORTED_NUMPY_TYPES, - SUPPORTED_NUMPY_TO_LIBCUDF_TYPES, -) - -cimport cudf._lib.cpp.types as libcudf_types cimport cudf._lib.cpp.unary as libcudf_unary from cudf._lib.cpp.unary cimport unary_operator, underlying_type_t_unary_op -from cudf._lib.types cimport dtype_to_data_type, underlying_type_t_type_id +from cudf._lib.types cimport dtype_to_data_type class UnaryOp(IntEnum): diff --git a/python/cudf/cudf/_lib/utils.pyx b/python/cudf/cudf/_lib/utils.pyx index e0bdc7d8f74..989d12caca0 100644 --- a/python/cudf/cudf/_lib/utils.pyx +++ b/python/cudf/cudf/_lib/utils.pyx @@ -6,7 +6,6 @@ import pyarrow as pa import cudf from cython.operator cimport dereference -from libc.stdint cimport uint8_t from libcpp.memory cimport unique_ptr from libcpp.string cimport string from libcpp.utility cimport move diff --git a/python/strings_udf/strings_udf/_lib/cudf_jit_udf.pyx b/python/strings_udf/strings_udf/_lib/cudf_jit_udf.pyx index bb1892a4d26..7a0cdeb10b9 100644 --- a/python/strings_udf/strings_udf/_lib/cudf_jit_udf.pyx +++ b/python/strings_udf/strings_udf/_lib/cudf_jit_udf.pyx @@ -6,7 +6,7 @@ from libcpp.utility cimport move from cudf.core.buffer import Buffer from cudf._lib.column cimport Column -from cudf._lib.cpp.column.column cimport column, column_view +from cudf._lib.cpp.column.column cimport column_view from rmm._lib.device_buffer cimport DeviceBuffer, device_buffer from strings_udf._lib.cpp.strings_udf cimport ( From 92a5c0911d331e856fae606d9088f42d3b7cb040 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Fri, 28 Oct 2022 03:17:49 -0500 Subject: [PATCH 3/3] Apply style fixes. --- python/cudf/cudf/_lib/aggregation.pyx | 5 +---- python/cudf/cudf/_lib/column.pyx | 5 +---- python/cudf/cudf/_lib/csv.pyx | 5 +---- python/cudf/cudf/_lib/filling.pyx | 5 +---- python/cudf/cudf/_lib/groupby.pyx | 5 +---- python/cudf/cudf/_lib/labeling.pyx | 3 +-- python/cudf/cudf/_lib/lists.pyx | 5 ++--- .../cudf/cudf/_lib/nvtext/edit_distance.pyx | 2 +- .../cudf/_lib/nvtext/subword_tokenize.pyx | 2 +- python/cudf/cudf/_lib/nvtext/tokenize.pyx | 2 +- python/cudf/cudf/_lib/orc.pyx | 7 ++----- python/cudf/cudf/_lib/quantiles.pyx | 7 +------ python/cudf/cudf/_lib/reduce.pyx | 20 ++++++++----------- python/cudf/cudf/_lib/scalar.pyx | 5 +---- python/cudf/cudf/_lib/stream_compaction.pyx | 5 +---- python/cudf/cudf/_lib/string_casting.pyx | 2 +- .../strings/convert/convert_fixed_point.pyx | 10 ++-------- .../_lib/strings/convert/convert_floats.pyx | 2 +- .../_lib/strings/convert/convert_integers.pyx | 2 +- python/cudf/cudf/_lib/strings/replace.pyx | 2 +- .../cudf/_lib/strings/split/partition.pyx | 2 +- python/cudf/cudf/_lib/unary.pyx | 6 ++---- 22 files changed, 33 insertions(+), 76 deletions(-) diff --git a/python/cudf/cudf/_lib/aggregation.pyx b/python/cudf/cudf/_lib/aggregation.pyx index 86febf9727f..72c5e288f0b 100644 --- a/python/cudf/cudf/_lib/aggregation.pyx +++ b/python/cudf/cudf/_lib/aggregation.pyx @@ -8,10 +8,7 @@ from libcpp.string cimport string from libcpp.utility cimport move from libcpp.vector cimport vector -from cudf._lib.types import ( - SUPPORTED_NUMPY_TO_LIBCUDF_TYPES, - NullHandling, -) +from cudf._lib.types import SUPPORTED_NUMPY_TO_LIBCUDF_TYPES, NullHandling from cudf.utils import cudautils from cudf._lib.types cimport ( diff --git a/python/cudf/cudf/_lib/column.pyx b/python/cudf/cudf/_lib/column.pyx index 3385e97f9d9..1e7f0b175bc 100644 --- a/python/cudf/cudf/_lib/column.pyx +++ b/python/cudf/cudf/_lib/column.pyx @@ -18,10 +18,7 @@ from libcpp.vector cimport vector from rmm._lib.device_buffer cimport DeviceBuffer -from cudf._lib.types cimport ( - dtype_from_column_view, - dtype_to_data_type, -) +from cudf._lib.types cimport dtype_from_column_view, dtype_to_data_type from cudf._lib.null_mask import bitmask_allocation_size_bytes diff --git a/python/cudf/cudf/_lib/csv.pyx b/python/cudf/cudf/_lib/csv.pyx index 52b9ab9efc0..920d423adc5 100644 --- a/python/cudf/cudf/_lib/csv.pyx +++ b/python/cudf/cudf/_lib/csv.pyx @@ -45,10 +45,7 @@ from cudf._lib.cpp.io.types cimport ( ) from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.io.utils cimport make_sink_info, make_source_info -from cudf._lib.utils cimport ( - data_from_unique_ptr, - table_view_from_table, -) +from cudf._lib.utils cimport data_from_unique_ptr, table_view_from_table from pyarrow.lib import NativeFile diff --git a/python/cudf/cudf/_lib/filling.pyx b/python/cudf/cudf/_lib/filling.pyx index 7644cfee190..891da82821c 100644 --- a/python/cudf/cudf/_lib/filling.pyx +++ b/python/cudf/cudf/_lib/filling.pyx @@ -12,10 +12,7 @@ from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view from cudf._lib.cpp.types cimport size_type from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.utils cimport ( - columns_from_unique_ptr, - table_view_from_columns, -) +from cudf._lib.utils cimport columns_from_unique_ptr, table_view_from_columns def fill_in_place(Column destination, int begin, int end, DeviceScalar value): diff --git a/python/cudf/cudf/_lib/groupby.pyx b/python/cudf/cudf/_lib/groupby.pyx index 6f32494033a..e6fbefaeee9 100644 --- a/python/cudf/cudf/_lib/groupby.pyx +++ b/python/cudf/cudf/_lib/groupby.pyx @@ -19,10 +19,7 @@ from libcpp.vector cimport vector from cudf._lib.column cimport Column from cudf._lib.scalar cimport DeviceScalar -from cudf._lib.utils cimport ( - columns_from_unique_ptr, - table_view_from_columns, -) +from cudf._lib.utils cimport columns_from_unique_ptr, table_view_from_columns from cudf._lib.scalar import as_device_scalar diff --git a/python/cudf/cudf/_lib/labeling.pyx b/python/cudf/cudf/_lib/labeling.pyx index c458cc09851..ed5033c08a5 100644 --- a/python/cudf/cudf/_lib/labeling.pyx +++ b/python/cudf/cudf/_lib/labeling.pyx @@ -1,11 +1,10 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. +# Copyright (c) 2021-2022, NVIDIA CORPORATION. from libcpp cimport bool as cbool from libcpp.memory cimport unique_ptr from libcpp.utility cimport move from cudf._lib.column cimport Column - from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.labeling cimport inclusive, label_bins as cpp_label_bins diff --git a/python/cudf/cudf/_lib/lists.pyx b/python/cudf/cudf/_lib/lists.pyx index 03723fe8a32..8a7b4be3be9 100644 --- a/python/cudf/cudf/_lib/lists.pyx +++ b/python/cudf/cudf/_lib/lists.pyx @@ -12,10 +12,12 @@ from cudf._lib.cpp.lists.combine cimport ( concatenate_null_policy, concatenate_rows as cpp_concatenate_rows, ) +from cudf._lib.cpp.lists.contains cimport contains, index_of as cpp_index_of from cudf._lib.cpp.lists.count_elements cimport ( count_elements as cpp_count_elements, ) from cudf._lib.cpp.lists.explode cimport explode_outer as cpp_explode_outer +from cudf._lib.cpp.lists.extract cimport extract_list_element from cudf._lib.cpp.lists.lists_column_view cimport lists_column_view from cudf._lib.cpp.lists.sorting cimport sort_lists as cpp_sort_lists from cudf._lib.cpp.lists.stream_compaction cimport distinct as cpp_distinct @@ -30,9 +32,6 @@ from cudf._lib.cpp.types cimport ( size_type, ) from cudf._lib.scalar cimport DeviceScalar - -from cudf._lib.cpp.lists.contains cimport contains, index_of as cpp_index_of -from cudf._lib.cpp.lists.extract cimport extract_list_element from cudf._lib.utils cimport columns_from_unique_ptr, table_view_from_columns diff --git a/python/cudf/cudf/_lib/nvtext/edit_distance.pyx b/python/cudf/cudf/_lib/nvtext/edit_distance.pyx index 8578d3b0ef7..c8dc6edd6e2 100644 --- a/python/cudf/cudf/_lib/nvtext/edit_distance.pyx +++ b/python/cudf/cudf/_lib/nvtext/edit_distance.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. +# Copyright (c) 2020-2022, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx b/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx index 15dbc63dcd1..dd8bbd6d7b6 100644 --- a/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx +++ b/python/cudf/cudf/_lib/nvtext/subword_tokenize.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. +# Copyright (c) 2020-2022, NVIDIA CORPORATION. from libc.stdint cimport uint32_t from libcpp cimport bool diff --git a/python/cudf/cudf/_lib/nvtext/tokenize.pyx b/python/cudf/cudf/_lib/nvtext/tokenize.pyx index aeafc3bd59b..00f63b9cf7c 100644 --- a/python/cudf/cudf/_lib/nvtext/tokenize.pyx +++ b/python/cudf/cudf/_lib/nvtext/tokenize.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2018-2020, NVIDIA CORPORATION. +# Copyright (c) 2018-2022, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/orc.pyx b/python/cudf/cudf/_lib/orc.pyx index 894c9dba19c..f57e4e8f281 100644 --- a/python/cudf/cudf/_lib/orc.pyx +++ b/python/cudf/cudf/_lib/orc.pyx @@ -8,6 +8,7 @@ from libcpp.memory cimport make_unique, unique_ptr from libcpp.string cimport string from libcpp.utility cimport move from libcpp.vector cimport vector + from collections import OrderedDict cimport cudf._lib.cpp.lists.lists_column_view as cpp_lists_column_view @@ -52,11 +53,7 @@ from cudf._lib.io.utils cimport ( from cudf._lib.types import SUPPORTED_NUMPY_TO_LIBCUDF_TYPES from cudf._lib.types cimport underlying_type_t_type_id - -from cudf._lib.utils cimport ( - data_from_unique_ptr, - table_view_from_table, -) +from cudf._lib.utils cimport data_from_unique_ptr, table_view_from_table from pyarrow.lib import NativeFile diff --git a/python/cudf/cudf/_lib/quantiles.pyx b/python/cudf/cudf/_lib/quantiles.pyx index 49587478215..d0bc8d3f31a 100644 --- a/python/cudf/cudf/_lib/quantiles.pyx +++ b/python/cudf/cudf/_lib/quantiles.pyx @@ -23,12 +23,7 @@ from cudf._lib.cpp.quantiles cimport ( ) from cudf._lib.cpp.table.table cimport table from cudf._lib.cpp.table.table_view cimport table_view -from cudf._lib.cpp.types cimport ( - interpolation, - null_order, - order, - sorted, -) +from cudf._lib.cpp.types cimport interpolation, null_order, order, sorted from cudf._lib.utils cimport columns_from_unique_ptr, table_view_from_columns diff --git a/python/cudf/cudf/_lib/reduce.pyx b/python/cudf/cudf/_lib/reduce.pyx index 8496a5b03e7..e46d724ed9d 100644 --- a/python/cudf/cudf/_lib/reduce.pyx +++ b/python/cudf/cudf/_lib/reduce.pyx @@ -4,14 +4,6 @@ from cython.operator import dereference import cudf -from cudf._lib.column cimport Column -from cudf._lib.cpp.column.column cimport column -from cudf._lib.cpp.column.column_view cimport column_view -from cudf._lib.cpp.reduce cimport cpp_minmax, cpp_reduce, cpp_scan, scan_type -from cudf._lib.cpp.scalar.scalar cimport scalar -from cudf._lib.cpp.types cimport data_type -from cudf._lib.scalar cimport DeviceScalar - from libcpp.memory cimport unique_ptr from libcpp.utility cimport move, pair @@ -21,10 +13,14 @@ from cudf._lib.aggregation cimport ( make_reduce_aggregation, make_scan_aggregation, ) -from cudf._lib.types cimport ( - dtype_to_data_type, - is_decimal_type_id, -) +from cudf._lib.column cimport Column +from cudf._lib.cpp.column.column cimport column +from cudf._lib.cpp.column.column_view cimport column_view +from cudf._lib.cpp.reduce cimport cpp_minmax, cpp_reduce, cpp_scan, scan_type +from cudf._lib.cpp.scalar.scalar cimport scalar +from cudf._lib.cpp.types cimport data_type +from cudf._lib.scalar cimport DeviceScalar +from cudf._lib.types cimport dtype_to_data_type, is_decimal_type_id def reduce(reduction_op, Column incol, dtype=None, **kwargs): diff --git a/python/cudf/cudf/_lib/scalar.pyx b/python/cudf/cudf/_lib/scalar.pyx index 3d781ea89f8..af63964bac3 100644 --- a/python/cudf/cudf/_lib/scalar.pyx +++ b/python/cudf/cudf/_lib/scalar.pyx @@ -69,10 +69,7 @@ from cudf._lib.cpp.wrappers.timestamps cimport ( timestamp_s, timestamp_us, ) -from cudf._lib.utils cimport ( - columns_from_table_view, - table_view_from_columns, -) +from cudf._lib.utils cimport columns_from_table_view, table_view_from_columns # The DeviceMemoryResource attribute could be released prematurely diff --git a/python/cudf/cudf/_lib/stream_compaction.pyx b/python/cudf/cudf/_lib/stream_compaction.pyx index 268cb773a1d..38cead87e76 100644 --- a/python/cudf/cudf/_lib/stream_compaction.pyx +++ b/python/cudf/cudf/_lib/stream_compaction.pyx @@ -25,10 +25,7 @@ from cudf._lib.cpp.types cimport ( order, size_type, ) -from cudf._lib.utils cimport ( - columns_from_unique_ptr, - table_view_from_columns, -) +from cudf._lib.utils cimport columns_from_unique_ptr, table_view_from_columns def drop_nulls(list columns, how="any", keys=None, thresh=None): diff --git a/python/cudf/cudf/_lib/string_casting.pyx b/python/cudf/cudf/_lib/string_casting.pyx index 092d1d64353..3b29255e4b6 100644 --- a/python/cudf/cudf/_lib/string_casting.pyx +++ b/python/cudf/cudf/_lib/string_casting.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. +# Copyright (c) 2020-2022, NVIDIA CORPORATION. from cudf._lib.column cimport Column diff --git a/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx b/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx index 8f313539313..fc07cf6462a 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_fixed_point.pyx @@ -2,11 +2,10 @@ import cudf -from cudf._lib.column cimport Column - from libcpp.memory cimport unique_ptr from libcpp.utility cimport move +from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view from cudf._lib.cpp.strings.convert.convert_fixed_point cimport ( @@ -14,12 +13,7 @@ from cudf._lib.cpp.strings.convert.convert_fixed_point cimport ( is_fixed_point as cpp_is_fixed_point, to_fixed_point as cpp_to_fixed_point, ) -from cudf._lib.cpp.types cimport ( - DECIMAL32, - DECIMAL64, - DECIMAL128, - data_type, -) +from cudf._lib.cpp.types cimport DECIMAL32, DECIMAL64, DECIMAL128, data_type def from_decimal(Column input_col): diff --git a/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx b/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx index 87b5a6f6f51..f9d028c5eb5 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_floats.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. +# Copyright (c) 2021-2022, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx b/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx index cda1855f0ed..220cbd0f760 100644 --- a/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx +++ b/python/cudf/cudf/_lib/strings/convert/convert_integers.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. +# Copyright (c) 2021-2022, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/strings/replace.pyx b/python/cudf/cudf/_lib/strings/replace.pyx index 8dbf5f13fea..72d66d9a8e3 100644 --- a/python/cudf/cudf/_lib/strings/replace.pyx +++ b/python/cudf/cudf/_lib/strings/replace.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. +# Copyright (c) 2020-2022, NVIDIA CORPORATION. from libc.stdint cimport int32_t from libcpp.memory cimport unique_ptr diff --git a/python/cudf/cudf/_lib/strings/split/partition.pyx b/python/cudf/cudf/_lib/strings/split/partition.pyx index cf61ea53a90..b17ea4e608d 100644 --- a/python/cudf/cudf/_lib/strings/split/partition.pyx +++ b/python/cudf/cudf/_lib/strings/split/partition.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. +# Copyright (c) 2020-2022, NVIDIA CORPORATION. from libcpp.memory cimport unique_ptr from libcpp.utility cimport move diff --git a/python/cudf/cudf/_lib/unary.pyx b/python/cudf/cudf/_lib/unary.pyx index 0f30b070e93..52f0a804b2a 100644 --- a/python/cudf/cudf/_lib/unary.pyx +++ b/python/cudf/cudf/_lib/unary.pyx @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021, NVIDIA CORPORATION. +# Copyright (c) 2020-2022, NVIDIA CORPORATION. from enum import IntEnum @@ -9,13 +9,11 @@ from libcpp.utility cimport move import numpy as np +cimport cudf._lib.cpp.unary as libcudf_unary from cudf._lib.column cimport Column from cudf._lib.cpp.column.column cimport column from cudf._lib.cpp.column.column_view cimport column_view - from cudf._lib.cpp.types cimport data_type - -cimport cudf._lib.cpp.unary as libcudf_unary from cudf._lib.cpp.unary cimport unary_operator, underlying_type_t_unary_op from cudf._lib.types cimport dtype_to_data_type