Skip to content

Commit

Permalink
build(pre-commit.ci): pre-commit autoupdate (#12)
Browse files Browse the repository at this point in the history
* build(pre-commit.ci): pre-commit autoupdate

updates:
- [github.com/compilerla/conventional-pre-commit: v2.3.0 → v3.0.0](compilerla/conventional-pre-commit@v2.3.0...v3.0.0)
- https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit
- [github.com/astral-sh/ruff-pre-commit: v0.1.8 → v0.1.9](astral-sh/ruff-pre-commit@v0.1.8...v0.1.9)
- [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.8.0](pre-commit/mirrors-mypy@v1.4.1...v1.8.0)
- [github.com/pdm-project/pdm: 2.10.1 → 2.11.1](pdm-project/pdm@2.10.1...2.11.1)
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0)
- [github.com/dosisod/refurb: v1.23.0 → v1.26.0](dosisod/refurb@v1.23.0...v1.26.0)
- [github.com/FHPythonUtils/LicenseCheck: 2023.1.4 → 2023.5.2](FHPythonUtils/LicenseCheck@2023.1.4...2023.5.2)

* refactor: apply refurb suggestions

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kamil Raczycki <raczyckikamil@gmail.com>
  • Loading branch information
pre-commit-ci[bot] and RaczeQ committed Jan 2, 2024
1 parent 37c5ad8 commit 6ae4e4f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
default_stages: [commit]
repos:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.3.0
rev: v3.0.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.1.8'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.9'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -19,12 +19,12 @@ repos:
additional_dependencies: [tomli]
args: ["--in-place", "--config", "./pyproject.toml"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: ['types-requests', 'types-six']
- repo: https://github.com/pdm-project/pdm
rev: 2.10.1
rev: 2.11.1
hooks:
- id: pdm-lock-check
- id: pdm-export
Expand All @@ -36,7 +36,7 @@ repos:
hooks:
- id: nbstripout
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -47,15 +47,15 @@ repos:
args: ['--maxkb=1000']
- id: detect-private-key
- repo: https://github.com/dosisod/refurb
rev: v1.23.0
rev: v1.26.0
hooks:
- id: refurb
args: ["--python-version", "3.9"]
language: python
language_version: python3.10
stages: [manual]
- repo: https://github.com/FHPythonUtils/LicenseCheck
rev: "2023.1.4"
rev: "2023.5.2"
hooks:
- id: licensecheck
stages: [manual]
Expand Down
10 changes: 4 additions & 6 deletions quackosm/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,12 @@ def convert_pbf_to_gpq(
│ 2140 rows (20 shown) 3 columns │
└────────────────────────────────────────────────────────────────────────────────────────┘
"""
reader = PbfFileReader(
return PbfFileReader(
tags_filter=tags_filter,
geometry_filter=geometry_filter,
working_directory=working_directory,
osm_way_polygon_features_config=osm_way_polygon_features_config,
)
return reader.convert_pbf_to_gpq(
).convert_pbf_to_gpq(
pbf_path=pbf_path,
result_file_path=result_file_path,
explode_tags=explode_tags,
Expand Down Expand Up @@ -386,13 +385,12 @@ def get_features_gdf(
<BLANKLINE>
[3109 rows x 2 columns]
"""
reader = PbfFileReader(
return PbfFileReader(
tags_filter=tags_filter,
geometry_filter=geometry_filter,
working_directory=working_directory,
osm_way_polygon_features_config=osm_way_polygon_features_config,
)
return reader.get_features_gdf(
).get_features_gdf(
file_paths=file_paths,
explode_tags=explode_tags,
ignore_cache=ignore_cache,
Expand Down
5 changes: 2 additions & 3 deletions quackosm/pbf_file_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ def _save_parquet_file_with_geometry(
fix_geometries: bool = False,
) -> "duckdb.DuckDBPyRelation":
if not fix_geometries:
with TaskProgressSpinner(step_name, f"{step_number}"):
with TaskProgressSpinner(step_name, step_number):
self.connection.sql(f"""
COPY (
SELECT
Expand Down Expand Up @@ -1306,8 +1306,7 @@ def _concatenate_results_to_geoparquet(

valid_features_parquet_table = valid_features_parquet_table.append_column(
GEOMETRY_COLUMN, geometry_column
)
valid_features_parquet_table = valid_features_parquet_table.drop("geometry_wkb")
).drop("geometry_wkb")

parquet_tables = [valid_features_parquet_table]

Expand Down
8 changes: 3 additions & 5 deletions tests/test_pbf_file_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def test_pbf_reader(
expected_features_columns_length: int,
):
"""Test proper files loading in `PbfFileReader`."""
handler = PbfFileReader(tags_filter=query)
features_gdf = handler.get_features_gdf(
features_gdf = PbfFileReader(tags_filter=query).get_features_gdf(
file_paths=[Path(__file__).parent / "test_files" / test_file_name],
explode_tags=True,
ignore_cache=True,
Expand All @@ -99,10 +98,9 @@ def test_pbf_reader(
def test_pbf_reader_geometry_filtering(): # type: ignore
"""Test proper spatial data filtering in `PbfFileReader`."""
file_name = "d17f922ed15e9609013a6b895e1e7af2d49158f03586f2c675d17b760af3452e.osm.pbf"
handler = PbfFileReader(
features_gdf = PbfFileReader(
tags_filter=HEX2VEC_FILTER, geometry_filter=Polygon([(0, 0), (0, 1), (1, 1), (1, 0)])
)
features_gdf = handler.get_features_gdf(
).get_features_gdf(
file_paths=[Path(__file__).parent / "test_files" / file_name],
explode_tags=True,
ignore_cache=True,
Expand Down

0 comments on commit 6ae4e4f

Please sign in to comment.