Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump isort, enable Cython package resorting #419

Merged
merged 8 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
repos:
- repo: https://github.com/timothycrosley/isort
rev: 5.0.4
- repo: https://github.com/pycqa/isort
rev: 5.6.4
hooks:
- id: isort
args: ["--settings-path=python/cuspatial/setup.cfg"]
files: python/cuspatial/.*
exclude: __init__.py$
types: [text]
types_or: [python, cython]
- repo: https://github.com/ambv/black
rev: stable
rev: 19.10b0
hooks:
- id: black
files: python/cuspatial/.*
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7
hooks:
- id: flake8
files: python/cuspatial/.*\.py
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7
hooks:
Expand Down
2 changes: 1 addition & 1 deletion ci/checks/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LANG=C.UTF-8
conda activate rapids

# Run isort and get results/return code
ISORT=`isort --check-only python/**/*.py`
ISORT=`isort --check-only python/cuspatial --settings-path=python/cuspatial/setup.cfg`
ISORT_RETVAL=$?

# Run black and get results/return code
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair

from cudf._lib.cpp.column.column cimport column
from cudf._lib.cpp.column.column_view cimport column_view

from libcpp.pair cimport pair
from libcpp.memory cimport unique_ptr


cdef extern from "cuspatial/coordinate_transform.hpp" namespace "cuspatial" \
nogil:
Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/_lib/cpp/hausdorff.pxd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr

from cudf._lib.cpp.column.column cimport column
from cudf._lib.cpp.column.column_view cimport column_view

from libcpp.memory cimport unique_ptr


cdef extern from "cuspatial/hausdorff.hpp" namespace "cuspatial" nogil:

Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/_lib/cpp/interpolate.pxd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr

from cudf._lib.column cimport column, column_view
from cudf._lib.table cimport table, table_view

from libcpp.memory cimport unique_ptr


cdef extern from "cuspatial/cubic_spline.hpp" namespace "cuspatial" nogil:
cdef unique_ptr[table] cubicspline_coefficients \
Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/_lib/cpp/point_in_polygon.pxd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from cudf._lib.column cimport column, column_view

from libcpp.memory cimport unique_ptr

from cudf._lib.column cimport column, column_view


