pinexq-client 0.2.0.2024.607.8__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.
Files changed (49) hide show
  1. hypermedia_client/core/__init__.py +8 -0
  2. hypermedia_client/core/base_relations.py +8 -0
  3. hypermedia_client/core/enterapi.py +17 -0
  4. hypermedia_client/core/exceptions.py +2 -0
  5. hypermedia_client/core/hco/__init__.py +0 -0
  6. hypermedia_client/core/hco/action_hco.py +70 -0
  7. hypermedia_client/core/hco/action_with_parameters_hco.py +86 -0
  8. hypermedia_client/core/hco/download_link_hco.py +37 -0
  9. hypermedia_client/core/hco/hco_base.py +91 -0
  10. hypermedia_client/core/hco/link_hco.py +57 -0
  11. hypermedia_client/core/hco/upload_action_hco.py +113 -0
  12. hypermedia_client/core/http_headers.py +9 -0
  13. hypermedia_client/core/media_types.py +24 -0
  14. hypermedia_client/core/model/__init__.py +0 -0
  15. hypermedia_client/core/model/error.py +9 -0
  16. hypermedia_client/core/model/sirenmodels.py +155 -0
  17. hypermedia_client/core/polling.py +37 -0
  18. hypermedia_client/core/sirenaccess.py +173 -0
  19. hypermedia_client/job_management/__init__.py +6 -0
  20. hypermedia_client/job_management/enterjma.py +42 -0
  21. hypermedia_client/job_management/hcos/__init__.py +12 -0
  22. hypermedia_client/job_management/hcos/entrypoint_hco.py +57 -0
  23. hypermedia_client/job_management/hcos/info_hco.py +42 -0
  24. hypermedia_client/job_management/hcos/input_dataslot_hco.py +82 -0
  25. hypermedia_client/job_management/hcos/job_hco.py +174 -0
  26. hypermedia_client/job_management/hcos/job_query_result_hco.py +63 -0
  27. hypermedia_client/job_management/hcos/job_used_tags_hco.py +30 -0
  28. hypermedia_client/job_management/hcos/jobsroot_hco.py +80 -0
  29. hypermedia_client/job_management/hcos/output_dataslot_hco.py +44 -0
  30. hypermedia_client/job_management/hcos/processing_step_hco.py +71 -0
  31. hypermedia_client/job_management/hcos/processing_step_used_tags_hco.py +30 -0
  32. hypermedia_client/job_management/hcos/processingstep_query_result_hco.py +68 -0
  33. hypermedia_client/job_management/hcos/processingsteproot_hco.py +72 -0
  34. hypermedia_client/job_management/hcos/user_hco.py +37 -0
  35. hypermedia_client/job_management/hcos/workdata_hco.py +127 -0
  36. hypermedia_client/job_management/hcos/workdata_query_result_hco.py +67 -0
  37. hypermedia_client/job_management/hcos/workdata_used_tags_query_result_hco.py +30 -0
  38. hypermedia_client/job_management/hcos/workdataroot_hco.py +84 -0
  39. hypermedia_client/job_management/ideas.md +28 -0
  40. hypermedia_client/job_management/known_relations.py +29 -0
  41. hypermedia_client/job_management/model/__init__.py +1 -0
  42. hypermedia_client/job_management/model/open_api_generated.py +890 -0
  43. hypermedia_client/job_management/model/sirenentities.py +112 -0
  44. hypermedia_client/job_management/tool/__init__.py +1 -0
  45. hypermedia_client/job_management/tool/job.py +442 -0
  46. pinexq_client-0.2.0.2024.607.8.dist-info/METADATA +105 -0
  47. pinexq_client-0.2.0.2024.607.8.dist-info/RECORD +49 -0
  48. pinexq_client-0.2.0.2024.607.8.dist-info/WHEEL +4 -0
  49. pinexq_client-0.2.0.2024.607.8.dist-info/licenses/LICENSE +19 -0
