Skip to content

Commit e0e6120

Browse files
committed
update template, fix linter issues
1 parent e976d0b commit e0e6120

File tree

11 files changed

+561
-508
lines changed

11 files changed

+561
-508
lines changed

.copier-answers.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v7.0.0
2+
_commit: v7.1.0
33
_src_path: gh:eccenca/cmem-plugin-template
44
author_mail: [email protected]
55
author_name: eccenca GmbH

.gitlab-ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
default:
3-
image: docker-registry.eccenca.com/eccenca-python:v3.11.4
3+
image: docker-registry.eccenca.com/eccenca-python:v3.11.9-2
44
# all jobs can be interrupted in case a new commit is pushed
55
interruptible: true
66
before_script:

.idea/cmem-plugin-base.iml

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Taskfile.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ tasks:
157157
<<: *preparation
158158
cmds:
159159
# ignore 51358 safety - dev dependency only
160-
# ignore 67599 pip - dev dependency only
161-
# ignore 70612 jinja2 - dev dependency only
162-
- poetry run safety check -i 51358 -i 67599 -i 70612
160+
- poetry run safety check -i 51358
163161

164162
check:ruff:
165163
desc: Complain about everything else

cmem_plugin_base/dataintegration/parameter/resource.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""DI Resource Parameter Type."""
2+
# ruff: noqa: A005
23

34
from typing import Any
45

cmem_plugin_base/dataintegration/typed_entities/file.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def __init__(self):
4646
def to_entity(self, value: File) -> Entity:
4747
"""Create a generic entity from a file"""
4848
return Entity(
49-
uri = instance_uri(value.path),
50-
values = [[value.path], [value.file_type], [value.mime or ""]]
49+
uri=instance_uri(value.path),
50+
values=[[value.path], [value.file_type], [value.mime or ""]],
5151
)
5252

5353
def from_entity(self, entity: Entity) -> File:

cmem_plugin_base/dataintegration/typed_entities/typed_entities.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ def from_entities(self, entities: Entities) -> "TypedEntities[T]":
4343
return entities
4444
return TypedEntities(map(self.from_entity, entities.entities), self)
4545
raise ValueError(
46-
f"Expected entities of type '{self.type_uri}' but got '{entities.schema.type_uri}'.")
46+
f"Expected entities of type '{self.type_uri}' but got '{entities.schema.type_uri}'."
47+
)
48+
4749

4850
class TypedEntities(Entities, Generic[T]):
4951
"""Collection of entities of a particular type."""

cmem_plugin_base/dataintegration/types.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Parameter types."""
2+
# ruff: noqa: A005
23

34
from collections.abc import Iterable
45
from dataclasses import dataclass

poetry.lock

+539-482
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+7-8
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ python-ulid = "^2.2.0"
2727

2828
[tool.poetry.group.dev.dependencies]
2929
genbadge = {extras = ["coverage"], version = "^1.1.1"}
30-
mypy = "^1.11.1"
31-
pip = "^24"
32-
pytest = "^8.3.2"
33-
pytest-cov = "^5.0.0"
30+
mypy = "^1.14.1"
31+
pip = "^25.0"
32+
pytest = "^8.3.4"
33+
pytest-cov = "^6.0.0"
3434
pytest-dotenv = "^0.5.2"
3535
pytest-html = "^4.1.1"
3636
pytest-memray = { version = "^1.7.0", markers = "platform_system != 'Windows'" }
37-
ruff = "^0.6.1"
37+
ruff = "^0.9.4"
3838
safety = "^1.10.3"
3939
types-requests = "^2.32.0.20240907"
4040

@@ -85,7 +85,6 @@ line-ending = "lf" # Use `\n` line endings for all files
8585
[tool.ruff.lint]
8686
select = ["ALL"]
8787
ignore = [
88-
"ANN101", # Missing type annotation for self in method
8988
"ANN204", # Missing return type annotation for special method `__init__`
9089
"COM812", # missing-trailing-comma
9190
"D107", # Missing docstring in __init__
@@ -108,7 +107,7 @@ ignore = [
108107
[tool.ruff.lint.per-file-ignores]
109108
"**/{tests}/*" = [
110109
"PLR2004", # Checks for the use of unnamed numerical constants ("magic") values in comparisons.
111-
"PT009", # Use a regular `assert` instead of unittest-style `assertListEqual`
112-
"PT027" # Use pytest.raises instead of unittest-style {assertion}
110+
"PT009", # Use a regular `assert` instead of unittest-style `assertListEqual`
111+
"PT027" # Use pytest.raises instead of unittest-style {assertion}
113112
]
114113

tests/typed_entities/test_typed_entities.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def execute(self, inputs: Sequence[Entities], context: ExecutionContext) -> Enti
2323
"""Concatenate input files"""
2424
input_files = FileEntitySchema().from_entities(inputs[0])
2525

26-
with tempfile.NamedTemporaryFile(mode="wb", delete=False, delete_on_close=True) as o_file:
26+
with tempfile.NamedTemporaryFile(mode="wb", delete=False) as o_file:
2727
output_name = o_file.name
2828
for file in input_files.values:
2929
if isinstance(file, LocalFile):
@@ -40,12 +40,10 @@ class TypedEntitiesTest(unittest.TestCase):
4040
def test_files(self) -> None:
4141
"""Test file entity schema."""
4242
# Create two files
43-
temp1 = tempfile.NamedTemporaryFile(delete=False, delete_on_close=True, mode="w")
44-
temp1.write("ABC")
45-
temp1.close()
46-
temp2 = tempfile.NamedTemporaryFile(delete=False, delete_on_close=True, mode="w")
47-
temp2.write("123")
48-
temp2.close()
43+
with tempfile.NamedTemporaryFile(delete=False, mode="w") as temp1:
44+
temp1.write("ABC")
45+
with tempfile.NamedTemporaryFile(delete=False, mode="w") as temp2:
46+
temp2.write("123")
4947

5048
# Execute operator
5149
input_entities = FileEntitySchema().to_entities(

0 commit comments

Comments
 (0)