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
28 changes: 14 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
repos:
# Note for all linters: do not forget to update pyproject.toml when updating version.
- repo: https://github.com/ambv/black
rev: 25.1.0
hooks:
- id: black
language_version: python3.11
# Note for all linters: do not forget to update pyproject.toml when updating version.
- repo: https://github.com/ambv/black
rev: 26.3.1
hooks:
- id: black
language_version: python3.11

- repo: https://github.com/pycqa/flake8
rev: 7.2.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/flake8
rev: 7.2.0
hooks:
- id: flake8

- repo: https://github.com/timothycrosley/isort
rev: 6.0.1
hooks:
- id: isort
- repo: https://github.com/timothycrosley/isort
rev: 6.0.1
hooks:
- id: isort
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ make tests args='...' # Run specific pytest args
### Formatting

- **Line length**: 88 characters (matches Black default)
- **Formatter**: Black (v25.1.0)
- **Formatter**: Black (v26.3.1)
- **Import sorting**: isort (v6.0.1) with:
- `multi_line_output = 3` (hanging indent)
- `include_trailing_comma = true`
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dev = [
"types-pytz==2024.1.0.20240417",
"types-pyyaml==6.0.12.20240808",
"flake8==7.2.0",
"black==25.1.0",
"black==26.3.1",
"factory_boy-peewee==0.0.4", # This package is archived and not maintained anymore but works and is very lightweight.
"mypy==1.10.1",
"pytest~=7.2.0",
Expand Down Expand Up @@ -101,6 +101,7 @@ exclude = '''
| dist
)/
'''
target-version = ["py311"]

[tool.coverage.run]
data_file = ".cov/.coverage"
Expand Down
2 changes: 1 addition & 1 deletion robotoff/app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def on_get(self, req: falcon.Request, resp: falcon.Response):
if image is None:
raise falcon.HTTPBadRequest(f"Could not fetch image: {image_url}")

(left, right, top, bottom) = (
left, right, top, bottom = (
x_min * image.width,
x_max * image.width,
y_min * image.height,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
itself.

"""

import collections
import warnings

Expand Down Expand Up @@ -279,14 +280,14 @@ def draw_bounding_box_on_image(
draw = ImageDraw.Draw(image)
im_width, im_height = image.size
if use_normalized_coordinates:
(left, right, top, bottom) = (
left, right, top, bottom = (
xmin * im_width,
xmax * im_width,
ymin * im_height,
ymax * im_height,
)
else:
(left, right, top, bottom) = (xmin, xmax, ymin, ymax)
left, right, top, bottom = (xmin, xmax, ymin, ymax)
draw.line(
[(left, top), (left, bottom), (right, bottom), (right, top), (left, top)],
width=thickness,
Expand Down
2 changes: 1 addition & 1 deletion robotoff/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def init_sentry(integrations: list[Integration] | None = None):
event_level=logging.WARNING, # Send warning and errors as events
)
)
sentry_sdk.init( # type:ignore # mypy say it's abstract
sentry_sdk.init( # type: ignore # mypy say it's abstract
_sentry_dsn,
environment=robotoff_instance,
integrations=integrations,
Expand Down
2 changes: 1 addition & 1 deletion robotoff/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def convert_image_to_array(image: Image.Image) -> np.ndarray:
if image.mode != "RGB":
image = image.convert("RGB")

(im_width, im_height) = image.size
im_width, im_height = image.size

return np.array(image.getdata()).reshape((im_height, im_width, 3))

Expand Down
2 changes: 1 addition & 1 deletion robotoff/workers/tasks/import_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ def save_logo_embeddings(
image_width = image.shape[1]
for logo in logos:
y_min, x_min, y_max, x_max = logo.bounding_box
(left, right, top, bottom) = (
left, right, top, bottom = (
int(x_min * image_width),
int(x_max * image_width),
int(y_min * image_height),
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class TestNutrientData:

def test_from_webcomponent_json(self):
# real data generated by webcomponent
nutrient_data = json.loads(
"""{
nutrient_data = json.loads("""{
"nutrients": {
"energy-kj_100g": {
"value": "-",
Expand Down Expand Up @@ -59,8 +58,7 @@ def test_from_webcomponent_json(self):
},
"nutrition_data_per": "100g",
"serving_size": "1/4 pack"
}"""
)
}""")
NutrientData.model_validate(nutrient_data)


Expand Down
79 changes: 61 additions & 18 deletions uv.lock

Large diffs are not rendered by default.

Loading