Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
exclude: 'docs|node_modules|migrations|.git|.tox'
default_stages: [commit]
default_stages: [pre-commit]
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
files: (^|/)a/.+\.(py|html|sh|css|js)$
- id: check-added-large-files
args: ["--maxkb=2000"]

# Linting with ruff
- repo: https://github.com/charliermarsh/ruff-pre-commit
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.1.6'
rev: 'v0.15.18'
hooks:
- id: ruff
- id: ruff-check
types_or: [ python, pyi, jupyter ]
args: [--fix, --exit-non-zero-on-fix]
args: [--fix]
- id: ruff-format
types_or: [ python, pyi, jupyter ]
6 changes: 3 additions & 3 deletions src/gregor/disaggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ def disaggregate_polygon_to_point(
)

# Make sure that it belongs to only one polygon
assert (
points.belongs_to.apply(len).max() == 1
), "Every Point should belong to exactly one polygon."
assert points.belongs_to.apply(len).max() == 1, (
"Every Point should belong to exactly one polygon."
)
points.belongs_to = points.belongs_to.apply(lambda x: x[0])

# Warn if there are polygons without points.
Expand Down
3 changes: 2 additions & 1 deletion test/test_aggregate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pytest
from gregor.aggregate import aggregate_point_to_polygon, aggregate_raster_to_polygon
from numpy.testing import assert_array_equal

from gregor.aggregate import aggregate_point_to_polygon, aggregate_raster_to_polygon


def test_agg_tif_2x2(square_segmentation_2x2):
agg_raster_poly = aggregate_raster_to_polygon(
Expand Down
3 changes: 2 additions & 1 deletion test/test_belongs_to.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from gregor.disaggregate import get_belongs_to_matrix
from numpy.testing import assert_array_equal

from gregor.disaggregate import get_belongs_to_matrix


def test_belongs_to_matrix_square_segmentation_2x2(
dummy_raster, square_segmentation_2x2
Expand Down
1 change: 1 addition & 0 deletions test/test_disaggregate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

from gregor.disaggregate import (
disaggregate_polygon_to_point,
disaggregate_polygon_to_raster,
Expand Down
3 changes: 2 additions & 1 deletion test/test_performance.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import numpy as np
import pytest
from gregor.disaggregate import disaggregate_polygon_to_raster
from memory_log import MemoryLogger

from gregor.disaggregate import disaggregate_polygon_to_raster


@pytest.mark.benchmark
def test_performance_disaggregate_to_raster(large_raster, large_polygons):
Expand Down
Loading