cmem-cmemc 25.5.0rc1__tar.gz → 25.6.0__tar.gz
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.
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/PKG-INFO +2 -1
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/command_group.py +32 -31
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/acl.py +15 -6
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/dataset.py +1 -54
- cmem_cmemc-25.6.0/cmem_cmemc/commands/file.py +465 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/graph_insights.py +103 -35
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/project.py +3 -1
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/python.py +1 -1
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/vocabulary.py +13 -4
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/completion.py +22 -5
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/context.py +2 -2
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/manual_helper/graph.py +2 -2
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/manual_helper/multi_page.py +5 -6
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/placeholder.py +2 -2
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/string_processor.py +12 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/utils.py +1 -1
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/pyproject.toml +3 -2
- cmem_cmemc-25.5.0rc1/cmem_cmemc/commands/resource.py +0 -220
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/LICENSE +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/README-public.md +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/__init__.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/_cmemc.zsh +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/cli.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/command.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/__init__.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/admin.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/client.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/config.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/graph.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/graph_imports.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/manual.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/metrics.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/migration.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/query.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/scheduler.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/store.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/user.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/validation.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/variable.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/workflow.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/commands/workspace.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/config_parser.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/constants.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/exceptions.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/manual_helper/__init__.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/manual_helper/single_page.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/migrations/__init__.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/migrations/abc.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/migrations/access_conditions_243.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/migrations/bootstrap_data.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/migrations/remove_noop_triple_251.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/migrations/shapes_widget_integrations_243.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/migrations/sparql_query_texts_242.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/migrations/workspace_configurations.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/object_list.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/parameter_types/__init__.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/parameter_types/path.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/smart_path/__init__.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/smart_path/clients/__init__.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/smart_path/clients/http.py +0 -0
- {cmem_cmemc-25.5.0rc1 → cmem_cmemc-25.6.0}/cmem_cmemc/title_helper.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cmem-cmemc
|
|
3
|
-
Version: 25.
|
|
3
|
+
Version: 25.6.0
|
|
4
4
|
Summary: Command line client for eccenca Corporate Memory
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -34,6 +34,7 @@ Requires-Dist: click-didyoumean (>=0.3.1,<0.4.0)
|
|
|
34
34
|
Requires-Dist: click-help-colors (>=0.9.4,<0.10.0)
|
|
35
35
|
Requires-Dist: cmem-cmempy (==25.4.0)
|
|
36
36
|
Requires-Dist: configparser (>=7.2.0,<8.0.0)
|
|
37
|
+
Requires-Dist: humanize (>=4.14.0,<5.0.0)
|
|
37
38
|
Requires-Dist: jinja2 (>=3.1.6,<4.0.0)
|
|
38
39
|
Requires-Dist: junit-xml (>=1.9,<2.0)
|
|
39
40
|
Requires-Dist: natsort (>=8.4.0,<9.0.0)
|
|
@@ -24,49 +24,50 @@ class CmemcGroup(HelpColorsGroup, DYMGroup):
|
|
|
24
24
|
kwargs.setdefault(
|
|
25
25
|
"help_options_custom_colors",
|
|
26
26
|
{
|
|
27
|
+
"acl": self.color_for_command_groups,
|
|
28
|
+
"admin": self.color_for_command_groups,
|
|
27
29
|
"bootstrap": self.color_for_writing_commands,
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"upload": self.color_for_writing_commands,
|
|
33
|
-
"import": self.color_for_writing_commands,
|
|
30
|
+
"cache": self.color_for_command_groups,
|
|
31
|
+
"cancel": self.color_for_writing_commands,
|
|
32
|
+
"client": self.color_for_command_groups,
|
|
33
|
+
"config": self.color_for_command_groups,
|
|
34
34
|
"create": self.color_for_writing_commands,
|
|
35
|
-
"
|
|
35
|
+
"dataset": self.color_for_command_groups,
|
|
36
|
+
"delete": self.color_for_writing_commands,
|
|
36
37
|
"disable": self.color_for_writing_commands,
|
|
38
|
+
"enable": self.color_for_writing_commands,
|
|
39
|
+
"eval": self.color_for_writing_commands,
|
|
37
40
|
"execute": self.color_for_writing_commands,
|
|
38
|
-
"
|
|
39
|
-
"
|
|
41
|
+
"file": self.color_for_command_groups,
|
|
42
|
+
"graph": self.color_for_command_groups,
|
|
43
|
+
"import": self.color_for_writing_commands,
|
|
44
|
+
"imports": self.color_for_command_groups,
|
|
45
|
+
"insights": self.color_for_command_groups,
|
|
40
46
|
"install": self.color_for_writing_commands,
|
|
41
|
-
"
|
|
42
|
-
"reload": self.color_for_writing_commands,
|
|
43
|
-
"update": self.color_for_writing_commands,
|
|
44
|
-
"eval": self.color_for_writing_commands,
|
|
45
|
-
"cancel": self.color_for_writing_commands,
|
|
46
|
-
"admin": self.color_for_command_groups,
|
|
47
|
-
"user": self.color_for_command_groups,
|
|
48
|
-
"store": self.color_for_command_groups,
|
|
47
|
+
"io": self.color_for_writing_commands,
|
|
49
48
|
"metrics": self.color_for_command_groups,
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
49
|
+
"migrate": self.color_for_writing_commands,
|
|
50
|
+
"migrations": self.color_for_command_groups,
|
|
51
|
+
"password": self.color_for_writing_commands,
|
|
53
52
|
"project": self.color_for_command_groups,
|
|
53
|
+
"python": self.color_for_command_groups,
|
|
54
54
|
"query": self.color_for_command_groups,
|
|
55
|
+
"reload": self.color_for_writing_commands,
|
|
56
|
+
"replay": self.color_for_writing_commands,
|
|
57
|
+
"resource": self.color_for_command_groups,
|
|
55
58
|
"scheduler": self.color_for_command_groups,
|
|
59
|
+
"secret": self.color_for_writing_commands,
|
|
60
|
+
"showcase": self.color_for_writing_commands,
|
|
61
|
+
"store": self.color_for_command_groups,
|
|
62
|
+
"uninstall": self.color_for_writing_commands,
|
|
63
|
+
"update": self.color_for_writing_commands,
|
|
64
|
+
"upload": self.color_for_writing_commands,
|
|
65
|
+
"user": self.color_for_command_groups,
|
|
66
|
+
"validation": self.color_for_command_groups,
|
|
67
|
+
"variable": self.color_for_command_groups,
|
|
56
68
|
"vocabulary": self.color_for_command_groups,
|
|
57
69
|
"workflow": self.color_for_command_groups,
|
|
58
70
|
"workspace": self.color_for_command_groups,
|
|
59
|
-
"python": self.color_for_command_groups,
|
|
60
|
-
"cache": self.color_for_command_groups,
|
|
61
|
-
"resource": self.color_for_command_groups,
|
|
62
|
-
"acl": self.color_for_command_groups,
|
|
63
|
-
"client": self.color_for_command_groups,
|
|
64
|
-
"variable": self.color_for_command_groups,
|
|
65
|
-
"validation": self.color_for_command_groups,
|
|
66
|
-
"migrate": self.color_for_writing_commands,
|
|
67
|
-
"migrations": self.color_for_command_groups,
|
|
68
|
-
"imports": self.color_for_command_groups,
|
|
69
|
-
"insights": self.color_for_command_groups,
|
|
70
71
|
},
|
|
71
72
|
)
|
|
72
73
|
super().__init__(*args, **kwargs)
|
|
@@ -51,6 +51,10 @@ HELP_TEXTS = {
|
|
|
51
51
|
"end of the pattern or the wildcard alone."
|
|
52
52
|
),
|
|
53
53
|
"query": "Dynamic access condition query (file or the query catalog IRI).",
|
|
54
|
+
"replace": (
|
|
55
|
+
"Replace (overwrite) existing access condition, if present. "
|
|
56
|
+
"Can be used only in combination with '--id'."
|
|
57
|
+
),
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
WARNING_UNKNOWN_USER = "Unknown User or no access to get user info."
|
|
@@ -255,6 +259,7 @@ def inspect_command(app: ApplicationContext, access_condition_id: str, raw: bool
|
|
|
255
259
|
type=click.STRING,
|
|
256
260
|
help=HELP_TEXTS["description"],
|
|
257
261
|
)
|
|
262
|
+
@click.option("--replace", is_flag=True, help=HELP_TEXTS["replace"])
|
|
258
263
|
@click.pass_obj
|
|
259
264
|
# pylint: disable-msg=too-many-arguments
|
|
260
265
|
def create_command( # noqa: PLR0913
|
|
@@ -271,6 +276,7 @@ def create_command( # noqa: PLR0913
|
|
|
271
276
|
write_graph_patterns: tuple[str],
|
|
272
277
|
action_patterns: tuple[str],
|
|
273
278
|
query: str,
|
|
279
|
+
replace: bool,
|
|
274
280
|
) -> None:
|
|
275
281
|
"""Create an access condition.
|
|
276
282
|
|
|
@@ -293,6 +299,9 @@ def create_command( # noqa: PLR0913
|
|
|
293
299
|
|
|
294
300
|
Example: cmemc admin acl create --group local-users --write-graph https://example.org/
|
|
295
301
|
"""
|
|
302
|
+
if replace and not id_:
|
|
303
|
+
raise click.UsageError("To replace an access condition, you must specify an ID.")
|
|
304
|
+
|
|
296
305
|
if (
|
|
297
306
|
not read_graphs
|
|
298
307
|
and not write_graphs
|
|
@@ -312,7 +321,7 @@ def create_command( # noqa: PLR0913
|
|
|
312
321
|
query_str = get_query_text(query, {"user", "group", "readGraph", "writeGraph"})
|
|
313
322
|
|
|
314
323
|
if not user and not groups and not query:
|
|
315
|
-
app.echo_warning("Access conditions without a user or group assignment
|
|
324
|
+
app.echo_warning("Access conditions without a user or group assignment affects ALL users.")
|
|
316
325
|
|
|
317
326
|
if not name:
|
|
318
327
|
name = generate_acl_name(user=user, groups=groups, query=query)
|
|
@@ -320,11 +329,11 @@ def create_command( # noqa: PLR0913
|
|
|
320
329
|
if not description:
|
|
321
330
|
description = "This access condition was created with cmemc."
|
|
322
331
|
|
|
323
|
-
|
|
324
|
-
f"
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
332
|
+
if replace and NS_ACL + id_ in [_["iri"] for _ in fetch_all_acls()]:
|
|
333
|
+
app.echo_info(f"Replacing access condition '{id_}' ... ", nl=False)
|
|
334
|
+
delete_access_condition(iri=NS_ACL + id_)
|
|
335
|
+
else:
|
|
336
|
+
app.echo_info(f"Creating access condition '{name}' ... ", nl=False)
|
|
328
337
|
create_access_condition(
|
|
329
338
|
name=name,
|
|
330
339
|
static_id=id_,
|
|
@@ -16,16 +16,14 @@ from cmem.cmempy.workspace.projects.datasets.dataset import (
|
|
|
16
16
|
update_dataset,
|
|
17
17
|
)
|
|
18
18
|
from cmem.cmempy.workspace.projects.resources.resource import (
|
|
19
|
-
create_resource,
|
|
20
19
|
get_resource_response,
|
|
21
|
-
resource_exist,
|
|
22
20
|
)
|
|
23
21
|
from cmem.cmempy.workspace.search import list_items
|
|
24
22
|
|
|
25
23
|
from cmem_cmemc import completion
|
|
26
24
|
from cmem_cmemc.command import CmemcCommand
|
|
27
25
|
from cmem_cmemc.command_group import CmemcGroup
|
|
28
|
-
from cmem_cmemc.commands.
|
|
26
|
+
from cmem_cmemc.commands.file import _upload_file_resource, resource
|
|
29
27
|
from cmem_cmemc.completion import get_dataset_file_mapping
|
|
30
28
|
from cmem_cmemc.context import ApplicationContext
|
|
31
29
|
from cmem_cmemc.exceptions import CmemcError
|
|
@@ -147,57 +145,6 @@ def _post_file_resource(
|
|
|
147
145
|
app.echo_success("done")
|
|
148
146
|
|
|
149
147
|
|
|
150
|
-
def _upload_file_resource(
|
|
151
|
-
app: ApplicationContext,
|
|
152
|
-
project_id: str,
|
|
153
|
-
local_file_name: str,
|
|
154
|
-
remote_file_name: str,
|
|
155
|
-
replace: bool,
|
|
156
|
-
) -> None:
|
|
157
|
-
"""Upload a local file as a dataset resource to a project.
|
|
158
|
-
|
|
159
|
-
Args:
|
|
160
|
-
----
|
|
161
|
-
app: the click cli app context.
|
|
162
|
-
project_id: The project ID in the workspace.
|
|
163
|
-
local_file_name: The path to the local file name
|
|
164
|
-
remote_file_name: The remote file name
|
|
165
|
-
replace: Replace resource if needed.
|
|
166
|
-
|
|
167
|
-
Raises:
|
|
168
|
-
------
|
|
169
|
-
ValueError: if resource exists and no replace
|
|
170
|
-
|
|
171
|
-
"""
|
|
172
|
-
exist = resource_exist(project_name=project_id, resource_name=remote_file_name)
|
|
173
|
-
if exist and not replace:
|
|
174
|
-
raise ClickException(
|
|
175
|
-
f"A file resource with the name '{remote_file_name}' already "
|
|
176
|
-
"exists in this project. \n"
|
|
177
|
-
"Please rename the file or use the '--replace' "
|
|
178
|
-
"parameter in order to overwrite the remote file."
|
|
179
|
-
)
|
|
180
|
-
if exist:
|
|
181
|
-
app.echo_info(
|
|
182
|
-
f"Replace content of {remote_file_name} with content from "
|
|
183
|
-
f"{local_file_name} in project {project_id} ... ",
|
|
184
|
-
nl=False,
|
|
185
|
-
)
|
|
186
|
-
else:
|
|
187
|
-
app.echo_info(
|
|
188
|
-
f"Upload {local_file_name} as a file resource "
|
|
189
|
-
f"{remote_file_name} to project {project_id} ... ",
|
|
190
|
-
nl=False,
|
|
191
|
-
)
|
|
192
|
-
create_resource(
|
|
193
|
-
project_name=project_id,
|
|
194
|
-
resource_name=remote_file_name,
|
|
195
|
-
file_resource=ClickSmartPath.open(local_file_name),
|
|
196
|
-
replace=replace,
|
|
197
|
-
)
|
|
198
|
-
app.echo_success("done")
|
|
199
|
-
|
|
200
|
-
|
|
201
148
|
def _get_metadata_out_of_parameter(parameter_dict: dict) -> dict:
|
|
202
149
|
"""Extract metadata keys out of the parameter dict.
|
|
203
150
|
|