udata 9.1.3.dev30883__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.

Files changed (26) hide show
  1. tasks/helpers.py +6 -5
  2. udata/api_fields.py +1 -1
  3. udata/assets.py +1 -1
  4. udata/core/dataset/actions.py +2 -2
  5. udata/core/reuse/metrics.py +1 -1
  6. udata/core/reuse/permissions.py +2 -1
  7. udata/core/reuse/search.py +2 -2
  8. udata/core/reuse/tasks.py +2 -2
  9. udata/static/chunks/{10.c1c9496ebfc8949f3de2.js → 10.1d9b1714c0289863ba0a.js} +3 -3
  10. udata/static/chunks/{10.c1c9496ebfc8949f3de2.js.map → 10.1d9b1714c0289863ba0a.js.map} +1 -1
  11. udata/static/chunks/{11.18f1cc16362b76373c40.js → 11.4f679f86d5ffcd30c492.js} +3 -3
  12. udata/static/chunks/{11.18f1cc16362b76373c40.js.map → 11.4f679f86d5ffcd30c492.js.map} +1 -1
  13. udata/static/chunks/{8.b50a30118e9e2e1ab436.js → 8.0b473c6a35cc483ec333.js} +2 -2
  14. udata/static/chunks/{8.b50a30118e9e2e1ab436.js.map → 8.0b473c6a35cc483ec333.js.map} +1 -1
  15. udata/static/chunks/{9.8ad948dd393d38f07a7a.js → 9.5009f558f2268bbe4094.js} +3 -3
  16. udata/static/chunks/{9.8ad948dd393d38f07a7a.js.map → 9.5009f558f2268bbe4094.js.map} +1 -1
  17. udata/static/common.js +1 -1
  18. udata/static/common.js.map +1 -1
  19. udata/tags.py +3 -3
  20. udata/utils.py +15 -14
  21. {udata-9.1.3.dev30883.dist-info → udata-9.1.3.dev30920.dist-info}/METADATA +5 -3
  22. {udata-9.1.3.dev30883.dist-info → udata-9.1.3.dev30920.dist-info}/RECORD +26 -26
  23. {udata-9.1.3.dev30883.dist-info → udata-9.1.3.dev30920.dist-info}/LICENSE +0 -0
  24. {udata-9.1.3.dev30883.dist-info → udata-9.1.3.dev30920.dist-info}/WHEEL +0 -0
  25. {udata-9.1.3.dev30883.dist-info → udata-9.1.3.dev30920.dist-info}/entry_points.txt +0 -0
  26. {udata-9.1.3.dev30883.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: type = None,
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
@@ -2,7 +2,7 @@ from flask import current_app, url_for
2
2
  from flask_cdn import url_for as cdn_url_for
3
3
 
4
4
 
5
- def cdn_for(endpoint, **kwargs):
5
+ def cdn_for(endpoint: str, **kwargs) -> str:
6
6
  """
7
7
  Get a CDN URL for a static assets.
8
8
 
@@ -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)
@@ -3,5 +3,5 @@ from udata.models import Reuse
3
3
 
4
4
  @Reuse.on_create.connect
5
5
  @Reuse.on_update.connect
6
- def update_reuses_dataset_metric(reuse, **kwargs):
6
+ def update_reuses_dataset_metric(reuse: Reuse, **kwargs) -> None:
7
7
  reuse.count_datasets()
@@ -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:
@@ -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: