udata 9.1.3.dev30862__py2.py3-none-any.whl → 9.1.3.dev30920__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/api_fields.py +1 -1
- udata/assets.py +1 -1
- udata/commands/fixtures.py +2 -3
- udata/core/dataset/actions.py +2 -2
- 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/static/chunks/{10.c1c9496ebfc8949f3de2.js → 10.1d9b1714c0289863ba0a.js} +3 -3
- udata/static/chunks/{10.c1c9496ebfc8949f3de2.js.map → 10.1d9b1714c0289863ba0a.js.map} +1 -1
- udata/static/chunks/{11.16618d9eedd3f6a7a3c2.js → 11.4f679f86d5ffcd30c492.js} +3 -3
- udata/static/chunks/{11.16618d9eedd3f6a7a3c2.js.map → 11.4f679f86d5ffcd30c492.js.map} +1 -1
- udata/static/chunks/{13.9cfb8ee33c4d62e33f8a.js → 13.3b62c3f10e53ab2972ea.js} +2 -2
- udata/static/chunks/{13.9cfb8ee33c4d62e33f8a.js.map → 13.3b62c3f10e53ab2972ea.js.map} +1 -1
- udata/static/chunks/{16.d1de045f4bc4b5acdf6b.js → 16.82d786cba62daff0c9d7.js} +2 -2
- udata/static/chunks/{16.d1de045f4bc4b5acdf6b.js.map → 16.82d786cba62daff0c9d7.js.map} +1 -1
- udata/static/chunks/{19.f1ff6cd5816f2d9debc4.js → 19.e66777c7d9d8bd23931e.js} +3 -3
- udata/static/chunks/{19.f1ff6cd5816f2d9debc4.js.map → 19.e66777c7d9d8bd23931e.js.map} +1 -1
- udata/static/chunks/{8.b50a30118e9e2e1ab436.js → 8.0b473c6a35cc483ec333.js} +2 -2
- udata/static/chunks/{8.b50a30118e9e2e1ab436.js.map → 8.0b473c6a35cc483ec333.js.map} +1 -1
- udata/static/chunks/{9.8ad948dd393d38f07a7a.js → 9.5009f558f2268bbe4094.js} +3 -3
- udata/static/chunks/{9.8ad948dd393d38f07a7a.js.map → 9.5009f558f2268bbe4094.js.map} +1 -1
- udata/static/common.js +1 -1
- udata/static/common.js.map +1 -1
- udata/tags.py +3 -3
- udata/utils.py +15 -14
- {udata-9.1.3.dev30862.dist-info → udata-9.1.3.dev30920.dist-info}/METADATA +7 -3
- {udata-9.1.3.dev30862.dist-info → udata-9.1.3.dev30920.dist-info}/RECORD +33 -33
- {udata-9.1.3.dev30862.dist-info → udata-9.1.3.dev30920.dist-info}/LICENSE +0 -0
- {udata-9.1.3.dev30862.dist-info → udata-9.1.3.dev30920.dist-info}/WHEEL +0 -0
- {udata-9.1.3.dev30862.dist-info → udata-9.1.3.dev30920.dist-info}/entry_points.txt +0 -0
- {udata-9.1.3.dev30862.dist-info → udata-9.1.3.dev30920.dist-info}/top_level.txt +0 -0
tasks/helpers.py
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from os.path import abspath, dirname, join
|
|
2
|
+
from typing import Callable
|
|
2
3
|
|
|
3
4
|
#: Project absolute root path
|
|
4
5
|
ROOT = abspath(join(dirname(__file__), ".."))
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
def color(code):
|
|
8
|
+
def color(code: str) -> Callable:
|
|
8
9
|
"""A simple ANSI color wrapper factory"""
|
|
9
10
|
return lambda t: "\033[{0}{1}\033[0;m".format(code, t)
|
|
10
11
|
|
|
@@ -17,25 +18,25 @@ purple = color("1;35m")
|
|
|
17
18
|
white = color("1;39m")
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
def header(text, *args, **kwargs):
|
|
21
|
+
def header(text: str, *args, **kwargs) -> None:
|
|
21
22
|
"""Display an header"""
|
|
22
23
|
text = text.format(*args, **kwargs)
|
|
23
24
|
print(" ".join((blue(">>"), cyan(text))))
|
|
24
25
|
|
|
25
26
|
|
|
26
|
-
def info(text, *args, **kwargs):
|
|
27
|
+
def info(text: str, *args, **kwargs) -> None:
|
|
27
28
|
"""Display informations"""
|
|
28
29
|
text = text.format(*args, **kwargs)
|
|
29
30
|
print(" ".join((purple(">>>"), text)))
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
def success(text, *args, **kwargs):
|
|
33
|
+
def success(text: str, *args, **kwargs) -> None:
|
|
33
34
|
"""Display a success message"""
|
|
34
35
|
text = text.format(*args, **kwargs)
|
|
35
36
|
print(" ".join((green("✔"), white(text))))
|
|
36
37
|
|
|
37
38
|
|
|
38
|
-
def error(text, *args, **kwargs):
|
|
39
|
+
def error(text: str, *args, **kwargs) -> None:
|
|
39
40
|
"""Display an error message"""
|
|
40
41
|
text = text.format(*args, **kwargs)
|
|
41
42
|
print(red("✘ {0}".format(text)))
|
udata/api_fields.py
CHANGED
|
@@ -335,7 +335,7 @@ def wrap_primary_key(
|
|
|
335
335
|
field_name: str,
|
|
336
336
|
foreign_field: mongoengine.fields.ReferenceField | mongoengine.fields.GenericReferenceField,
|
|
337
337
|
value: str,
|
|
338
|
-
document_type
|
|
338
|
+
document_type=None,
|
|
339
339
|
):
|
|
340
340
|
"""
|
|
341
341
|
We need to wrap the `String` inside an `ObjectId` most of the time. If the foreign ID is a `String` we need to get
|
udata/assets.py
CHANGED
udata/commands/fixtures.py
CHANGED
|
@@ -39,7 +39,7 @@ COMMUNITY_RES_URL = "/api/1/datasets/community_resources"
|
|
|
39
39
|
DISCUSSION_URL = "/api/1/discussions"
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
DEFAULT_FIXTURE_FILE_TAG: str = "
|
|
42
|
+
DEFAULT_FIXTURE_FILE_TAG: str = "v2.0.0"
|
|
43
43
|
DEFAULT_FIXTURE_FILE: str = f"https://raw.githubusercontent.com/opendatateam/udata-fixtures/{DEFAULT_FIXTURE_FILE_TAG}/results.json" # noqa
|
|
44
44
|
|
|
45
45
|
DEFAULT_FIXTURES_RESULTS_FILENAME: str = "results.json"
|
|
@@ -198,8 +198,7 @@ def import_fixtures(source):
|
|
|
198
198
|
MessageDiscussionFactory(**message, posted_by=user) for message in messages
|
|
199
199
|
],
|
|
200
200
|
)
|
|
201
|
-
for dataservice in fixture
|
|
202
|
-
# We may be missing dataservices in older fixtures.
|
|
201
|
+
for dataservice in fixture["dataservices"]:
|
|
203
202
|
dataservice = remove_unwanted_keys(dataservice, "dataservice")
|
|
204
203
|
if not dataservice["contact_point"]:
|
|
205
204
|
DataserviceFactory(**dataservice, datasets=[dataset])
|
udata/core/dataset/actions.py
CHANGED
|
@@ -4,12 +4,12 @@ from datetime import datetime
|
|
|
4
4
|
from flask import current_app, render_template
|
|
5
5
|
|
|
6
6
|
from udata import i18n
|
|
7
|
-
from udata.models import Discussion, Message
|
|
7
|
+
from udata.models import Dataset, Discussion, Message
|
|
8
8
|
|
|
9
9
|
log = logging.getLogger(__name__)
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def archive(dataset, comment=False):
|
|
12
|
+
def archive(dataset: Dataset, comment=False) -> None:
|
|
13
13
|
"""Archive a dataset"""
|
|
14
14
|
if dataset.archived:
|
|
15
15
|
log.warning("Dataset %s already archived, bumping date", dataset)
|
udata/core/reuse/metrics.py
CHANGED
udata/core/reuse/permissions.py
CHANGED
|
@@ -3,10 +3,11 @@ from udata.core.organization.permissions import (
|
|
|
3
3
|
OrganizationAdminNeed,
|
|
4
4
|
OrganizationEditorNeed,
|
|
5
5
|
)
|
|
6
|
+
from udata.core.reuse.models import Reuse
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class ReuseEditPermission(Permission):
|
|
9
|
-
def __init__(self, reuse):
|
|
10
|
+
def __init__(self, reuse: Reuse) -> None:
|
|
10
11
|
needs = []
|
|
11
12
|
|
|
12
13
|
if reuse.organization:
|
udata/core/reuse/search.py
CHANGED
|
@@ -38,7 +38,7 @@ class ReuseSearch(ModelSearchAdapter):
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@classmethod
|
|
41
|
-
def is_indexable(cls, reuse):
|
|
41
|
+
def is_indexable(cls, reuse: Reuse) -> bool:
|
|
42
42
|
return reuse.deleted is None and len(reuse.datasets) > 0 and not reuse.private
|
|
43
43
|
|
|
44
44
|
@classmethod
|
|
@@ -55,7 +55,7 @@ class ReuseSearch(ModelSearchAdapter):
|
|
|
55
55
|
return reuses.order_by(sort).skip(offset).limit(args["page_size"]), reuses.count()
|
|
56
56
|
|
|
57
57
|
@classmethod
|
|
58
|
-
def serialize(cls, reuse):
|
|
58
|
+
def serialize(cls, reuse: Reuse) -> dict:
|
|
59
59
|
organization = None
|
|
60
60
|
owner = None
|
|
61
61
|
if reuse.organization:
|
udata/core/reuse/tasks.py
CHANGED
|
@@ -10,7 +10,7 @@ log = get_logger(__name__)
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
@job("purge-reuses")
|
|
13
|
-
def purge_reuses(self):
|
|
13
|
+
def purge_reuses(self) -> None:
|
|
14
14
|
for reuse in Reuse.objects(deleted__ne=None):
|
|
15
15
|
log.info(f"Purging reuse {reuse}")
|
|
16
16
|
# Remove followers
|
|
@@ -32,7 +32,7 @@ def purge_reuses(self):
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
@task
|
|
35
|
-
def notify_new_reuse(reuse_id):
|
|
35
|
+
def notify_new_reuse(reuse_id: int) -> None:
|
|
36
36
|
reuse = Reuse.objects.get(pk=reuse_id)
|
|
37
37
|
for dataset in reuse.datasets:
|
|
38
38
|
if dataset.organization:
|