oarepo-runtime 1.5.17__py3-none-any.whl → 1.5.18__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,9 +7,10 @@ from oarepo_runtime.cli import oarepo
7
7
  from oarepo_runtime.datastreams import SynchronousDataStream
8
8
  from oarepo_runtime.datastreams.asynchronous import AsynchronousDataStream
9
9
  from oarepo_runtime.datastreams.fixtures import (
10
+ FixturesCallback,
10
11
  dump_fixtures,
11
12
  fixtures_asynchronous_callback,
12
- load_fixtures, FixturesCallback,
13
+ load_fixtures,
13
14
  )
14
15
  from oarepo_runtime.datastreams.types import StatsKeepingDataStreamCallback
15
16
 
@@ -33,11 +34,7 @@ def fixtures():
33
34
  help="Size for bulk indexing - this number of records "
34
35
  "will be committed in a single transaction and indexed together",
35
36
  )
36
- @click.option(
37
- "--batch-size",
38
- help="Alias for --bulk-size",
39
- type=int
40
- )
37
+ @click.option("--batch-size", help="Alias for --bulk-size", type=int)
41
38
  @with_appcontext
42
39
  def load(
43
40
  fixture_dir=None,
@@ -47,7 +44,7 @@ def load(
47
44
  verbose=False,
48
45
  bulk_size=100,
49
46
  on_background=False,
50
- batch_size=None
47
+ batch_size=None,
51
48
  ):
52
49
  """Loads fixtures"""
53
50
  if batch_size:
@@ -104,7 +101,7 @@ def _show_stats(callback: StatsKeepingDataStreamCallback, title: str):
104
101
 
105
102
 
106
103
  class TQDMCallback(FixturesCallback):
107
- def __init__(self, message_prefix = 'Loading ', verbose=False):
104
+ def __init__(self, message_prefix="Loading ", verbose=False):
108
105
  super().__init__()
109
106
  self._tqdm = tqdm.tqdm(unit=" item(s)")
110
107
  self._message_prefix = message_prefix
@@ -1,13 +1,13 @@
1
1
  import sys
2
+ from io import StringIO
2
3
 
3
4
  import click
5
+ import yaml
4
6
  from flask.cli import with_appcontext
5
7
  from invenio_db import db
6
8
  from invenio_records_resources.proxies import current_service_registry
7
9
  from invenio_search.proxies import current_search
8
10
  from werkzeug.utils import ImportStringError, import_string
9
- from io import StringIO
10
- import yaml
11
11
 
12
12
  try:
13
13
  from tqdm import tqdm
@@ -152,15 +152,25 @@ def reindex(model, bulk_size, verbose):
152
152
  index_result = service.indexer.client.bulk(bulk)
153
153
  count += len(bulk) // 2
154
154
 
155
- for index_item_result in index_result['items']:
156
- result = index_item_result['index']
157
- if result['status'] != 200:
155
+ for index_item_result in index_result["items"]:
156
+ result = index_item_result["index"]
157
+ if result["status"] != 200:
158
158
  errors += 1
159
- click.secho(f"Error indexing record with id {result['_id']}", fg="red", file=sys.stderr)
160
- click.secho(dump_yaml(result.get('error')), fg="red", file=sys.stderr)
159
+ click.secho(
160
+ f"Error indexing record with id {result['_id']}",
161
+ fg="red",
162
+ file=sys.stderr,
163
+ )
164
+ click.secho(
165
+ dump_yaml(result.get("error")), fg="red", file=sys.stderr
166
+ )
161
167
  if verbose:
162
168
  click.secho("Record:", file=sys.stderr)
163
- rec = [bulk[idx+1] for idx in range(0, len(bulk), 2) if bulk[idx]['index']['_id'] == result['_id']]
169
+ rec = [
170
+ bulk[idx + 1]
171
+ for idx in range(0, len(bulk), 2)
172
+ if bulk[idx]["index"]["_id"] == result["_id"]
173
+ ]
164
174
  if rec:
165
175
  click.secho(dump_yaml(rec[0]))
166
176
  else:
@@ -204,4 +214,4 @@ def generate_bulk_data(record_generator, record_indexer, bulk_size):
204
214
  def dump_yaml(data):
205
215
  io = StringIO()
206
216
  yaml.dump(data, io, allow_unicode=True)
207
- return io.getvalue()
217
+ return io.getvalue()
@@ -27,7 +27,6 @@ class FixturesCallback(StatsKeepingDataStreamCallback):
27
27
  pass
28
28
 
29
29
 
30
-
31
30
  def load_fixtures(
32
31
  fixture_dir=None,
33
32
  include=None,
@@ -32,6 +32,7 @@ def get_record_service_for_record(record):
32
32
  if service_record == type(record):
33
33
  return svc
34
34
 
35
+
35
36
  def get_file_service_for_record_class(record_class):
36
37
  if not record_class:
37
38
  return None
oarepo_runtime/ext.py CHANGED
@@ -28,9 +28,9 @@ class OARepoRuntime(object):
28
28
 
29
29
  for k in ext_config.OAREPO_PERMISSIONS_PRESETS:
30
30
  if k not in app.config["OAREPO_PERMISSIONS_PRESETS"]:
31
- app.config["OAREPO_PERMISSIONS_PRESETS"][k] = (
32
- ext_config.OAREPO_PERMISSIONS_PRESETS[k]
33
- )
31
+ app.config["OAREPO_PERMISSIONS_PRESETS"][
32
+ k
33
+ ] = ext_config.OAREPO_PERMISSIONS_PRESETS[k]
34
34
 
35
35
  for k in dir(ext_config):
36
36
  if k == "DEFAULT_DATASTREAMS_EXCLUDES":
@@ -94,6 +94,7 @@ class SyntheticSystemField(MappingSystemFieldMixin, SystemField):
94
94
  remove_key(d[key[0]], key[1:])
95
95
  if not d[key[0]]:
96
96
  d.pop(key[0])
97
+
97
98
  remove_key(data, self.key.split("."))
98
99
 
99
100
  def __get__(self, record, owner=None):
@@ -1,5 +1,9 @@
1
- from .permissions_presets import (OaiHarvesterPermissionPolicy, ReadOnlyPermissionPolicy, EveryonePermissionPolicy,
2
- AuthenticatedPermissionPolicy)
1
+ from .permissions_presets import (
2
+ AuthenticatedPermissionPolicy,
3
+ EveryonePermissionPolicy,
4
+ OaiHarvesterPermissionPolicy,
5
+ ReadOnlyPermissionPolicy,
6
+ )
3
7
  from .service import PermissionsPresetsConfigMixin, UserWithRole
4
8
 
5
9
  __all__ = (
@@ -9,4 +13,4 @@ __all__ = (
9
13
  "ReadOnlyPermissionPolicy",
10
14
  "EveryonePermissionPolicy",
11
15
  "AuthenticatedPermissionPolicy",
12
- )
16
+ )
@@ -7,9 +7,9 @@ from flask_principal import RoleNeed
7
7
  from invenio_accounts.models import User
8
8
  from invenio_records_permissions import BasePermissionPolicy
9
9
  from invenio_records_permissions.generators import Generator
10
+ from invenio_search.engine import dsl
10
11
 
11
12
  from oarepo_runtime.utils.functools import class_property
12
- from invenio_search.engine import dsl
13
13
 
14
14
 
15
15
  class PermissionsPresetsConfigMixin:
@@ -88,10 +88,18 @@ class LocalizedEDTF(LocalizedMixin, MultilayerFormatEDTF):
88
88
  pass
89
89
 
90
90
 
91
+ class LocalizedEDTFTime(LocalizedMixin, MultilayerFormatEDTF):
92
+ pass
93
+
94
+
91
95
  class LocalizedEDTFInterval(LocalizedMixin, FormatEDTF):
92
96
  pass
93
97
 
94
98
 
99
+ class LocalizedEDTFTimeInterval(LocalizedMixin, FormatEDTF):
100
+ pass
101
+
102
+
95
103
  class PrefixedGettextField(BabelGettextDictField):
96
104
  def __init__(self, *, value_prefix, locale, default_locale, **kwargs):
97
105
  super().__init__(locale, default_locale, **kwargs)
@@ -9,7 +9,6 @@ def try_sequence(*funcs, ignored_exceptions=(), raised_exception=Exception):
9
9
 
10
10
 
11
11
  class class_property:
12
-
13
12
  def __init__(self, getter=None, setter=None):
14
13
  if getter is not None and not isinstance(getter, classmethod):
15
14
  getter = classmethod(getter)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oarepo-runtime
3
- Version: 1.5.17
3
+ Version: 1.5.18
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -1,5 +1,5 @@
1
1
  oarepo_runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- oarepo_runtime/ext.py,sha256=XPEEg1fDDAC6uihCM3ASbKmkgdL050lg9qTdrqqbI4A,1959
2
+ oarepo_runtime/ext.py,sha256=6aYy1zbNDHBn4rNDo_v4xuUteyhbGAAoVtp6rtkxe20,1957
3
3
  oarepo_runtime/ext_config.py,sha256=c9q8zc78bjBosv1lbHGfenX2S6L-_9v0RZeQjbczvdI,1941
4
4
  oarepo_runtime/profile.py,sha256=QzrQoZncjoN74ZZnpkEKakNk08KCzBU7m6y42RN8AMY,1637
5
5
  oarepo_runtime/proxies.py,sha256=IuwZDwEqRcKxdqNdMrlSzOSiYjtWyJIgvg4zbFTWI8I,207
@@ -10,8 +10,8 @@ oarepo_runtime/cli/base.py,sha256=94RBTa8TOSPxEyEUmYLGXaWen-XktP2-MIbTtZSlCZo,54
10
10
  oarepo_runtime/cli/cf.py,sha256=W0JEJK2JqKubQw8qtZJxohmADDRUBode4JZAqYLDGvc,339
11
11
  oarepo_runtime/cli/check.py,sha256=AvC5VHAnwmtCd8R-Caj8v6nCAREKjObTdNtLJ24aJO8,4935
12
12
  oarepo_runtime/cli/configuration.py,sha256=cLXoGDtjuA5uv9ZfYFcH0C4wcadj0qWC3P_E4Bf5-z0,1061
13
- oarepo_runtime/cli/fixtures.py,sha256=RgjXVRLSVwa9spDsuwzMJFiaXwAS_aeiVOWd_vZeCVE,4413
14
- oarepo_runtime/cli/index.py,sha256=9sE_YZSOYPj130_kIOVTa5ufAZfNncWS7Lmuvk3JhnY,6945
13
+ oarepo_runtime/cli/fixtures.py,sha256=bN054QERsMAvkyqVoyPCZYI5D4KajAK8cqK-jtlK6lQ,4402
14
+ oarepo_runtime/cli/index.py,sha256=H4nSZnClnlCSI8Thlz_jx-uPpgNVVQyagpWIPtQoIr4,7239
15
15
  oarepo_runtime/cli/validate.py,sha256=HpSvHQCGHlrdgdpKix9cIlzlBoJEiT1vACZdMnOUGEY,2827
16
16
  oarepo_runtime/datastreams/__init__.py,sha256=_i52Ek9J8DMARST0ejZAZPzUKm55xrrlKlCSO7dl6y4,1008
17
17
  oarepo_runtime/datastreams/asynchronous.py,sha256=1I1mEaTxyrcHD7LK6O9z2QX37AgeejflxynGmLreLQ0,7396
@@ -19,13 +19,13 @@ oarepo_runtime/datastreams/catalogue.py,sha256=D6leq-FPT3RP3SniEAXPm66v3q8ZdQnaU
19
19
  oarepo_runtime/datastreams/datastreams.py,sha256=wnMk1UFv-cWXRO0jHwRNoJBO0cbZaHqrLnH7vgfnf78,4485
20
20
  oarepo_runtime/datastreams/errors.py,sha256=WyZLU53EdFJTLv6K2ooM_M6ISjLS-U1dDw6B7guOLSc,1540
21
21
  oarepo_runtime/datastreams/ext.py,sha256=ivugdVMCqwugK-5SeX14a-dMq6VaTt7DM2wFU357tR4,1406
22
- oarepo_runtime/datastreams/fixtures.py,sha256=qoULiMyMzyFLlO3TZiqgYV9MvtzpWA0dv1S_Uriu1_Y,8493
22
+ oarepo_runtime/datastreams/fixtures.py,sha256=VJWK4LcjBlYFRHZyhwq28qsrxO4ADbc9AGuwBh2oS4I,8492
23
23
  oarepo_runtime/datastreams/json.py,sha256=OAiaH93eqpH5qNQSPKKc8K-hXKAn5lB0PUKwwZFqJSw,153
24
24
  oarepo_runtime/datastreams/semi_asynchronous.py,sha256=TJWby2MDKXm5feRocoWB-8OhsShq5R9HoZ74O1rGBOk,2934
25
25
  oarepo_runtime/datastreams/synchronous.py,sha256=t5lfnMkLqy3jK5zMl-nIuA0HlMPiHGjwCqZ8XQP-3GM,2595
26
26
  oarepo_runtime/datastreams/transformers.py,sha256=q5KzHPl2kJg7HP1BtKJ7F_UMqg_7L1ZGDX0O7s8D6UI,521
27
27
  oarepo_runtime/datastreams/types.py,sha256=KZjblc3T_UFFW7LrMDmiR8lqVf86V484LAHj6yg05EI,9908
28
- oarepo_runtime/datastreams/utils.py,sha256=QIqIfzKiGh2cIRTr3vKWB4ZYsB9AYjlSyFFFGoyBoEo,3498
28
+ oarepo_runtime/datastreams/utils.py,sha256=Dg2q11YC8dQ4WNoHteI6dXlD-qChYucJrP6XR5oyxUE,3499
29
29
  oarepo_runtime/datastreams/readers/__init__.py,sha256=P1n3llZQ3AFHnSPbeT1VaCJcEtRFz9AbHfjkZv5LG7s,1103
30
30
  oarepo_runtime/datastreams/readers/attachments.py,sha256=A7EC1TqyTHG-go5DIaRotlBSOm6o9hGqAKyVVAceCRU,1956
31
31
  oarepo_runtime/datastreams/readers/excel.py,sha256=CM8lr8mejN7NgoK5TJb1oXpjq0HxklQKMsuj3uqjTjA,3653
@@ -60,16 +60,16 @@ oarepo_runtime/records/systemfields/icu.py,sha256=tAwplzy9y7C9Dm7HqcGZsDu2AKqVGX
60
60
  oarepo_runtime/records/systemfields/mapping.py,sha256=tXOK_jkdY1pOUO7_VfChfDNB8UTi21GUXaidpugTnO8,1017
61
61
  oarepo_runtime/records/systemfields/record_status.py,sha256=U3kem4-JkNsT17e0iAl3HIAZ2MvO5lY_0U757aZvTKE,935
62
62
  oarepo_runtime/records/systemfields/selectors.py,sha256=VlbV3FKP2h3PLU7H4-YsI4qrb0UO_SrhJ2dcsTBGoqI,900
63
- oarepo_runtime/records/systemfields/synthetic.py,sha256=dAhmcEMpCmQpWJ8Xa9zeCQjd07LRtZ5l6u5wQa1i7qg,4237
63
+ oarepo_runtime/records/systemfields/synthetic.py,sha256=zRsQdekcgsrD9R2UuI2kgVLjyQMIT8j3HAYav_e-xfM,4238
64
64
  oarepo_runtime/resources/__init__.py,sha256=v8BGrOTu_FjKzd0eozV7Q4GoGxyfybsL2cI-tbP5Pys,185
65
65
  oarepo_runtime/resources/file_resource.py,sha256=Ta3bFce7l0xwqkkOMOEu9mxbB8BbKj5HUHRHmidhnl8,414
66
66
  oarepo_runtime/resources/localized_ui_json_serializer.py,sha256=4Kle34k-_uu3Y9JJ2vAXcQ9DqYRxXgy-_iZhiFuukmE,1684
67
67
  oarepo_runtime/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
68
  oarepo_runtime/services/results.py,sha256=F3A0U3MRUOYlxNglJPQeGMKdD8QNq1il106jQZ0c9gQ,1499
69
69
  oarepo_runtime/services/search.py,sha256=ywfwGH7oAM44WeOSjlIsY_qoCMZJ1TlTLd_NgE2ow3Y,5296
70
- oarepo_runtime/services/config/__init__.py,sha256=x-i1QAzvGbNtEhCmxc53-zpHuax_88Yn8LTbclvyN2U,454
70
+ oarepo_runtime/services/config/__init__.py,sha256=SCqww5sV8qh3gmev6TE8EyJbD58juIEDCm_7MEHxtSg,440
71
71
  oarepo_runtime/services/config/permissions_presets.py,sha256=zApeA-2DYAlD--SzVz3vq_OFjq48Ko0pe08e4o2vxr4,6114
72
- oarepo_runtime/services/config/service.py,sha256=CLxroGdzDq8MHcrQVYDoaFMYfPSXTw8qyQUSoqvI4_A,4668
72
+ oarepo_runtime/services/config/service.py,sha256=2aq5jobPH22T1QqlJDommvAxJwo9aQGiqK5q-k-l9CA,4668
73
73
  oarepo_runtime/services/custom_fields/__init__.py,sha256=xJ7XEyMJHPfIgX5JKpgpwh7SYc9Zee2dC5oC8cm99Qc,2282
74
74
  oarepo_runtime/services/custom_fields/mappings.py,sha256=1mb8nYeUlQxbBolsKURGKUIpIV1NDb-7Mcur32jjIjg,4433
75
75
  oarepo_runtime/services/expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -96,7 +96,7 @@ oarepo_runtime/services/schema/i18n_ui.py,sha256=18tA6uA067TP_wcit47hTel2M4hz88w
96
96
  oarepo_runtime/services/schema/i18n_validation.py,sha256=fyMTi2Rw-KiHv7c7HN61zGxRVa9sAjAEEkAL5wUyKNo,236
97
97
  oarepo_runtime/services/schema/marshmallow.py,sha256=LmcSxvbZ9jIhkNHCqqxt1SA2UNijoDmIzqli1MkoTrE,1153
98
98
  oarepo_runtime/services/schema/polymorphic.py,sha256=CkvXVUiXbrsLWFgoNnjjpUviQyzRMCmpsD3GWfV0WZA,494
99
- oarepo_runtime/services/schema/ui.py,sha256=_pUju7inYW-nx0h8NjjxraKTtOUn2aIxvUHzzC8BbRI,3517
99
+ oarepo_runtime/services/schema/ui.py,sha256=caRca4vuUVoLew3gkhbPQYGaLXB8C67E5jxz45-9zkE,3663
100
100
  oarepo_runtime/services/schema/validation.py,sha256=fahqKGDdIYWux5ZeoljrEe8VD2fDZR9VpfvYmTYAmpw,1050
101
101
  oarepo_runtime/translations/default_translations.py,sha256=060GBlA1ghWxfeumo6NqxCCZDb-6OezOuF6pr-_GEOQ,104
102
102
  oarepo_runtime/translations/jinjax_messages.jinja,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -106,12 +106,12 @@ oarepo_runtime/translations/cs/LC_MESSAGES/messages.po,sha256=vGZQo5NlTtj_qsJuDw
106
106
  oarepo_runtime/translations/en/LC_MESSAGES/messages.mo,sha256=FKAl1wlg2NhtQ1-9U2dkUwcotR959j5GuUKJygCYpwI,445
107
107
  oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=rZ2PGvkcJbmuwrWeFX5edk0zJIzZnL83M9HSAceDP_U,1193
108
108
  oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
109
- oarepo_runtime/utils/functools.py,sha256=7V-aMkAscc5qyGawGS8jmwqfdW2Wpjxe-u8DKgB8meI,1325
109
+ oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
110
110
  oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
111
111
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
112
- oarepo_runtime-1.5.17.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
113
- oarepo_runtime-1.5.17.dist-info/METADATA,sha256=DrdItxPYAcwwVGuWYgSVCh-ilNmIol5REtQxmPpY5X8,4680
114
- oarepo_runtime-1.5.17.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
115
- oarepo_runtime-1.5.17.dist-info/entry_points.txt,sha256=QrlXAKuPDVBinaSh_v3yO9_Nb9ZNmJCJ0VFcCW-z0Jg,327
116
- oarepo_runtime-1.5.17.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
117
- oarepo_runtime-1.5.17.dist-info/RECORD,,
112
+ oarepo_runtime-1.5.18.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
113
+ oarepo_runtime-1.5.18.dist-info/METADATA,sha256=nMaWGNxfX-RGlvBDX_kaOKGy_n8UjHxTjOzlFeCATpw,4680
114
+ oarepo_runtime-1.5.18.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
115
+ oarepo_runtime-1.5.18.dist-info/entry_points.txt,sha256=QrlXAKuPDVBinaSh_v3yO9_Nb9ZNmJCJ0VFcCW-z0Jg,327
116
+ oarepo_runtime-1.5.18.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
117
+ oarepo_runtime-1.5.18.dist-info/RECORD,,