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

[CI] Add pre-commit hook vulture to find dead Python code #1628

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ repos:
hooks:
- id: identity
- id: check-hooks-apply
- repo: https://github.com/jendrikseipp/vulture
rev: v2.13
hooks:
- id: vulture
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.10.0
hooks:
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ skips = ["B101", "B403", "B405", "B608"]

[tool.isort]
profile = "black"

[tool.vulture]
min_confidence = 100
paths = ["docs/usecases/utilities.py", "python/", "spark-version-converter.py"]
sort_by_size = true
2 changes: 1 addition & 1 deletion python/sedona/maps/SedonaPyDeck.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def _create_default_fill_color_(cls, gdf, plot_col):
return "[85, 183, 177, ({0} / {1}) * 255 + 15]".format(plot_col, plot_max)

@classmethod
def _create_coord_column_(cls, gdf, geometry_col, add_points=False):
def _create_coord_column_(cls, gdf, geometry_col):
"""
Create a coordinate column in a given GeoPandas Dataframe, this coordinate column contains coordinates of a ST_Point in a list format of [longitude, latitude]
:param gdf: GeoPandas Dataframe
Expand Down
2 changes: 1 addition & 1 deletion python/sedona/raster/sedona_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def close(self):
def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
def __exit__(self, exc_type, exc_val, exc_tb): # noqa
self.close()

def __del__(self):
Expand Down
2 changes: 1 addition & 1 deletion python/sedona/utils/abstract_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def name(self):
raise NotImplementedError

@classmethod
def serialize(cls, obj: BaseGeometry, binary_buffer: "BinaryBuffer"):
def serialize(cls, obj: BaseGeometry):
raise NotImplementedError("Parser has to implement serialize method")

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions python/sedona/utils/spatial_rdd_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __ne__(self, other):
class AbstractSpatialRDDParser(ABC):

@classmethod
def serialize(cls, obj: List[Any], binary_buffer: "BinaryBuffer") -> bytearray:
def serialize(cls, obj: List[Any]) -> bytearray:
raise NotImplemented()

@classmethod
Expand Down Expand Up @@ -132,7 +132,7 @@ def deserialize(cls, bin_parser: "BinaryParser"):
return deserialized_data

@classmethod
def serialize(cls, obj: BaseGeometry, binary_buffer: "BinaryBuffer"):
def serialize(cls, obj: BaseGeometry):
raise NotImplementedError("Currently this operation is not supported")


Expand All @@ -148,7 +148,7 @@ def deserialize(cls, bin_parser: "BinaryParser"):
return left_geom_data

@classmethod
def serialize(cls, obj: BaseGeometry, binary_buffer: "BinaryBuffer"):
def serialize(cls, obj: BaseGeometry):
raise NotImplementedError("Currently this operation is not supported")


Expand All @@ -175,7 +175,7 @@ def deserialize(cls, bin_parser: "BinaryParser"):
return deserialized_data

@classmethod
def serialize(cls, obj: BaseGeometry, binary_buffer: "BinaryBuffer"):
def serialize(cls, obj: BaseGeometry):
raise NotImplementedError("Currently this operation is not supported")


Expand Down
2 changes: 1 addition & 1 deletion python/tests/spatial_rdd/test_spatial_rdd_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def remove_wkb_directory():

class TestSpatialRDDWriter(TestBase):

def test_save_as_geo_json_with_data(self, remove_wkb_directory):
def test_save_as_geo_json_with_data(self):
spatial_rdd = PointRDD(
sparkContext=self.sc,
InputLocation=inputLocation,
Expand Down
Loading