oarepo-runtime 1.5.101__py3-none-any.whl → 1.5.102__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.
@@ -1,4 +1,5 @@
1
1
  import json
2
+ from collections.abc import Mapping, Sequence, Set
2
3
 
3
4
  import click
4
5
  from flask import current_app
@@ -7,14 +8,28 @@ from werkzeug.local import LocalProxy
7
8
 
8
9
  from .base import oarepo
9
10
 
11
+ def remove_lazy_objects(obj):
12
+ if isinstance(obj, Sequence):
13
+ if isinstance(obj, list):
14
+ return [remove_lazy_objects(item) for item in obj if not isinstance(item, LocalProxy)]
15
+ elif isinstance(obj, tuple):
16
+ return tuple(remove_lazy_objects(item) for item in obj if not isinstance(item, LocalProxy))
17
+ elif not isinstance(obj, LocalProxy):
18
+ return obj # strings, bytes, bytesarray etc.
19
+ elif isinstance(obj, Set):
20
+ if isinstance(obj, frozenset):
21
+ return frozenset(remove_lazy_objects(item) for item in obj if not isinstance(item, LocalProxy))
22
+ return {remove_lazy_objects(item) for item in obj if not isinstance(item, LocalProxy)}
23
+ elif isinstance(obj, Mapping):
24
+ return {k: remove_lazy_objects(v) for k, v in obj.items() if not isinstance(v, LocalProxy)}
25
+ elif not isinstance(obj, LocalProxy):
26
+ return obj # everything else that is not localproxy
10
27
 
11
28
  @oarepo.command(name="configuration")
12
29
  @click.argument("output_file", default="-")
13
30
  @with_appcontext
14
31
  def configuration_command(output_file):
15
- configuration = {
16
- k: v for k, v in current_app.config.items() if not isinstance(v, LocalProxy)
17
- }
32
+ configuration = remove_lazy_objects(current_app.config)
18
33
 
19
34
  try:
20
35
  invenio_db = current_app.extensions["invenio-db"]
@@ -33,4 +48,4 @@ def configuration_command(output_file):
33
48
  )
34
49
  else:
35
50
  with open(output_file, "w") as f:
36
- json.dump(configuration, f, skipkeys=True, ensure_ascii=False, default=lambda x: str(x))
51
+ json.dump(configuration, f,skipkeys=True, ensure_ascii=False, default=lambda x: str(x))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: oarepo-runtime
3
- Version: 1.5.101
3
+ Version: 1.5.102
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -10,7 +10,7 @@ oarepo_runtime/cli/assets.py,sha256=ZG80xIOKch7rsU_7QlvZxBQAXNQ9ow5xLsUREsl5MEE,
10
10
  oarepo_runtime/cli/base.py,sha256=94RBTa8TOSPxEyEUmYLGXaWen-XktP2-MIbTtZSlCZo,544
11
11
  oarepo_runtime/cli/cf.py,sha256=W0JEJK2JqKubQw8qtZJxohmADDRUBode4JZAqYLDGvc,339
12
12
  oarepo_runtime/cli/check.py,sha256=sCe2PeokSHvNOXHFZ8YHF8NMhsu5nYjyuZuvXHJ6X18,5092
13
- oarepo_runtime/cli/configuration.py,sha256=_iMmESs2dd1Oif95gxgpnkSxc13ymwr82_sTJfxlhrM,1091
13
+ oarepo_runtime/cli/configuration.py,sha256=M_19zrS0vo-7uHi047a3i4rQsK6pmp4QS0IEBAxMLZ0,2039
14
14
  oarepo_runtime/cli/fixtures.py,sha256=l6zHpz1adjotrbFy_wcN2TOL8x20i-1jbQmaoEEo-UU,5419
15
15
  oarepo_runtime/cli/index.py,sha256=KH5PArp0fCNbgJI1zSz0pb69U9eyCdnJuy0aMIgf2tg,8685
16
16
  oarepo_runtime/cli/validate.py,sha256=HpSvHQCGHlrdgdpKix9cIlzlBoJEiT1vACZdMnOUGEY,2827
@@ -142,9 +142,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
142
142
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
143
143
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
144
144
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
- oarepo_runtime-1.5.101.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
146
- oarepo_runtime-1.5.101.dist-info/METADATA,sha256=UDnOvxV1DK-bBGw8zrnSsPaxELMtHe2hacAxaD6HDQc,4721
147
- oarepo_runtime-1.5.101.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
148
- oarepo_runtime-1.5.101.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
149
- oarepo_runtime-1.5.101.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
150
- oarepo_runtime-1.5.101.dist-info/RECORD,,
145
+ oarepo_runtime-1.5.102.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
146
+ oarepo_runtime-1.5.102.dist-info/METADATA,sha256=Gzch2ffpJDzH8HdjdKtaaQ5DX0xzAZTGYT0aOTwA5hI,4721
147
+ oarepo_runtime-1.5.102.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
148
+ oarepo_runtime-1.5.102.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
149
+ oarepo_runtime-1.5.102.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
150
+ oarepo_runtime-1.5.102.dist-info/RECORD,,