@@ -0,0 +1,127 @@
1
+ from datetime import datetime
2
+ from typing import Self
3
+
4
+ import httpx
5
+
6
+ from hypermedia_client.core.hco.action_hco import ActionHco
7
+ from hypermedia_client.core.hco.action_with_parameters_hco import ActionWithParametersHco
8
+ from hypermedia_client.core.hco.download_link_hco import DownloadLinkHco
9
+ from hypermedia_client.core.hco.hco_base import Hco, Property
10
+ from hypermedia_client.core.hco.link_hco import LinkHco
11
+ from hypermedia_client.job_management.known_relations import Relations
12
+ from hypermedia_client.job_management.model.open_api_generated import (
13
+ SetNameWorkDataParameters,
14
+ SetCommentWorkDataParameters,
15
+ SetTagsWorkDataParameters,
16
+ WorkDataKind
17
+ )
18
+ from hypermedia_client.job_management.model.sirenentities import WorkDataEntity
19
+
20
+
21
+ class WorkDataLink(LinkHco):
22
+ def navigate(self) -> 'WorkDataHco':
23
+ return WorkDataHco.from_entity(self._navigate_internal(WorkDataEntity), self._client)
24
+
25
+
26
+ class WorkDataDeleteAction(ActionHco):
27
+ def execute(self):
28
+ self._execute_internal()
29
+
30
+
31
+ class WorkDataRenameAction(ActionWithParametersHco[SetNameWorkDataParameters]):
32
+ def execute(self, parameters: SetNameWorkDataParameters):
33
+ self._execute(parameters)
34
+
35
+ def default_parameters(self) -> SetNameWorkDataParameters:
36
+ return self._get_default_parameters(SetNameWorkDataParameters, SetNameWorkDataParameters())
37
+
38
+
39
+ class WorkDataEditCommentAction(ActionWithParametersHco[SetCommentWorkDataParameters]):
40
+ def execute(self, parameters: SetCommentWorkDataParameters):
41
+ self._execute(parameters)
42
+
43
+ def default_parameters(self) -> SetCommentWorkDataParameters:
44
+ return self._get_default_parameters(SetCommentWorkDataParameters, SetCommentWorkDataParameters())
45
+
46
+
47
+ class WorkDataEditTagsAction(ActionWithParametersHco[SetTagsWorkDataParameters]):
48
+ def execute(self, parameters: SetTagsWorkDataParameters):
49
+ self._execute(parameters)
50
+
51
+ def default_parameters(self) -> SetTagsWorkDataParameters:
52
+ # todo check why we have to manually set tags
53
+ return self._get_default_parameters(SetTagsWorkDataParameters, SetTagsWorkDataParameters(tags=[]))
54
+
55
+
56
+ class WorkDataAllowDeletionAction(ActionHco):
57
+ def execute(self):
58
+ self._execute_internal()
59
+
60
+
61
+ class WorkDataDisallowAction(ActionHco):
62
+ def execute(self):
63
+ self._execute_internal()
64
+
65
+
66
+ class WorkDataHideAction(ActionHco):
67
+ def execute(self):
68
+ self._execute_internal()
69
+
70
+
71
+ class WorkDataUnHideAction(ActionHco):
72
+ def execute(self):
73
+ self._execute_internal()
74
+
75
+
76
+ class WorkDataHco(Hco[WorkDataEntity]):
77
+ name: str | None = Property()
78
+ created_at: datetime | None = Property()
79
+ size_in_bytes: int | None = Property()
80
+ tags: list[str] | None = Property()
81
+ media_type: str | None = Property()
82
+ kind: WorkDataKind | None = Property()
83
+ comments: str | None = Property()
84
+ is_deletable: bool | None = Property()
85
+ hidden: bool | None = Property()
86
+
87
+ delete_action: WorkDataDeleteAction | None
88
+ hide_action: WorkDataHideAction | None
89
+ unhide_action: WorkDataUnHideAction | None
90
+ allow_deletion_action: WorkDataAllowDeletionAction | None
91
+ disallow_deletion_action: WorkDataDisallowAction | None
92
+ rename_action: WorkDataRenameAction | None
93
+ edit_comment_action: WorkDataEditCommentAction | None
94
+ edit_tags_action: WorkDataEditTagsAction | None
95
+
96
+ self_link: WorkDataLink
97
+ download_link: DownloadLinkHco
98
+
99
+ @classmethod
100
+ def from_entity(cls, entity: WorkDataEntity, client: httpx.Client) -> Self:
101
+ instance = cls(client, entity)
102
+ Hco.check_classes(instance._entity.class_, ["WorkData"])
103
+
104
+ # actions
105
+ instance.hide_action = WorkDataHideAction.from_entity_optional(
106
+ client, instance._entity, "Hide")
107
+ instance.unhide_action = WorkDataUnHideAction.from_entity_optional(
108
+ client, instance._entity, "UnHide")
109
+ instance.delete_action = WorkDataDeleteAction.from_entity_optional(
110
+ client, instance._entity, "Delete")
111
+ instance.rename_action = WorkDataRenameAction.from_entity_optional(
112
+ client, instance._entity, "Rename")
113
+ instance.edit_comment_action = WorkDataEditCommentAction.from_entity_optional(
114
+ client, instance._entity, "EditComment")
115
+ instance.edit_tags_action = WorkDataEditTagsAction.from_entity_optional(
116
+ client, instance._entity, "EditTags")
117
+ instance.allow_deletion_action = WorkDataAllowDeletionAction.from_entity_optional(
118
+ client, instance._entity, "AllowDeletion")
119
+ instance.disallow_deletion_action = WorkDataDisallowAction.from_entity_optional(
120
+ client, instance._entity, "DisallowDeletion")
121
+
122
+ # links
123
+ instance.self_link = WorkDataLink.from_entity(
124
+ instance._client, instance._entity, Relations.SELF)
125
+ instance.download_link = DownloadLinkHco.from_entity(
126
+ instance._client, instance._entity, Relations.DOWNLOAD)
127
+ return instance
@@ -0,0 +1,67 @@
1
+ from typing import Self
2
+
3
+ import httpx
4
+
5
+ from hypermedia_client.job_management.known_relations import Relations
6
+ from hypermedia_client.core.hco.hco_base import Hco, Property
7
+ from hypermedia_client.core.hco.link_hco import LinkHco
8
+ from hypermedia_client.job_management.hcos.workdata_hco import WorkDataHco
9
+ from hypermedia_client.job_management.model.sirenentities import WorkDataQueryResultEntity, WorkDataEntity
10
+
11
+
12
+ class WorkDataQueryResultPaginationLink(LinkHco):
13
+ def navigate(self) -> 'WorkDataQueryResultHco':
14
+ return WorkDataQueryResultHco.from_entity(self._navigate_internal(WorkDataQueryResultEntity), self._client)
15
+
16
+
17
+ class WorkDataQueryResultLink(LinkHco):
18
+ def navigate(self) -> 'WorkDataQueryResultHco':
19
+ return WorkDataQueryResultHco.from_entity(self._navigate_internal(WorkDataQueryResultEntity), self._client)
20
+
21
+
22
+ class WorkDataQueryResultHco(Hco[WorkDataQueryResultEntity]):
23
+ workdata_query_action: WorkDataQueryResultEntity
24
+
25
+ total_entities: int = Property()
26
+ current_entities_count: int = Property()
27
+ workdatas: list[WorkDataHco]
28
+
29
+ self_link: WorkDataQueryResultLink
30
+ all_link: WorkDataQueryResultPaginationLink | None
31
+ first_link: WorkDataQueryResultPaginationLink | None
32
+ last_link: WorkDataQueryResultPaginationLink | None
33
+ next_link: WorkDataQueryResultPaginationLink | None
34
+ previous_link: WorkDataQueryResultPaginationLink | None
35
+
36
+ @classmethod
37
+ def from_entity(cls, entity: WorkDataQueryResultEntity, client: httpx.Client) -> Self:
38
+ instance = cls(client, entity)
39
+
40
+ Hco.check_classes(instance._entity.class_, ["WorkDataQueryResult"])
41
+
42
+ # pagination links
43
+ instance.self_link = WorkDataQueryResultLink.from_entity(
44
+ instance._client, instance._entity, Relations.SELF)
45
+ instance.all_link = WorkDataQueryResultPaginationLink.from_entity_optional(
46
+ instance._client, instance._entity, Relations.ALL)
47
+ instance.first_link = WorkDataQueryResultPaginationLink.from_entity_optional(
48
+ instance._client, instance._entity, Relations.FIRST)
49
+ instance.last_link = WorkDataQueryResultPaginationLink.from_entity_optional(
50
+ instance._client, instance._entity, Relations.LAST)
51
+ instance.next_link = WorkDataQueryResultPaginationLink.from_entity_optional(
52
+ instance._client, instance._entity, Relations.NEXT)
53
+ instance.previous_link = WorkDataQueryResultPaginationLink.from_entity_optional(
54
+ instance._client, instance._entity, Relations.PREVIOUS)
55
+
56
+ # entities
57
+
58
+ instance._extract_workdatas()
59
+
60
+ return instance
61
+
62
+ def _extract_workdatas(self):
63
+ self.workdatas = []
64
+ workdatas = self._entity.find_all_entities_with_relation(Relations.ITEM, WorkDataEntity)
65
+ for workdata in workdatas:
66
+ workdata_hco: WorkDataHco = WorkDataHco.from_entity(workdata, self._client)
67
+ self.workdatas.append(workdata_hco)
@@ -0,0 +1,30 @@
1
+ from typing import List, Self
2
+
3
+ import httpx
4
+
5
+ from hypermedia_client.core.hco.hco_base import Hco, Property
6
+ from hypermedia_client.core.hco.link_hco import LinkHco
7
+ from hypermedia_client.job_management.known_relations import Relations
8
+ from hypermedia_client.job_management.model.sirenentities import WorkDataUsedTagsQueryResultEntity
9
+
10
+
11
+ class WorkDataUsedTagsQueryResultHto(Hco[WorkDataUsedTagsQueryResultEntity]):
12
+ tags: List[str] | None = Property()
13
+
14
+ self_link: 'WorkDataUsedTagsLink'
15
+
16
+ @classmethod
17
+ def from_entity(cls, entity: WorkDataUsedTagsQueryResultEntity, client: httpx.Client) -> Self:
18
+ instance = cls(client, entity)
19
+
20
+ Hco.check_classes(instance._entity.class_, ["WorkDataUsedTagsQueryResult"])
21
+
22
+ instance.self_link = WorkDataUsedTagsLink.from_entity(instance._client, instance._entity, Relations.SELF)
23
+
24
+ return instance
25
+
26
+
27
+ class WorkDataUsedTagsLink(LinkHco):
28
+ def navigate(self) -> WorkDataUsedTagsQueryResultHto:
29
+ return WorkDataUsedTagsQueryResultHto.from_entity(self._navigate_internal(WorkDataUsedTagsQueryResultEntity), self._client)
30
+
@@ -0,0 +1,84 @@
1
+ from typing import Self
2
+
3
+ import httpx
4
+
5
+ from hypermedia_client.core import MediaTypes, Link
6
+ from hypermedia_client.core.hco.action_with_parameters_hco import ActionWithParametersHco
7
+ from hypermedia_client.core.hco.hco_base import Hco
8
+ from hypermedia_client.core.hco.link_hco import LinkHco
9
+ from hypermedia_client.core.hco.upload_action_hco import UploadAction, UploadParameters
10
+ from hypermedia_client.job_management.hcos.workdata_used_tags_query_result_hco import WorkDataUsedTagsLink
11
+ from hypermedia_client.job_management.hcos.workdata_hco import WorkDataLink
12
+ from hypermedia_client.job_management.hcos.workdata_query_result_hco import (
13
+ WorkDataQueryResultHco,
14
+ WorkDataQueryResultLink,
15
+ WorkDataQueryResultPaginationLink
16
+ )
17
+ from hypermedia_client.job_management.known_relations import Relations
18
+ from hypermedia_client.job_management.model import WorkDataQueryParameters, WorkDataUsedTagsFilterParameter
19
+ from hypermedia_client.job_management.model.sirenentities import WorkDataRootEntity
20
+
21
+
22
+ class WorkDataQueryAction(ActionWithParametersHco[WorkDataQueryParameters]):
23
+ def execute(self, parameters: WorkDataQueryParameters) -> WorkDataQueryResultHco:
24
+ url = self._execute_returns_url(parameters)
25
+ link = Link.from_url(url, [str(Relations.CREATED_RESSOURCE)], "Created query", MediaTypes.SIREN)
26
+ # resolve link immediately
27
+ return WorkDataQueryResultLink.from_link(self._client, link).navigate()
28
+
29
+ def default_parameters(self) -> WorkDataQueryParameters:
30
+ return self._get_default_parameters(WorkDataQueryParameters, WorkDataQueryParameters())
31
+
32
+
33
+ class WorkDataUsedTagsQueryAction(ActionWithParametersHco[WorkDataUsedTagsFilterParameter]):
34
+ def execute(self, parameters: WorkDataUsedTagsFilterParameter) -> WorkDataUsedTagsLink:
35
+ url = self._execute_returns_url(parameters)
36
+ link = Link.from_url(url, [str(Relations.CREATED_RESSOURCE)], "Created query", MediaTypes.SIREN)
37
+ return WorkDataUsedTagsLink.from_link(self._client, link)
38
+
39
+ def default_parameters(self) -> WorkDataUsedTagsFilterParameter:
40
+ return self._get_default_parameters(WorkDataUsedTagsFilterParameter, WorkDataUsedTagsFilterParameter())
41
+
42
+
43
+ class WorkDataUploadAction(UploadAction):
44
+ def execute(self, parameters: UploadParameters) -> WorkDataLink:
45
+ url = self._upload(parameters)
46
+ link = Link.from_url(url, [str(Relations.CREATED_RESSOURCE)], "Uploaded workdata", MediaTypes.SIREN)
47
+ return WorkDataLink.from_link(self._client, link)
48
+
49
+
50
+ class WorkDataRootLink(LinkHco):
51
+ def navigate(self) -> 'WorkDataRootHco':
52
+ return WorkDataRootHco.from_entity(self._navigate_internal(WorkDataRootEntity), self._client)
53
+
54
+
55
+ class WorkDataRootHco(Hco[WorkDataRootEntity]):
56
+ query_action: WorkDataQueryAction | None
57
+ query_tags_action: WorkDataUsedTagsQueryAction | None
58
+ upload_action: WorkDataUploadAction | None
59
+
60
+ self_link: WorkDataRootLink
61
+ all_link: WorkDataQueryResultPaginationLink | None
62
+ used_tags_link: WorkDataUsedTagsLink | None
63
+
64
+ @classmethod
65
+ def from_entity(cls, entity: WorkDataRootEntity, client: httpx.Client) -> Self:
66
+ instance = cls(client, entity)
67
+ Hco.check_classes(instance._entity.class_, ["WorkDataRoot"])
68
+
69
+ instance.query_action = WorkDataQueryAction.from_entity_optional(
70
+ client, instance._entity, "CreateWorkDataQuery")
71
+ instance.query_tags_action = WorkDataUsedTagsQueryAction.from_entity_optional(
72
+ client, instance._entity, "CreateWorkDataTagsQuery")
73
+ instance.upload_action = WorkDataUploadAction.from_entity_optional(
74
+ client, instance._entity, "Upload")
75
+
76
+ instance.self_link = WorkDataRootLink.from_entity(
77
+ instance._client, instance._entity, Relations.SELF)
78
+
79
+ instance.all_link = WorkDataQueryResultPaginationLink.from_entity_optional(
80
+ instance._client, instance._entity, Relations.ALL)
81
+
82
+ instance.used_tags_link = WorkDataUsedTagsLink.from_entity_optional(
83
+ instance._client, instance._entity, Relations.USED_TAGS)
84
+ return instance
@@ -0,0 +1,28 @@
1
+ class EntryPoint():
2
+
3
+ @LinkRelateion("Info")
4
+ Info: Link[Info]
5
+
6
+ @LinkRelateion("ProcessingSteps")
7
+ @Mandatory
8
+ ProcessingSteps: MandatoryLink[Info]
9
+
10
+ user: User = Info.navigate().User.navigate()
11
+ seld["CreateUser"].Excecute()
12
+
13
+
14
+ entrypoint.navigate("Info")
15
+ def CreateUser(dojgpsj):
16
+
17
+ class Info():
18
+
19
+ CurrentUser: Link[User]
20
+
21
+ class User():
22
+
23
+ class Job():
24
+
25
+ name = ""
26
+ title = ""
27
+ status = ""
28
+
@@ -0,0 +1,29 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class Relations(StrEnum):
5
+ SELF = "self"
6
+ ITEM = "item"
7
+ DOWNLOAD = "Download"
8
+ CREATED_RESSOURCE = "created-resource"
9
+ USED_TAGS = "UsedTags"
10
+
11
+ # query pagination
12
+ FIRST = "first"
13
+ PREVIOUS = "previous"
14
+ NEXT = "next"
15
+ LAST = "last"
16
+ ALL = "all"
17
+
18
+ # job
19
+ PARENT_JOB = "ParentJob"
20
+ SELECTED_PROCESSING_STEP = "SelectedProcessingStep"
21
+ INPUT_DATASLOT = "InputDataSlot"
22
+ OUTPUT_DATASLOT = "OutputDataSlot"
23
+
24
+ # dataslots
25
+ SELECTED = "Selected"
26
+ ASSIGNED = "Assigned"
27
+
28
+ # info
29
+ CURRENT_USER = "CurrentUser"
@@ -0,0 +1 @@
1
+ from .open_api_generated import *