diff --git a/.github/pre-commit.yml b/.github/workflows/pre-commit.yml similarity index 100% rename from .github/pre-commit.yml rename to .github/workflows/pre-commit.yml diff --git a/.github/publish_package.yml b/.github/workflows/publish_package.yml similarity index 100% rename from .github/publish_package.yml rename to .github/workflows/publish_package.yml diff --git a/.github/tests.yml b/.github/workflows/tests.yml similarity index 100% rename from .github/tests.yml rename to .github/workflows/tests.yml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28f2b41..0277a5d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/geoparquet_pydantic/convert.py b/geoparquet_pydantic/convert.py index 5a06e8b..78327bd 100644 --- a/geoparquet_pydantic/convert.py +++ b/geoparquet_pydantic/convert.py @@ -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. @@ -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. diff --git a/geoparquet_pydantic/schemas.py b/geoparquet_pydantic/schemas.py index eb6baa4..d10a5f2 100644 --- a/geoparquet_pydantic/schemas.py +++ b/geoparquet_pydantic/schemas.py @@ -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() diff --git a/geoparquet_pydantic/validate.py b/geoparquet_pydantic/validate.py index d016ee7..c1ef169 100644 --- a/geoparquet_pydantic/validate.py +++ b/geoparquet_pydantic/validate.py @@ -5,7 +5,6 @@ """ import ast -import warnings import pyarrow from geoparquet_pydantic.schemas import ( GeoParquetMetadata, @@ -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" diff --git a/tests/test_conversions.py b/tests/test_conversions.py index 97fd038..46a22a4 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -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) diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 6245007..abd6b82 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -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()