From 0e75eb743aa1f43f39c3a4471ce0059d72de20d5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:44:07 +0000 Subject: [PATCH 1/3] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/commitizen-tools/commitizen: v3.28.0 → v3.29.1](https://github.com/commitizen-tools/commitizen/compare/v3.28.0...v3.29.1) - [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.6.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.6...v0.6.8) - [github.com/sqlfluff/sqlfluff: 3.1.0 → 3.2.0](https://github.com/sqlfluff/sqlfluff/compare/3.1.0...3.2.0) - [github.com/igorshubovych/markdownlint-cli: v0.41.0 → v0.42.0](https://github.com/igorshubovych/markdownlint-cli/compare/v0.41.0...v0.42.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9295f5e..88be07b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # Versioning: Commit messages & changelog - repo: https://github.com/commitizen-tools/commitizen - rev: v3.28.0 + rev: v3.29.1 hooks: - id: commitizen stages: [commit-msg] @@ -9,7 +9,7 @@ repos: # Lint / autoformat: Python code - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: "v0.5.6" + rev: "v0.6.8" hooks: # Run the linter - id: ruff @@ -19,7 +19,7 @@ repos: # Lint & Autoformat: SQL - repo: https://github.com/sqlfluff/sqlfluff - rev: 3.1.0 + rev: 3.2.0 hooks: - id: sqlfluff-lint files: ^fmtm_splitter/fmtm_algorithm.sql @@ -47,7 +47,7 @@ repos: ] # Lint: Markdown - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.41.0 + rev: v0.42.0 hooks: - id: markdownlint args: From f1f35cc31455fe289ad80f9d73d8ab355849d1a6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:44:57 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- fmtm_splitter/fmtm_algorithm.sql | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fmtm_splitter/fmtm_algorithm.sql b/fmtm_splitter/fmtm_algorithm.sql index d8760af..443aafd 100644 --- a/fmtm_splitter/fmtm_algorithm.sql +++ b/fmtm_splitter/fmtm_algorithm.sql @@ -116,7 +116,7 @@ CREATE TABLE buildings AS ( SELECT b.*, polys.polyid - FROM "ways_poly" AS b, polygonsnocount AS polys + FROM ways_poly AS b, polygonsnocount AS polys WHERE ST_INTERSECTS(polys.geom, ST_CENTROID(b.geom)) AND b.tags ->> 'building' IS NOT NULL @@ -146,7 +146,7 @@ CREATE TABLE splitpolygons AS ( COUNT(b.geom) AS numfeatures, ST_AREA(sp.geog) AS area FROM polygonsnocount AS sp - LEFT JOIN "buildings" AS b + LEFT JOIN buildings AS b ON sp.polyid = b.polyid GROUP BY sp.polyid, sp.geom ) @@ -170,7 +170,7 @@ CREATE TABLE lowfeaturecountpolygons AS ( SELECT * FROM splitpolygons AS p -- TODO: feature count should not be hard-coded - WHERE p.numfeatures < %(num_buildings)s + WHERE p.numfeatures < p.%(num_buildings)s ), -- Find the neighbors of the low-feature-count polygons @@ -244,9 +244,10 @@ CREATE TABLE clusteredbuildings AS ( SELECT *, ST_CLUSTERKMEANS( - geom, CAST((b.numfeatures / %(num_buildings)s) + 1 AS integer) + b.geom, + CAST((b.numfeatures / b.%(num_buildings)s) + 1 AS integer) ) - OVER (PARTITION BY polyid) + OVER (PARTITION BY b.polyid) AS cid FROM buildingstocluster AS b ), From 29c2af2246e96043e3bbe58bb29b976de8a20dd7 Mon Sep 17 00:00:00 2001 From: Sujan Adhikari Date: Fri, 4 Oct 2024 10:33:19 +0545 Subject: [PATCH 3/3] fix: invalid inclusion of alias to get num_buildings by pre-commit --- fmtm_splitter/fmtm_algorithm.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmtm_splitter/fmtm_algorithm.sql b/fmtm_splitter/fmtm_algorithm.sql index 443aafd..a2165e9 100644 --- a/fmtm_splitter/fmtm_algorithm.sql +++ b/fmtm_splitter/fmtm_algorithm.sql @@ -170,7 +170,7 @@ CREATE TABLE lowfeaturecountpolygons AS ( SELECT * FROM splitpolygons AS p -- TODO: feature count should not be hard-coded - WHERE p.numfeatures < p.%(num_buildings)s + WHERE p.numfeatures < %(num_buildings)s ), -- Find the neighbors of the low-feature-count polygons @@ -245,7 +245,7 @@ CREATE TABLE clusteredbuildings AS ( *, ST_CLUSTERKMEANS( b.geom, - CAST((b.numfeatures / b.%(num_buildings)s) + 1 AS integer) + CAST((b.numfeatures / %(num_buildings)s) + 1 AS integer) ) OVER (PARTITION BY b.polyid) AS cid