Skip to content

Commit

Permalink
Merge pull request #4 from xaviernogueira/adding_actions
Browse files Browse the repository at this point in the history
Running pre-commits (should have been in the last PR)
  • Loading branch information
xaviernogueira authored Feb 20, 2024
2 parents 7a2d409 + ac4c5a6 commit d5618ee
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ repos:
# - id: pyright
# exclude: ^tests/.*
# additional_dependencies: [pyarrow, shapely, geojson-pydantic]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--black, --in-place]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand Down
6 changes: 4 additions & 2 deletions geoparquet_pydantic/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def geojson_to_geoparquet(
geo_metadata: GeoParquetMetadata | dict | None = None,
**kwargs,
) -> pyarrow.Table:
"""Converts a GeoJSON Pydantic FeatureCollection to an Arrow table with geoparquet metadata.
"""Converts a GeoJSON Pydantic FeatureCollection to an Arrow table with geoparquet
metadata.
To save to a file, simply use pyarrow.parquet.write_table() on the returned table.
Expand Down Expand Up @@ -192,7 +193,8 @@ def geoparquet_to_geojson(
max_chunksize: Optional[int] = None,
max_workers: Optional[int] = None,
) -> FeatureCollection:
"""Converts an Arrow table with GeoParquet metadata to a GeoJSON Pydantic FeatureCollection.
"""Converts an Arrow table with GeoParquet metadata to a GeoJSON Pydantic
FeatureCollection.
Args:
geoparquet (pyarrow.Table): Either an Arrow.Table or parquet with GeoParquet metadata.
Expand Down
2 changes: 1 addition & 1 deletion geoparquet_pydantic/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class GeometryColumnMetadata(BaseModel):
@field_validator("crs")
@classmethod
def convert_crs_to_projjson(cls, v) -> str:
"""Parse a CRS string and return a PROJJSON string"""
"""Parse a CRS string and return a PROJJSON string."""
try:
crs = CRS.from_string(v)
return crs.to_json()
Expand Down
2 changes: 0 additions & 2 deletions geoparquet_pydantic/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""

import ast
import warnings
import pyarrow
from geoparquet_pydantic.schemas import (
GeoParquetMetadata,
Expand Down Expand Up @@ -42,7 +41,6 @@ def validate_geoparquet_table(
Returns:
bool: True if the metadata is valid, False otherwise.
"""
if not primary_column:
primary_column = "geometry"
Expand Down
3 changes: 2 additions & 1 deletion tests/test_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ def test_validate_column_schema(
def test_geojson_to_geoparquet(
valid_geojson_obj: FeatureCollection,
):
"""Test the conversion of a valid GeoJSON file and pydantic object to a valid GeoParquet table."""
"""Test the conversion of a valid GeoJSON file and pydantic object to a valid
GeoParquet table."""

# convert the GeoJSON object to a GeoParquet table with minimal optional
table = geojson_to_geoparquet(valid_geojson_obj)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_good_geo_column_metadata(good_geo_column_metadata):


def test_bad_geo_column_metadata(good_geo_column_metadata):
"""Test that the GeoColumnMetadata raises an error when given bad data"""
"""Test that the GeoColumnMetadata raises an error when given bad data."""

# Test bad encoding
bad_encoding = good_geo_column_metadata.copy()
Expand Down

0 comments on commit d5618ee

Please sign in to comment.