cdef extern from "cuspatial/point_in_polygon.hpp" namespace "cuspatial" nogil:
cdef unique_ptr[column] point_in_polygon(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr

from cudf._lib.cpp.column.column_view cimport column_view
from cudf._lib.cpp.table.table cimport table

from libcpp.memory cimport unique_ptr


cdef extern from "cuspatial/polygon_bounding_box.hpp" \
namespace "cuspatial" nogil:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr

from cudf._lib.cpp.column.column_view cimport column_view
from cudf._lib.cpp.table.table cimport table

from libcpp.memory cimport unique_ptr


cdef extern from "cuspatial/polyline_bounding_box.hpp" \
namespace "cuspatial" nogil:
Expand Down
9 changes: 4 additions & 5 deletions python/cuspatial/cuspatial/_lib/cpp/quadtree.pxd
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libc.stdint cimport int8_t
from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair

from cudf._lib.cpp.column.column cimport column
from cudf._lib.cpp.column.column_view cimport column_view
from cudf._lib.cpp.table.table cimport table
from cudf._lib.cpp.types cimport size_type

from libc.stdint cimport int8_t

from libcpp.pair cimport pair
from libcpp.memory cimport unique_ptr


cdef extern from "cuspatial/point_quadtree.hpp" namespace "cuspatial" nogil:
cdef pair[unique_ptr[column], unique_ptr[table]] quadtree_on_points(
Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/_lib/cpp/shapefile_reader.pxd
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from cudf._lib.cpp.column.column cimport column

from libcpp.memory cimport unique_ptr
from libcpp.string cimport string
from libcpp.vector cimport vector

from cudf._lib.cpp.column.column cimport column


cdef extern from "cuspatial/shapefile_reader.hpp" namespace "cuspatial" nogil:
cdef vector[unique_ptr[column]] \
Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/_lib/cpp/spatial.pxd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2019-2020, NVIDIA CORPORATION.

from cudf._lib.column cimport column, column_view

from libcpp.memory cimport unique_ptr

from cudf._lib.column cimport column, column_view


cdef extern from "cuspatial/haversine.hpp" namespace "cuspatial" nogil:
cdef unique_ptr[column] haversine_distance(
Expand Down
7 changes: 3 additions & 4 deletions python/cuspatial/cuspatial/_lib/cpp/spatial_join.pxd
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from cudf._lib.column cimport column_view
from cudf._lib.table cimport table, table_view

from libc.stdint cimport int8_t

from libcpp.memory cimport unique_ptr

from cudf._lib.column cimport column_view
from cudf._lib.table cimport table, table_view


cdef extern from "cuspatial/spatial_join.hpp" namespace "cuspatial" nogil:

Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/_lib/cpp/spatial_window.pxd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr

from cudf._lib.column cimport column, column_view
from cudf._lib.table cimport table, table_view

from libcpp.memory cimport unique_ptr


cdef extern from "cuspatial/spatial_window.hpp" namespace "cuspatial" nogil:
cdef unique_ptr[table] points_in_spatial_window \
Expand Down
6 changes: 3 additions & 3 deletions python/cuspatial/cuspatial/_lib/cpp/trajectory.pxd
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair

from cudf._lib.cpp.column.column cimport column
from cudf._lib.cpp.column.column_view cimport column_view
from cudf._lib.cpp.table.table cimport table
from cudf._lib.cpp.types cimport size_type

from libcpp.pair cimport pair
from libcpp.memory cimport unique_ptr


cdef extern from "cuspatial/trajectory.hpp" namespace "cuspatial" nogil:

Expand Down
11 changes: 6 additions & 5 deletions python/cuspatial/cuspatial/_lib/hausdorff.pyx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Copyright (c) 2019, NVIDIA CORPORATION.

from cudf._lib.column cimport column, column_view, Column
from libcpp.memory cimport unique_ptr
from libcpp.utility cimport move

from cuspatial._lib.cpp.hausdorff \
cimport directed_hausdorff_distance as directed_cpp_hausdorff_distance
from cudf._lib.column cimport Column, column, column_view

from libcpp.utility cimport move
from libcpp.memory cimport unique_ptr
from cuspatial._lib.cpp.hausdorff cimport (
directed_hausdorff_distance as directed_cpp_hausdorff_distance,
)


def directed_hausdorff_distance(
Expand Down
11 changes: 6 additions & 5 deletions python/cuspatial/cuspatial/_lib/interpolate.pyx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Copyright (c) 2019-2020, NVIDIA CORPORATION.

from cudf._lib.table cimport table, Table
from cudf._lib.column cimport column, Column
from libcpp.memory cimport unique_ptr
from libcpp.utility cimport move

from cudf._lib.column cimport Column, column
from cudf._lib.table cimport Table, table

from cuspatial._lib.cpp.interpolate cimport (
cubicspline_interpolate as cpp_cubicspline_interpolate,
cubicspline_coefficients as cpp_cubicspline_coefficients,
cubicspline_interpolate as cpp_cubicspline_interpolate,
)

from libcpp.utility cimport move
from libcpp.memory cimport unique_ptr

cpdef cubicspline_coefficients(
Column t,
Expand Down
8 changes: 4 additions & 4 deletions python/cuspatial/cuspatial/_lib/point_in_polygon.pyx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from cudf._lib.column cimport column, column_view, Column
from libcpp.memory cimport unique_ptr
from libcpp.utility cimport move

from cudf._lib.column cimport Column, column, column_view

from cuspatial._lib.cpp.point_in_polygon cimport (
point_in_polygon as cpp_point_in_polygon,
)

from libcpp.utility cimport move
from libcpp.memory cimport unique_ptr


def point_in_polygon(
Column test_points_x,
Expand Down
9 changes: 5 additions & 4 deletions python/cuspatial/cuspatial/_lib/polygon_bounding_boxes.pyx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair
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.table.table cimport table
from cudf._lib.cpp.types cimport size_type
from cudf._lib.column cimport Column
from cudf._lib.table cimport Table

from cuspatial._lib.cpp.polygon_bounding_box cimport (
polygon_bounding_boxes as cpp_polygon_bounding_boxes,
)

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair
from libcpp.utility cimport move

cpdef polygon_bounding_boxes(Column poly_offsets,
Column ring_offsets,
Expand Down
9 changes: 5 additions & 4 deletions python/cuspatial/cuspatial/_lib/polyline_bounding_boxes.pyx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair
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.table.table cimport table
from cudf._lib.cpp.types cimport size_type
from cudf._lib.column cimport Column
from cudf._lib.table cimport Table

from cuspatial._lib.cpp.polyline_bounding_box cimport (
polyline_bounding_boxes as cpp_polyline_bounding_boxes,
)

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair
from libcpp.utility cimport move

cpdef polyline_bounding_boxes(Column poly_offsets,
Column x, Column y,
Expand Down
12 changes: 6 additions & 6 deletions python/cuspatial/cuspatial/_lib/quadtree.pyx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Copyright (c) 2020, NVIDIA CORPORATION.

from libc.stdint cimport int8_t
from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair
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.table.table cimport table
from cudf._lib.cpp.types cimport size_type
from cudf._lib.column cimport Column
from cudf._lib.table cimport Table

from cuspatial._lib.cpp.quadtree cimport (
quadtree_on_points as cpp_quadtree_on_points,
)

from libc.stdint cimport int8_t

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair
from libcpp.utility cimport move

cpdef quadtree_on_points(Column x, Column y,
double x_min, double x_max,
Expand Down
10 changes: 5 additions & 5 deletions python/cuspatial/cuspatial/_lib/shapefile_reader.pyx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) 2019-2020, NVIDIA CORPORATION.

from libcpp.memory cimport unique_ptr
from libcpp.string cimport string
from libcpp.utility cimport move
from libcpp.vector cimport vector

from cudf._lib.column cimport Column, column

from cuspatial._lib.cpp.shapefile_reader cimport (
read_polygon_shapefile as cpp_read_polygon_shapefile,
)

from libcpp.memory cimport unique_ptr
from libcpp.string cimport string
from libcpp.utility cimport move
from libcpp.vector cimport vector


cpdef read_polygon_shapefile(object filepath):
cdef string c_string = str(filepath).encode()
Expand Down
14 changes: 8 additions & 6 deletions python/cuspatial/cuspatial/_lib/spatial.pyx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
# Copyright (c) 2019, NVIDIA CORPORATION.

from cudf import Series

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair
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 cuspatial._lib.cpp.coordinate_transform cimport (
lonlat_to_cartesian as cpp_lonlat_to_cartesian
lonlat_to_cartesian as cpp_lonlat_to_cartesian,
)

from cuspatial._lib.cpp.spatial cimport (
haversine_distance as cpp_haversine_distance
haversine_distance as cpp_haversine_distance,
)

from libcpp.memory cimport unique_ptr
from libcpp.pair cimport pair
from libcpp.utility cimport move

cpdef haversine_distance(Column x1, Column y1, Column x2, Column y2):
cdef column_view c_x1 = x1.view()
Expand Down
Loading