udata 9.1.2.dev30754__py2.py3-none-any.whl → 9.1.4.dev30983__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of udata might be problematic. Click here for more details.
- tasks/helpers.py +6 -5
- udata/__init__.py +1 -1
- udata/api/__init__.py +2 -3
- udata/api/commands.py +0 -1
- udata/api/fields.py +22 -1
- udata/api_fields.py +22 -12
- udata/app.py +1 -1
- udata/assets.py +1 -1
- udata/auth/__init__.py +8 -12
- udata/commands/db.py +3 -3
- udata/commands/dcat.py +1 -1
- udata/commands/fixtures.py +110 -54
- udata/commands/init.py +2 -2
- udata/commands/tests/test_fixtures.py +71 -0
- udata/core/activity/tasks.py +1 -1
- udata/core/badges/models.py +0 -2
- udata/core/contact_point/api.py +1 -3
- udata/core/dataservices/tasks.py +1 -1
- udata/core/dataset/actions.py +2 -2
- udata/core/dataset/forms.py +0 -2
- udata/core/dataset/models.py +12 -10
- udata/core/dataset/rdf.py +1 -1
- udata/core/discussions/api.py +1 -1
- udata/core/discussions/models.py +2 -2
- udata/core/discussions/tasks.py +1 -1
- udata/core/organization/api.py +3 -4
- udata/core/organization/api_fields.py +2 -1
- udata/core/organization/apiv2.py +1 -1
- udata/core/reports/api.py +11 -0
- udata/core/reports/models.py +6 -1
- udata/core/reuse/metrics.py +1 -1
- udata/core/reuse/permissions.py +2 -1
- udata/core/reuse/search.py +2 -2
- udata/core/reuse/tasks.py +2 -2
- udata/core/spatial/commands.py +3 -3
- udata/core/spatial/factories.py +1 -1
- udata/core/spatial/forms.py +1 -1
- udata/core/spatial/models.py +2 -2
- udata/core/spatial/tests/test_models.py +1 -1
- udata/core/spatial/translations.py +3 -1
- udata/core/user/api.py +4 -4
- udata/core/user/metrics.py +1 -1
- udata/frontend/__init__.py +1 -1
- udata/harvest/actions.py +1 -1
- udata/harvest/backends/__init__.py +1 -1
- udata/harvest/tasks.py +0 -1
- udata/harvest/tests/factories.py +0 -2
- udata/harvest/tests/test_base_backend.py +0 -1
- udata/harvest/tests/test_dcat_backend.py +16 -17
- udata/migrations/2020-07-24-remove-s-from-scope-oauth.py +1 -1
- udata/migrations/2021-07-05-remove-unused-badges.py +0 -1
- udata/migrations/2023-02-08-rename-internal-dates.py +0 -2
- udata/migrations/2024-06-11-fix-reuse-datasets-references.py +0 -1
- udata/models/__init__.py +1 -0
- udata/routing.py +5 -0
- udata/search/commands.py +1 -1
- udata/search/query.py +1 -1
- udata/sentry.py +11 -2
- udata/settings.py +1 -0
- udata/tags.py +3 -3
- udata/tests/api/test_base_api.py +1 -1
- udata/tests/api/test_contact_points.py +4 -4
- udata/tests/api/test_datasets_api.py +10 -10
- udata/tests/api/test_organizations_api.py +39 -39
- udata/tests/api/test_reports_api.py +53 -3
- udata/tests/api/test_tags_api.py +2 -2
- udata/tests/api/test_transfer_api.py +1 -1
- udata/tests/apiv2/test_datasets.py +4 -4
- udata/tests/dataset/test_dataset_model.py +3 -3
- udata/tests/frontend/__init__.py +0 -2
- udata/tests/frontend/test_auth.py +0 -1
- udata/tests/organization/test_csv_adapter.py +0 -2
- udata/tests/organization/test_notifications.py +3 -3
- udata/tests/reuse/test_reuse_model.py +0 -1
- udata/tests/site/test_site_rdf.py +1 -3
- udata/tests/test_cors.py +0 -3
- udata/tests/test_owned.py +4 -4
- udata/tests/test_routing.py +1 -1
- udata/tests/test_tags.py +1 -1
- udata/tests/test_transfer.py +1 -2
- udata/tests/workers/test_jobs_commands.py +1 -1
- udata/utils.py +15 -14
- {udata-9.1.2.dev30754.dist-info → udata-9.1.4.dev30983.dist-info}/METADATA +20 -4
- {udata-9.1.2.dev30754.dist-info → udata-9.1.4.dev30983.dist-info}/RECORD +88 -89
- udata/commands/tests/fixtures.py +0 -44
- udata/tests/features/territories/commands.py +0 -9
- {udata-9.1.2.dev30754.dist-info → udata-9.1.4.dev30983.dist-info}/LICENSE +0 -0
- {udata-9.1.2.dev30754.dist-info → udata-9.1.4.dev30983.dist-info}/WHEEL +0 -0
- {udata-9.1.2.dev30754.dist-info → udata-9.1.4.dev30983.dist-info}/entry_points.txt +0 -0
- {udata-9.1.2.dev30754.dist-info → udata-9.1.4.dev30983.dist-info}/top_level.txt +0 -0
udata/tests/test_tags.py
CHANGED
|
@@ -38,7 +38,7 @@ class TagsTests:
|
|
|
38
38
|
rows = list(reader)
|
|
39
39
|
|
|
40
40
|
assert header == ["name", "datasets", "reuses", "total"]
|
|
41
|
-
assert len(rows)
|
|
41
|
+
assert len(rows) == 3
|
|
42
42
|
assert rows[0] == ["both", "15", "10", "25"]
|
|
43
43
|
assert rows[1] == ["datasets-only", "15", "0", "15"]
|
|
44
44
|
assert rows[2] == ["reuses-only", "0", "10", "10"]
|
udata/tests/test_transfer.py
CHANGED
|
@@ -13,8 +13,7 @@ from udata.core.user.metrics import (
|
|
|
13
13
|
from udata.features.transfer.actions import accept_transfer, request_transfer
|
|
14
14
|
from udata.features.transfer.factories import TransferFactory
|
|
15
15
|
from udata.features.transfer.notifications import transfer_request_notifications
|
|
16
|
-
from udata.models import
|
|
17
|
-
from udata.tests.helpers import assert_emit
|
|
16
|
+
from udata.models import Member
|
|
18
17
|
from udata.utils import faker
|
|
19
18
|
|
|
20
19
|
pytestmark = pytest.mark.usefixtures("clean_db")
|
|
@@ -101,7 +101,7 @@ class JobsCommandsTest:
|
|
|
101
101
|
]
|
|
102
102
|
result = cli("job scheduled")
|
|
103
103
|
|
|
104
|
-
filtered = [
|
|
104
|
+
filtered = [line for line in result.output.splitlines() if "Tip" not in line]
|
|
105
105
|
assert len(filtered) == len(tasks)
|
|
106
106
|
|
|
107
107
|
assert "not-scheduled" not in result.output
|
udata/utils.py
CHANGED
|
@@ -3,6 +3,7 @@ import math
|
|
|
3
3
|
import re
|
|
4
4
|
from datetime import date, datetime
|
|
5
5
|
from math import ceil
|
|
6
|
+
from typing import Any
|
|
6
7
|
from uuid import UUID, uuid4
|
|
7
8
|
from xml.sax.saxutils import escape
|
|
8
9
|
|
|
@@ -120,7 +121,7 @@ def daterange_start(value):
|
|
|
120
121
|
return result.replace(day=1, month=1)
|
|
121
122
|
|
|
122
123
|
|
|
123
|
-
def daterange_end(value):
|
|
124
|
+
def daterange_end(value: date | datetime | str | None) -> date | None:
|
|
124
125
|
"""Parse a date range end boundary"""
|
|
125
126
|
if not value:
|
|
126
127
|
return None
|
|
@@ -143,7 +144,7 @@ def daterange_end(value):
|
|
|
143
144
|
return result.replace(month=12, day=31)
|
|
144
145
|
|
|
145
146
|
|
|
146
|
-
def to_naive_datetime(given_date):
|
|
147
|
+
def to_naive_datetime(given_date: Any) -> datetime:
|
|
147
148
|
if isinstance(given_date, str):
|
|
148
149
|
given_date = parse_dt(given_date)
|
|
149
150
|
if isinstance(given_date, date) and not isinstance(given_date, datetime):
|
|
@@ -153,7 +154,7 @@ def to_naive_datetime(given_date):
|
|
|
153
154
|
return given_date
|
|
154
155
|
|
|
155
156
|
|
|
156
|
-
def to_iso(dt):
|
|
157
|
+
def to_iso(dt: date | datetime) -> str | None:
|
|
157
158
|
"""
|
|
158
159
|
Format a date or datetime into an ISO-8601 string
|
|
159
160
|
|
|
@@ -165,7 +166,7 @@ def to_iso(dt):
|
|
|
165
166
|
return to_iso_date(dt)
|
|
166
167
|
|
|
167
168
|
|
|
168
|
-
def to_iso_date(dt):
|
|
169
|
+
def to_iso_date(dt: date | datetime) -> str | None:
|
|
169
170
|
"""
|
|
170
171
|
Format a date or datetime into an ISO-8601 date string.
|
|
171
172
|
|
|
@@ -175,7 +176,7 @@ def to_iso_date(dt):
|
|
|
175
176
|
return "{dt.year:04d}-{dt.month:02d}-{dt.day:02d}".format(dt=dt)
|
|
176
177
|
|
|
177
178
|
|
|
178
|
-
def to_iso_datetime(dt):
|
|
179
|
+
def to_iso_datetime(dt: date | datetime) -> str | None:
|
|
179
180
|
"""
|
|
180
181
|
Format a date or datetime into an ISO-8601 datetime string.
|
|
181
182
|
|
|
@@ -193,7 +194,7 @@ def to_iso_datetime(dt):
|
|
|
193
194
|
return "T".join((date_str, time_str))
|
|
194
195
|
|
|
195
196
|
|
|
196
|
-
def to_bool(value):
|
|
197
|
+
def to_bool(value: bool | str | int) -> bool:
|
|
197
198
|
"""
|
|
198
199
|
Transform a value into a boolean with the following rules:
|
|
199
200
|
|
|
@@ -212,24 +213,24 @@ def to_bool(value):
|
|
|
212
213
|
return False
|
|
213
214
|
|
|
214
215
|
|
|
215
|
-
def clean_string(value):
|
|
216
|
+
def clean_string(value: str):
|
|
216
217
|
"""
|
|
217
218
|
Clean an user input string (Prevent it from containing XSS)
|
|
218
219
|
"""
|
|
219
220
|
return escape(value)
|
|
220
221
|
|
|
221
222
|
|
|
222
|
-
def not_none_dict(d):
|
|
223
|
+
def not_none_dict(d: dict) -> dict:
|
|
223
224
|
"""Filter out None values from a dict"""
|
|
224
225
|
return {k: v for k, v in d.items() if v is not None}
|
|
225
226
|
|
|
226
227
|
|
|
227
|
-
def hash_url(url):
|
|
228
|
+
def hash_url(url: str) -> str | None:
|
|
228
229
|
"""Hash an URL to make it indexable"""
|
|
229
230
|
return hashlib.sha1(url.encode("utf-8")).hexdigest() if url else None
|
|
230
231
|
|
|
231
232
|
|
|
232
|
-
def recursive_get(obj, key):
|
|
233
|
+
def recursive_get(obj: Any, key: Any):
|
|
233
234
|
"""
|
|
234
235
|
Get an attribute or a key recursively.
|
|
235
236
|
|
|
@@ -249,14 +250,14 @@ def recursive_get(obj, key):
|
|
|
249
250
|
return recursive_get(value, parts) if parts else value
|
|
250
251
|
|
|
251
252
|
|
|
252
|
-
def unique_string(length=UUID_LENGTH):
|
|
253
|
+
def unique_string(length: int = UUID_LENGTH) -> str:
|
|
253
254
|
"""Generate a unique string"""
|
|
254
255
|
# We need a string at least as long as length
|
|
255
256
|
string = str(uuid4()) * int(math.ceil(length / float(UUID_LENGTH)))
|
|
256
257
|
return string[:length] if length else string
|
|
257
258
|
|
|
258
259
|
|
|
259
|
-
def is_uuid(uuid_string, version=4):
|
|
260
|
+
def is_uuid(uuid_string: str, version: int = 4) -> bool:
|
|
260
261
|
try:
|
|
261
262
|
# If uuid_string is a valid hex code but not a valid uuid,
|
|
262
263
|
# UUID() will still make a valide uuid out of it.
|
|
@@ -290,7 +291,7 @@ class UDataProvider(BaseProvider):
|
|
|
290
291
|
Might be conributed to upstream Faker project
|
|
291
292
|
"""
|
|
292
293
|
|
|
293
|
-
def unique_string(self, length=UUID_LENGTH):
|
|
294
|
+
def unique_string(self, length: int = UUID_LENGTH) -> str:
|
|
294
295
|
"""Generate a unique string"""
|
|
295
296
|
return unique_string(length)
|
|
296
297
|
|
|
@@ -302,7 +303,7 @@ class UnicodeLoremProvider(LoremProvider):
|
|
|
302
303
|
word_list = [w + "é" for w in LoremProvider.word_list]
|
|
303
304
|
|
|
304
305
|
|
|
305
|
-
def safe_unicode(string):
|
|
306
|
+
def safe_unicode(string: bytes) -> str | None:
|
|
306
307
|
"""Safely transform any object into utf8 decoded str"""
|
|
307
308
|
if string is None:
|
|
308
309
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 9.1.
|
|
3
|
+
Version: 9.1.4.dev30983
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -39,7 +39,7 @@ Requires-Dist: celery ==5.3.1
|
|
|
39
39
|
Requires-Dist: celerybeat-mongo ==0.2.0
|
|
40
40
|
Requires-Dist: certifi ==2024.7.4
|
|
41
41
|
Requires-Dist: cffi ==1.16.0
|
|
42
|
-
Requires-Dist:
|
|
42
|
+
Requires-Dist: charset-normalizer ==3.3.2
|
|
43
43
|
Requires-Dist: click ==8.1.2
|
|
44
44
|
Requires-Dist: click-didyoumean ==0.3.1
|
|
45
45
|
Requires-Dist: click-plugins ==1.1.1
|
|
@@ -96,9 +96,10 @@ Requires-Dist: rdflib ==6.0.0
|
|
|
96
96
|
Requires-Dist: redis ==4.5.2
|
|
97
97
|
Requires-Dist: referencing ==0.35.1
|
|
98
98
|
Requires-Dist: regex ==2024.5.15
|
|
99
|
-
Requires-Dist: requests ==2.
|
|
99
|
+
Requires-Dist: requests ==2.32.3
|
|
100
100
|
Requires-Dist: rpds-py ==0.19.0
|
|
101
101
|
Requires-Dist: s3transfer ==0.6.2
|
|
102
|
+
Requires-Dist: sentry-sdk[flask] ==2.9.0
|
|
102
103
|
Requires-Dist: six ==1.16.0
|
|
103
104
|
Requires-Dist: speaklater ==1.3
|
|
104
105
|
Requires-Dist: stringdist ==1.0.9
|
|
@@ -108,7 +109,7 @@ Requires-Dist: tzdata ==2024.1
|
|
|
108
109
|
Requires-Dist: unidecode ==0.4.21
|
|
109
110
|
Requires-Dist: uritools ==4.0.3
|
|
110
111
|
Requires-Dist: urlextract ==0.14.0
|
|
111
|
-
Requires-Dist: urllib3 ==1.
|
|
112
|
+
Requires-Dist: urllib3 ==1.26.19
|
|
112
113
|
Requires-Dist: vine ==5.1.0
|
|
113
114
|
Requires-Dist: voluptuous ==0.11.7
|
|
114
115
|
Requires-Dist: wcwidth ==0.2.13
|
|
@@ -139,6 +140,19 @@ It is collectively taken care of by members of the
|
|
|
139
140
|
|
|
140
141
|
## Current (in progress)
|
|
141
142
|
|
|
143
|
+
- Fix many linting issues reported by ruff [#3118](https://github.com/opendatateam/udata/pull/3118)
|
|
144
|
+
|
|
145
|
+
## 9.1.3 (2024-08-01)
|
|
146
|
+
|
|
147
|
+
- Adds latest `sentry-sdk[flask]` as an install dependency, and update Sentry logic to be able to send environment, app version and profiling/performance info [#3086](https://github.com/opendatateam/udata/pull/3086)
|
|
148
|
+
- Add report get endpoint and make report get and list admin only [#3115](https://github.com/opendatateam/udata/pull/3115)
|
|
149
|
+
- Fix the version of udata-fixtures used by `udata import-fixtures` [#3114](https://github.com/opendatateam/udata/pull/3114)
|
|
150
|
+
- Update to the version v2.0.0 of udata-fixtures (with the dataservices)
|
|
151
|
+
- Add type hints [#3111](https://github.com/opendatateam/udata/pull/3111)
|
|
152
|
+
- Make sure requests v2.32.3 is used everywhere consistently [#3116](https://github.com/opendatateam/udata/pull/3116)
|
|
153
|
+
|
|
154
|
+
## 9.1.2 (2024-07-29)
|
|
155
|
+
|
|
142
156
|
- Add a `archived` field for reuses [#3088](https://github.com/opendatateam/udata/pull/3088)
|
|
143
157
|
- Add linter and formatter with `pyproject.toml` config, add lint and formatting step in CI, add pre-commit hook to lint and format, update docs and lint and format the code [#3085](https://github.com/opendatateam/udata/pull/3085)
|
|
144
158
|
- Revamp CORS: remove flask-cors to always returns 204 on OPTIONS request [#3074](https://github.com/opendatateam/udata/pull/3074)
|
|
@@ -149,6 +163,8 @@ It is collectively taken care of by members of the
|
|
|
149
163
|
- Add a warning on harvest source deletion [#3098](https://github.com/opendatateam/udata/pull/3098)
|
|
150
164
|
- Fix license in dataservices API (now returns ID instead of title) [#3097](https://github.com/opendatateam/udata/pull/3097)
|
|
151
165
|
- Fix missing title on new dataset preview [#3100](https://github.com/opendatateam/udata/pull/3100)
|
|
166
|
+
- Fix the fixtures tests which was not running, and then was failing [#3105](https://github.com/opendatateam/udata/pull/3105)
|
|
167
|
+
- Refactoring of the fixtures, the `generate-fixtures` command has been renamed to `import-fixtures` [#3106](https://github.com/opendatateam/udata/pull/3106)
|
|
152
168
|
|
|
153
169
|
## 9.1.1 (2024-07-16)
|
|
154
170
|
|