This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new 7c5367826 [SEDONA-546] Python linting enable rule `E712` (#1372)
7c5367826 is described below
commit 7c53678262da2d4c988dfa2f9ac200e81b002d49
Author: John Bampton <[email protected]>
AuthorDate: Fri Apr 26 17:55:58 2024 +1000
[SEDONA-546] Python linting enable rule `E712` (#1372)
Comparison to true should be 'if cond is true:' or 'if cond:'.
https://www.flake8rules.com/rules/E712.html
https://peps.python.org/pep-0008/#programming-recommendations
---
.github/linters/ruff.toml | 2 +-
.pre-commit-config.yaml | 2 +-
python/tests/maps/test_sedonapydeck.py | 4 ++--
python/tests/sql/test_function.py | 8 ++++----
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/.github/linters/ruff.toml b/.github/linters/ruff.toml
index 9dc060467..68c5cd334 100644
--- a/.github/linters/ruff.toml
+++ b/.github/linters/ruff.toml
@@ -40,7 +40,7 @@ target-version = "py38"
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F"]
-ignore = ["E712", "E721", "E722", "E731", "E741", "F401", "F402", "F403",
"F405", "F811", "F821", "F822", "F841", "F901"]
+ignore = ["E721", "E722", "E731", "E741", "F401", "F402", "F403", "F405",
"F811", "F821", "F822", "F841", "F901"]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9ab4aecb9..51e3c5e18 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -22,7 +22,7 @@ repos:
rev: v0.4.2
hooks:
- id: ruff
- args: [--config=.github/linters/ruff.toml]
+ args: [--config=.github/linters/ruff.toml, --fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
diff --git a/python/tests/maps/test_sedonapydeck.py
b/python/tests/maps/test_sedonapydeck.py
index e7d7c0fd3..7046f54a0 100644
--- a/python/tests/maps/test_sedonapydeck.py
+++ b/python/tests/maps/test_sedonapydeck.py
@@ -109,7 +109,7 @@ class TestVisualization(TestBase):
p_map = pdk.Deck(layers=[layer])
sedona_pydeck_map =
SedonaPyDeck.create_scatterplot_map(df=chicago_crimes_df)
- assert self.isMapEqual(sedona_map=sedona_pydeck_map, pydeck_map=p_map)
== True
+ assert self.isMapEqual(sedona_map=sedona_pydeck_map, pydeck_map=p_map)
def testHeatmap(self):
chicago_crimes_csv_df = self.spark.read.format("csv"). \
@@ -144,7 +144,7 @@ class TestVisualization(TestBase):
p_map = pdk.Deck(layers=[layer])
sedona_pydeck_map = SedonaPyDeck.create_heatmap(df=chicago_crimes_df)
- assert self.isMapEqual(sedona_map=sedona_pydeck_map, pydeck_map=p_map)
== True
+ assert self.isMapEqual(sedona_map=sedona_pydeck_map, pydeck_map=p_map)
def isMapEqual(self, pydeck_map, sedona_map):
sedona_dict = json.loads(sedona_map.to_json())
diff --git a/python/tests/sql/test_function.py
b/python/tests/sql/test_function.py
index 009459d5b..ea8497132 100644
--- a/python/tests/sql/test_function.py
+++ b/python/tests/sql/test_function.py
@@ -844,10 +844,10 @@ class TestPredicateJoin(TestBase):
def test_isPolygonCW(self):
actual = self.spark.sql("SELECT ST_IsPolygonCW(ST_GeomFromWKT('POLYGON
((20 35, 10 30, 10 10, 30 5, 45 20, 20 35),(30 20, 20 15, 20 25, 30
20))'))").take(1)[0][0]
- assert actual == False
+ assert not actual
actual = self.spark.sql("SELECT ST_IsPolygonCW(ST_GeomFromWKT('POLYGON
((20 35, 45 20, 30 5, 10 10, 10 30, 20 35), (30 20, 20 25, 20 15, 30
20))'))").take(1)[0][0]
- assert actual == True
+ assert actual
def test_st_is_ring(self):
result_and_expected = [
@@ -862,10 +862,10 @@ class TestPredicateJoin(TestBase):
def test_isPolygonCCW(self):
actual = self.spark.sql("SELECT
ST_IsPolygonCCW(ST_GeomFromWKT('POLYGON ((20 35, 10 30, 10 10, 30 5, 45 20, 20
35),(30 20, 20 15, 20 25, 30 20))'))").take(1)[0][0]
- assert actual == True
+ assert actual
actual = self.spark.sql("SELECT
ST_IsPolygonCCW(ST_GeomFromWKT('POLYGON ((20 35, 45 20, 30 5, 10 10, 10 30, 20
35), (30 20, 20 25, 20 15, 30 20))'))").take(1)[0][0]
- assert actual == False
+ assert not actual
def test_forcePolygonCCW(self):
actualDf = self.spark.sql(