dsw-models 4.12.0__tar.gz → 4.14.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dsw-models
3
- Version: 4.12.0
3
+ Version: 4.14.0
4
4
  Summary: Library with DSW models and basic IO operations
5
5
  Author-email: Marek Suchánek <marek.suchanek@ds-wizard.org>
6
6
  License: Apache License 2.0
@@ -11,11 +11,11 @@ Keywords: dsw,config,yaml,parser
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Topic :: Text Processing
17
17
  Classifier: Topic :: Utilities
18
- Requires-Python: <4,>=3.10
18
+ Requires-Python: <4,>=3.11
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
 
@@ -9,9 +9,9 @@ BuildInfo = namedtuple(
9
9
  )
10
10
 
11
11
  BUILD_INFO = BuildInfo(
12
- version='v4.12.0~f6f9756',
13
- built_at='2024-11-07 09:41:12Z',
14
- sha='f6f975677676e5749b1e9cc97a0fb9238f18097a',
12
+ version='v4.14.0~213910f',
13
+ built_at='2025-01-07 08:17:52Z',
14
+ sha='213910ffb32a7cea98942ccd0f6c52cb6cf79128',
15
15
  branch='HEAD',
16
- tag='v4.12.0',
16
+ tag='v4.14.0',
17
17
  )
@@ -0,0 +1,10 @@
1
+ import json
2
+ import typing
3
+
4
+
5
+ class DSWJSONEncoder(json.JSONEncoder):
6
+
7
+ def default(self, o: typing.Any) -> typing.Any:
8
+ if hasattr(o, 'to_dict') and callable(o.to_dict):
9
+ return o.to_dict()
10
+ return super().default(o)
@@ -1,15 +1,15 @@
1
+ # pylint: disable=too-many-arguments, too-many-locals, too-many-lines
1
2
  import abc
2
-
3
- from typing import Generic, Optional, TypeVar, Any
3
+ import typing
4
4
 
5
5
  # https://github.com/ds-wizard/engine-backend/blob/develop/engine-shared/src/Shared/Model/Event/
6
6
 
7
- T = TypeVar('T')
7
+ T = typing.TypeVar('T')
8
8
 
9
9
 
10
10
  class MetricMeasure:
11
11
 
12
- def __init__(self, metric_uuid: str, measure: float, weight: float):
12
+ def __init__(self, *, metric_uuid: str, measure: float, weight: float):
13
13
  self.metric_uuid = metric_uuid
14
14
  self.measure = measure
15
15
  self.weight = weight
@@ -30,9 +30,9 @@ class MetricMeasure:
30
30
  )
31
31
 
32
32
 
33
- class EventField(Generic[T]):
33
+ class EventField(typing.Generic[T]):
34
34
 
35
- def __init__(self, changed: bool, value: Optional[T]):
35
+ def __init__(self, *, changed: bool, value: T | None):
36
36
  self.changed = changed
37
37
  self.value = value
38
38
 
@@ -59,7 +59,7 @@ class EventField(Generic[T]):
59
59
 
60
60
  class MapEntry:
61
61
 
62
- def __init__(self, key: str, value: str):
62
+ def __init__(self, *, key: str, value: str):
63
63
  self.key = key
64
64
  self.value = value
65
65
 
@@ -84,7 +84,7 @@ class _KMEvent(abc.ABC):
84
84
  TYPE = 'UNKNOWN'
85
85
  METAMODEL_VERSION = 14
86
86
 
87
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
87
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
88
88
  created_at: str):
89
89
  self.event_uuid = event_uuid
90
90
  self.entity_uuid = entity_uuid
@@ -108,7 +108,7 @@ class _KMEvent(abc.ABC):
108
108
  class _KMAddEvent(_KMEvent, abc.ABC):
109
109
  TYPE = 'ADD'
110
110
 
111
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
111
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
112
112
  created_at: str, annotations: list[MapEntry]):
113
113
  super().__init__(
114
114
  event_uuid=event_uuid,
@@ -129,7 +129,7 @@ class _KMAddEvent(_KMEvent, abc.ABC):
129
129
  class _KMEditEvent(_KMEvent, abc.ABC):
130
130
  TYPE = 'EDIT'
131
131
 
132
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
132
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
133
133
  created_at: str, annotations: EventField[list[MapEntry]]):
134
134
  super().__init__(
135
135
  event_uuid=event_uuid,
@@ -154,7 +154,7 @@ class _KMDeleteEvent(_KMEvent, abc.ABC):
154
154
  class _KMMoveEvent(_KMEvent, abc.ABC):
155
155
  TYPE = 'MOVE'
156
156
 
157
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
157
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
158
158
  created_at: str, target_uuid: str):
159
159
  super().__init__(
160
160
  event_uuid=event_uuid,
@@ -172,7 +172,7 @@ class _KMMoveEvent(_KMEvent, abc.ABC):
172
172
  return result
173
173
 
174
174
 
175
- EVENT_TYPES = {} # type: dict[str, Any]
175
+ EVENT_TYPES: dict[str, typing.Any] = {}
176
176
 
177
177
 
178
178
  def event_class(cls):
@@ -206,7 +206,7 @@ class AddKnowledgeModelEvent(_KMAddEvent):
206
206
  @event_class
207
207
  class EditKnowledgeModelEvent(_KMEditEvent):
208
208
 
209
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
209
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
210
210
  created_at: str, annotations: EventField[list[MapEntry]],
211
211
  chapter_uuids: EventField[list[str]], tag_uuids: EventField[list[str]],
212
212
  integration_uuids: EventField[list[str]], metric_uuids: EventField[list[str]],
@@ -260,9 +260,9 @@ class EditKnowledgeModelEvent(_KMEditEvent):
260
260
  @event_class
261
261
  class AddChapterEvent(_KMAddEvent):
262
262
 
263
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
263
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
264
264
  created_at: str, annotations: list[MapEntry],
265
- title: str, text: Optional[str]):
265
+ title: str, text: str | None):
266
266
  super().__init__(
267
267
  event_uuid=event_uuid,
268
268
  entity_uuid=entity_uuid,
@@ -300,9 +300,9 @@ class AddChapterEvent(_KMAddEvent):
300
300
  @event_class
301
301
  class EditChapterEvent(_KMEditEvent):
302
302
 
303
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
303
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
304
304
  created_at: str, annotations: EventField[list[MapEntry]],
305
- title: EventField[str], text: EventField[Optional[str]],
305
+ title: EventField[str], text: EventField[str | None],
306
306
  question_uuids: EventField[list[str]]):
307
307
  super().__init__(
308
308
  event_uuid=event_uuid,
@@ -369,9 +369,9 @@ class DeleteChapterEvent(_KMDeleteEvent):
369
369
  @event_class
370
370
  class AddQuestionEvent(_KMAddEvent, abc.ABC):
371
371
 
372
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
372
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
373
373
  created_at: str, annotations: list[MapEntry],
374
- title: str, text: Optional[str], required_phase_uuid: Optional[str],
374
+ title: str, text: str | None, required_phase_uuid: str | None,
375
375
  tag_uuids: list[str]):
376
376
  super().__init__(
377
377
  event_uuid=event_uuid,
@@ -416,22 +416,6 @@ class AddQuestionEvent(_KMAddEvent, abc.ABC):
416
416
 
417
417
  class AddOptionsQuestionEvent(AddQuestionEvent):
418
418
 
419
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
420
- created_at: str, annotations: list[MapEntry],
421
- title: str, text: Optional[str], required_phase_uuid: Optional[str],
422
- tag_uuids: list[str]):
423
- super().__init__(
424
- event_uuid=event_uuid,
425
- entity_uuid=entity_uuid,
426
- parent_uuid=parent_uuid,
427
- created_at=created_at,
428
- annotations=annotations,
429
- title=title,
430
- text=text,
431
- required_phase_uuid=required_phase_uuid,
432
- tag_uuids=tag_uuids,
433
- )
434
-
435
419
  def to_dict(self) -> dict:
436
420
  result = super().to_dict()
437
421
  result.update({
@@ -460,22 +444,6 @@ class AddOptionsQuestionEvent(AddQuestionEvent):
460
444
 
461
445
  class AddMultiChoiceQuestionEvent(AddQuestionEvent):
462
446
 
463
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
464
- created_at: str, annotations: list[MapEntry],
465
- title: str, text: Optional[str], required_phase_uuid: Optional[str],
466
- tag_uuids: list[str]):
467
- super().__init__(
468
- event_uuid=event_uuid,
469
- entity_uuid=entity_uuid,
470
- parent_uuid=parent_uuid,
471
- created_at=created_at,
472
- annotations=annotations,
473
- title=title,
474
- text=text,
475
- required_phase_uuid=required_phase_uuid,
476
- tag_uuids=tag_uuids,
477
- )
478
-
479
447
  def to_dict(self) -> dict:
480
448
  result = super().to_dict()
481
449
  result.update({
@@ -504,22 +472,6 @@ class AddMultiChoiceQuestionEvent(AddQuestionEvent):
504
472
 
505
473
  class AddListQuestionEvent(AddQuestionEvent):
506
474
 
507
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
508
- created_at: str, annotations: list[MapEntry],
509
- title: str, text: Optional[str], required_phase_uuid: Optional[str],
510
- tag_uuids: list[str]):
511
- super().__init__(
512
- event_uuid=event_uuid,
513
- entity_uuid=entity_uuid,
514
- parent_uuid=parent_uuid,
515
- created_at=created_at,
516
- annotations=annotations,
517
- title=title,
518
- text=text,
519
- required_phase_uuid=required_phase_uuid,
520
- tag_uuids=tag_uuids,
521
- )
522
-
523
475
  def to_dict(self) -> dict:
524
476
  result = super().to_dict()
525
477
  result.update({
@@ -548,9 +500,9 @@ class AddListQuestionEvent(AddQuestionEvent):
548
500
 
549
501
  class AddValueQuestionEvent(AddQuestionEvent):
550
502
 
551
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
503
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
552
504
  created_at: str, annotations: list[MapEntry],
553
- title: str, text: Optional[str], required_phase_uuid: Optional[str],
505
+ title: str, text: str | None, required_phase_uuid: str | None,
554
506
  tag_uuids: list[str], value_type: str):
555
507
  super().__init__(
556
508
  event_uuid=event_uuid,
@@ -595,9 +547,9 @@ class AddValueQuestionEvent(AddQuestionEvent):
595
547
 
596
548
  class AddIntegrationQuestionEvent(AddQuestionEvent):
597
549
 
598
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
550
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
599
551
  created_at: str, annotations: list[MapEntry],
600
- title: str, text: Optional[str], required_phase_uuid: Optional[str],
552
+ title: str, text: str | None, required_phase_uuid: str | None,
601
553
  tag_uuids: list[str], integration_uuid: str, props: dict[str, str]):
602
554
  super().__init__(
603
555
  event_uuid=event_uuid,
@@ -646,10 +598,10 @@ class AddIntegrationQuestionEvent(AddQuestionEvent):
646
598
  @event_class
647
599
  class EditQuestionEvent(_KMEditEvent, abc.ABC):
648
600
 
649
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
601
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
650
602
  created_at: str, annotations: EventField[list[MapEntry]],
651
- title: EventField[str], text: EventField[Optional[str]],
652
- required_phase_uuid: EventField[Optional[str]],
603
+ title: EventField[str], text: EventField[str | None],
604
+ required_phase_uuid: EventField[str | None],
653
605
  tag_uuids: EventField[list[str]], expert_uuids: EventField[list[str]],
654
606
  reference_uuids: EventField[list[str]]):
655
607
  super().__init__(
@@ -699,10 +651,10 @@ class EditQuestionEvent(_KMEditEvent, abc.ABC):
699
651
 
700
652
  class EditOptionsQuestionEvent(EditQuestionEvent):
701
653
 
702
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
654
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
703
655
  created_at: str, annotations: EventField[list[MapEntry]],
704
- title: EventField[str], text: EventField[Optional[str]],
705
- required_phase_uuid: EventField[Optional[str]],
656
+ title: EventField[str], text: EventField[str | None],
657
+ required_phase_uuid: EventField[str | None],
706
658
  tag_uuids: EventField[list[str]], expert_uuids: EventField[list[str]],
707
659
  reference_uuids: EventField[list[str]],
708
660
  answer_uuids: EventField[list[str]]):
@@ -756,10 +708,10 @@ class EditOptionsQuestionEvent(EditQuestionEvent):
756
708
 
757
709
  class EditMultiChoiceQuestionEvent(EditQuestionEvent):
758
710
 
759
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
711
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
760
712
  created_at: str, annotations: EventField[list[MapEntry]],
761
- title: EventField[str], text: EventField[Optional[str]],
762
- required_phase_uuid: EventField[Optional[str]],
713
+ title: EventField[str], text: EventField[str | None],
714
+ required_phase_uuid: EventField[str | None],
763
715
  tag_uuids: EventField[list[str]], expert_uuids: EventField[list[str]],
764
716
  reference_uuids: EventField[list[str]],
765
717
  choice_uuids: EventField[list[str]]):
@@ -813,10 +765,10 @@ class EditMultiChoiceQuestionEvent(EditQuestionEvent):
813
765
 
814
766
  class EditListQuestionEvent(EditQuestionEvent):
815
767
 
816
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
768
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
817
769
  created_at: str, annotations: EventField[list[MapEntry]],
818
- title: EventField[str], text: EventField[Optional[str]],
819
- required_phase_uuid: EventField[Optional[str]],
770
+ title: EventField[str], text: EventField[str | None],
771
+ required_phase_uuid: EventField[str | None],
820
772
  tag_uuids: EventField[list[str]], expert_uuids: EventField[list[str]],
821
773
  reference_uuids: EventField[list[str]],
822
774
  item_template_question_uuids: EventField[list[str]]):
@@ -870,10 +822,10 @@ class EditListQuestionEvent(EditQuestionEvent):
870
822
 
871
823
  class EditValueQuestionEvent(EditQuestionEvent):
872
824
 
873
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
825
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
874
826
  created_at: str, annotations: EventField[list[MapEntry]],
875
- title: EventField[str], text: EventField[Optional[str]],
876
- required_phase_uuid: EventField[Optional[str]],
827
+ title: EventField[str], text: EventField[str | None],
828
+ required_phase_uuid: EventField[str | None],
877
829
  tag_uuids: EventField[list[str]], expert_uuids: EventField[list[str]],
878
830
  reference_uuids: EventField[list[str]], value_type: EventField[str]):
879
831
  super().__init__(
@@ -926,10 +878,10 @@ class EditValueQuestionEvent(EditQuestionEvent):
926
878
 
927
879
  class EditIntegrationQuestionEvent(EditQuestionEvent):
928
880
 
929
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
881
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
930
882
  created_at: str, annotations: EventField[list[MapEntry]],
931
- title: EventField[str], text: EventField[Optional[str]],
932
- required_phase_uuid: EventField[Optional[str]],
883
+ title: EventField[str], text: EventField[str | None],
884
+ required_phase_uuid: EventField[str | None],
933
885
  tag_uuids: EventField[list[str]], expert_uuids: EventField[list[str]],
934
886
  reference_uuids: EventField[list[str]], integration_uuid: EventField[str],
935
887
  props: EventField[dict[str, str]]):
@@ -1009,9 +961,9 @@ class DeleteQuestionEvent(_KMDeleteEvent):
1009
961
  @event_class
1010
962
  class AddAnswerEvent(_KMAddEvent):
1011
963
 
1012
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
964
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1013
965
  created_at: str, annotations: list[MapEntry],
1014
- label: str, advice: Optional[str], metric_measures: list[MetricMeasure]):
966
+ label: str, advice: str | None, metric_measures: list[MetricMeasure]):
1015
967
  super().__init__(
1016
968
  event_uuid=event_uuid,
1017
969
  entity_uuid=entity_uuid,
@@ -1052,9 +1004,9 @@ class AddAnswerEvent(_KMAddEvent):
1052
1004
  @event_class
1053
1005
  class EditAnswerEvent(_KMEditEvent):
1054
1006
 
1055
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1007
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1056
1008
  created_at: str, annotations: EventField[list[MapEntry]],
1057
- label: EventField[str], advice: EventField[Optional[str]],
1009
+ label: EventField[str], advice: EventField[str | None],
1058
1010
  follow_up_uuids: EventField[list[str]],
1059
1011
  metric_measures: EventField[list[MetricMeasure]]):
1060
1012
  super().__init__(
@@ -1128,7 +1080,7 @@ class DeleteAnswerEvent(_KMDeleteEvent):
1128
1080
  @event_class
1129
1081
  class AddChoiceEvent(_KMAddEvent):
1130
1082
 
1131
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1083
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1132
1084
  created_at: str, annotations: list[MapEntry],
1133
1085
  label: str):
1134
1086
  super().__init__(
@@ -1165,7 +1117,7 @@ class AddChoiceEvent(_KMAddEvent):
1165
1117
  @event_class
1166
1118
  class EditChoiceEvent(_KMEditEvent):
1167
1119
 
1168
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1120
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1169
1121
  created_at: str, annotations: EventField[list[MapEntry]],
1170
1122
  label: EventField[str]):
1171
1123
  super().__init__(
@@ -1227,7 +1179,7 @@ class DeleteChoiceEvent(_KMDeleteEvent):
1227
1179
  @event_class
1228
1180
  class AddExpertEvent(_KMAddEvent):
1229
1181
 
1230
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1182
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1231
1183
  created_at: str, annotations: list[MapEntry],
1232
1184
  name: str, email: str):
1233
1185
  super().__init__(
@@ -1267,7 +1219,7 @@ class AddExpertEvent(_KMAddEvent):
1267
1219
  @event_class
1268
1220
  class EditExpertEvent(_KMEditEvent):
1269
1221
 
1270
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1222
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1271
1223
  created_at: str, annotations: EventField[list[MapEntry]],
1272
1224
  name: EventField[str], email: EventField[str]):
1273
1225
  super().__init__(
@@ -1332,16 +1284,6 @@ class DeleteExpertEvent(_KMDeleteEvent):
1332
1284
  @event_class
1333
1285
  class AddReferenceEvent(_KMAddEvent, abc.ABC):
1334
1286
 
1335
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1336
- created_at: str, annotations: list[MapEntry]):
1337
- super().__init__(
1338
- event_uuid=event_uuid,
1339
- entity_uuid=entity_uuid,
1340
- parent_uuid=parent_uuid,
1341
- created_at=created_at,
1342
- annotations=annotations,
1343
- )
1344
-
1345
1287
  def to_dict(self) -> dict:
1346
1288
  result = super().to_dict()
1347
1289
  result.update({
@@ -1365,7 +1307,7 @@ class AddReferenceEvent(_KMAddEvent, abc.ABC):
1365
1307
 
1366
1308
  class AddResourcePageReferenceEvent(AddReferenceEvent):
1367
1309
 
1368
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1310
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1369
1311
  created_at: str, annotations: list[MapEntry],
1370
1312
  short_uuid: str):
1371
1313
  super().__init__(
@@ -1403,7 +1345,7 @@ class AddResourcePageReferenceEvent(AddReferenceEvent):
1403
1345
 
1404
1346
  class AddURLReferenceEvent(AddReferenceEvent):
1405
1347
 
1406
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1348
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1407
1349
  created_at: str, annotations: list[MapEntry],
1408
1350
  url: str, label: str):
1409
1351
  super().__init__(
@@ -1444,7 +1386,7 @@ class AddURLReferenceEvent(AddReferenceEvent):
1444
1386
 
1445
1387
  class AddCrossReferenceEvent(AddReferenceEvent):
1446
1388
 
1447
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1389
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1448
1390
  created_at: str, annotations: list[MapEntry],
1449
1391
  target_uuid: str, description: str):
1450
1392
  super().__init__(
@@ -1486,16 +1428,6 @@ class AddCrossReferenceEvent(AddReferenceEvent):
1486
1428
  @event_class
1487
1429
  class EditReferenceEvent(_KMEditEvent, abc.ABC):
1488
1430
 
1489
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1490
- created_at: str, annotations: EventField[list[MapEntry]]):
1491
- super().__init__(
1492
- event_uuid=event_uuid,
1493
- entity_uuid=entity_uuid,
1494
- parent_uuid=parent_uuid,
1495
- created_at=created_at,
1496
- annotations=annotations,
1497
- )
1498
-
1499
1431
  def to_dict(self) -> dict:
1500
1432
  result = super().to_dict()
1501
1433
  result.update({
@@ -1519,7 +1451,7 @@ class EditReferenceEvent(_KMEditEvent, abc.ABC):
1519
1451
 
1520
1452
  class EditResourcePageReferenceEvent(EditReferenceEvent):
1521
1453
 
1522
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1454
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1523
1455
  created_at: str, annotations: EventField[list[MapEntry]],
1524
1456
  short_uuid: EventField[str]):
1525
1457
  super().__init__(
@@ -1560,7 +1492,7 @@ class EditResourcePageReferenceEvent(EditReferenceEvent):
1560
1492
 
1561
1493
  class EditURLReferenceEvent(EditReferenceEvent):
1562
1494
 
1563
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1495
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1564
1496
  created_at: str, annotations: EventField[list[MapEntry]],
1565
1497
  url: EventField[str], label: EventField[str]):
1566
1498
  super().__init__(
@@ -1604,7 +1536,7 @@ class EditURLReferenceEvent(EditReferenceEvent):
1604
1536
 
1605
1537
  class EditCrossReferenceEvent(EditReferenceEvent):
1606
1538
 
1607
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1539
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1608
1540
  created_at: str, annotations: EventField[list[MapEntry]],
1609
1541
  target_uuid: EventField[str], description: EventField[str]):
1610
1542
  super().__init__(
@@ -1671,9 +1603,9 @@ class DeleteReferenceEvent(_KMDeleteEvent):
1671
1603
  @event_class
1672
1604
  class AddTagEvent(_KMAddEvent):
1673
1605
 
1674
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1606
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1675
1607
  created_at: str, annotations: list[MapEntry],
1676
- name: str, description: Optional[str], color: str):
1608
+ name: str, description: str | None, color: str):
1677
1609
  super().__init__(
1678
1610
  event_uuid=event_uuid,
1679
1611
  entity_uuid=entity_uuid,
@@ -1714,9 +1646,9 @@ class AddTagEvent(_KMAddEvent):
1714
1646
  @event_class
1715
1647
  class EditTagEvent(_KMEditEvent):
1716
1648
 
1717
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1649
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1718
1650
  created_at: str, annotations: EventField[list[MapEntry]],
1719
- name: EventField[str], description: EventField[Optional[str]],
1651
+ name: EventField[str], description: EventField[str | None],
1720
1652
  color: EventField[str]):
1721
1653
  super().__init__(
1722
1654
  event_uuid=event_uuid,
@@ -1783,10 +1715,10 @@ class DeleteTagEvent(_KMDeleteEvent):
1783
1715
  @event_class
1784
1716
  class AddIntegrationEvent(_KMAddEvent, abc.ABC):
1785
1717
 
1786
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1718
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1787
1719
  created_at: str, annotations: list[MapEntry],
1788
- integration_id: str, name: str, props: list[str], logo: Optional[str],
1789
- item_url: Optional[str]):
1720
+ integration_id: str, name: str, props: list[str], logo: str | None,
1721
+ item_url: str | None):
1790
1722
  super().__init__(
1791
1723
  event_uuid=event_uuid,
1792
1724
  entity_uuid=entity_uuid,
@@ -1826,12 +1758,12 @@ class AddIntegrationEvent(_KMAddEvent, abc.ABC):
1826
1758
 
1827
1759
  class AddApiIntegrationEvent(AddIntegrationEvent):
1828
1760
 
1829
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1761
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1830
1762
  created_at: str, annotations: list[MapEntry],
1831
- integration_id: str, name: str, props: list[str], logo: Optional[str],
1832
- item_url: Optional[str], rq_method: str, rq_url: str,
1763
+ integration_id: str, name: str, props: list[str], logo: str | None,
1764
+ item_url: str | None, rq_method: str, rq_url: str,
1833
1765
  rq_headers: list[MapEntry], rq_body: str, rq_empty_search: bool,
1834
- rs_list_field: Optional[str], rs_item_id: Optional[str],
1766
+ rs_list_field: str | None, rs_item_id: str | None,
1835
1767
  rs_item_template: str):
1836
1768
  super().__init__(
1837
1769
  event_uuid=event_uuid,
@@ -1899,10 +1831,10 @@ class AddApiIntegrationEvent(AddIntegrationEvent):
1899
1831
 
1900
1832
  class AddWidgetIntegrationEvent(AddIntegrationEvent):
1901
1833
 
1902
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1834
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1903
1835
  created_at: str, annotations: list[MapEntry],
1904
- integration_id: str, name: str, props: list[str], logo: Optional[str],
1905
- item_url: Optional[str], widget_url: str):
1836
+ integration_id: str, name: str, props: list[str], logo: str | None,
1837
+ item_url: str | None, widget_url: str):
1906
1838
  super().__init__(
1907
1839
  event_uuid=event_uuid,
1908
1840
  entity_uuid=entity_uuid,
@@ -1949,11 +1881,11 @@ class AddWidgetIntegrationEvent(AddIntegrationEvent):
1949
1881
  @event_class
1950
1882
  class EditIntegrationEvent(_KMEditEvent, abc.ABC):
1951
1883
 
1952
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1884
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1953
1885
  created_at: str, annotations: EventField[list[MapEntry]],
1954
1886
  integration_id: EventField[str], name: EventField[str],
1955
- props: EventField[list[str]], logo: EventField[Optional[str]],
1956
- item_url: EventField[Optional[str]]):
1887
+ props: EventField[list[str]], logo: EventField[str | None],
1888
+ item_url: EventField[str | None]):
1957
1889
  super().__init__(
1958
1890
  event_uuid=event_uuid,
1959
1891
  entity_uuid=entity_uuid,
@@ -1993,14 +1925,14 @@ class EditIntegrationEvent(_KMEditEvent, abc.ABC):
1993
1925
 
1994
1926
  class EditApiIntegrationEvent(EditIntegrationEvent):
1995
1927
 
1996
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
1928
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
1997
1929
  created_at: str, annotations: EventField[list[MapEntry]],
1998
1930
  integration_id: EventField[str], name: EventField[str],
1999
- props: EventField[list[str]], logo: EventField[Optional[str]],
2000
- item_url: EventField[Optional[str]], rq_method: EventField[str],
1931
+ props: EventField[list[str]], logo: EventField[str | None],
1932
+ item_url: EventField[str | None], rq_method: EventField[str],
2001
1933
  rq_url: EventField[str], rq_headers: EventField[list[MapEntry]],
2002
1934
  rq_body: EventField[str], rq_empty_search: EventField[bool],
2003
- rs_list_field: EventField[Optional[str]], rs_item_id: EventField[Optional[str]],
1935
+ rs_list_field: EventField[str | None], rs_item_id: EventField[str | None],
2004
1936
  rs_item_template: EventField[str]):
2005
1937
  super().__init__(
2006
1938
  event_uuid=event_uuid,
@@ -2074,11 +2006,11 @@ class EditApiIntegrationEvent(EditIntegrationEvent):
2074
2006
 
2075
2007
  class EditWidgetIntegrationEvent(EditIntegrationEvent):
2076
2008
 
2077
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
2009
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
2078
2010
  created_at: str, annotations: EventField[list[MapEntry]],
2079
2011
  integration_id: EventField[str], name: EventField[str],
2080
- props: EventField[list[str]], logo: EventField[Optional[str]],
2081
- item_url: EventField[Optional[str]], widget_url: EventField[str]):
2012
+ props: EventField[list[str]], logo: EventField[str | None],
2013
+ item_url: EventField[str | None], widget_url: EventField[str]):
2082
2014
  super().__init__(
2083
2015
  event_uuid=event_uuid,
2084
2016
  entity_uuid=entity_uuid,
@@ -2150,9 +2082,9 @@ class DeleteIntegrationEvent(_KMDeleteEvent):
2150
2082
  @event_class
2151
2083
  class AddMetricEvent(_KMAddEvent):
2152
2084
 
2153
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
2085
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
2154
2086
  created_at: str, annotations: list[MapEntry],
2155
- title: str, abbreviation: Optional[str], description: Optional[str]):
2087
+ title: str, abbreviation: str | None, description: str | None):
2156
2088
  super().__init__(
2157
2089
  event_uuid=event_uuid,
2158
2090
  entity_uuid=entity_uuid,
@@ -2193,10 +2125,10 @@ class AddMetricEvent(_KMAddEvent):
2193
2125
  @event_class
2194
2126
  class EditMetricEvent(_KMEditEvent):
2195
2127
 
2196
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
2128
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
2197
2129
  created_at: str, annotations: EventField[list[MapEntry]],
2198
- title: EventField[str], abbreviation: EventField[Optional[str]],
2199
- description: EventField[Optional[str]]):
2130
+ title: EventField[str], abbreviation: EventField[str | None],
2131
+ description: EventField[str | None]):
2200
2132
  super().__init__(
2201
2133
  event_uuid=event_uuid,
2202
2134
  entity_uuid=entity_uuid,
@@ -2262,9 +2194,9 @@ class DeleteMetricEvent(_KMDeleteEvent):
2262
2194
  @event_class
2263
2195
  class AddPhaseEvent(_KMAddEvent):
2264
2196
 
2265
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
2197
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
2266
2198
  created_at: str, annotations: list[MapEntry],
2267
- title: str, description: Optional[str]):
2199
+ title: str, description: str | None):
2268
2200
  super().__init__(
2269
2201
  event_uuid=event_uuid,
2270
2202
  entity_uuid=entity_uuid,
@@ -2302,9 +2234,9 @@ class AddPhaseEvent(_KMAddEvent):
2302
2234
  @event_class
2303
2235
  class EditPhaseEvent(_KMEditEvent):
2304
2236
 
2305
- def __init__(self, event_uuid: str, entity_uuid: str, parent_uuid: str,
2237
+ def __init__(self, *, event_uuid: str, entity_uuid: str, parent_uuid: str,
2306
2238
  created_at: str, annotations: EventField[list[MapEntry]],
2307
- title: EventField[str], description: EventField[Optional[str]]):
2239
+ title: EventField[str], description: EventField[str | None]):
2308
2240
  super().__init__(
2309
2241
  event_uuid=event_uuid,
2310
2242
  entity_uuid=entity_uuid,
@@ -2484,7 +2416,7 @@ class Event:
2484
2416
  @classmethod
2485
2417
  def from_dict(cls, data: dict):
2486
2418
  event_type = data['eventType']
2487
- if event_type not in EVENT_TYPES.keys():
2419
+ if event_type not in EVENT_TYPES:
2488
2420
  raise ValueError(f'Unknown event type: {event_type}')
2489
2421
  t = EVENT_TYPES[event_type]
2490
2422
  if not hasattr(t, 'from_dict'):
@@ -1,27 +1,26 @@
1
+ # pylint: disable=too-many-arguments, too-many-locals, too-many-lines
1
2
  from .events import _KMEvent, Event
2
3
 
3
- from typing import Optional
4
-
5
4
 
6
5
  class Package:
7
6
 
8
- def __init__(self, km_id: str, org_id: str, version: str, name: str,
9
- metamodel_version: int, description: str, license: str,
10
- readme: str, created_at: str, fork_pkg_id: Optional[str],
11
- merge_pkg_id: Optional[str], prev_pkg_id: Optional[str]):
7
+ def __init__(self, *, km_id: str, org_id: str, version: str, name: str,
8
+ metamodel_version: int, description: str, pkg_license: str,
9
+ readme: str, created_at: str, fork_pkg_id: str | None,
10
+ merge_pkg_id: str | None, prev_pkg_id: str | None):
12
11
  self.km_id = km_id
13
12
  self.org_id = org_id
14
13
  self.version = version
15
14
  self.name = name
16
15
  self.metamodel_version = metamodel_version
17
16
  self.description = description
18
- self.license = license
17
+ self.license = pkg_license
19
18
  self.readme = readme
20
19
  self.created_at = created_at
21
20
  self.fork_pkg_id = fork_pkg_id
22
21
  self.merge_pkg_id = merge_pkg_id
23
22
  self.prev_pkg_id = prev_pkg_id
24
- self.events = list() # type: list[_KMEvent]
23
+ self.events: list[_KMEvent] = []
25
24
 
26
25
  @property
27
26
  def id(self):
@@ -54,7 +53,7 @@ class Package:
54
53
  metamodel_version=data['metamodelVersion'],
55
54
  name=data['name'],
56
55
  description=data['description'],
57
- license=data['license'],
56
+ pkg_license=data['license'],
58
57
  readme=data['readme'],
59
58
  created_at=data['createdAt'],
60
59
  fork_pkg_id=data['forkOfPackageId'],
@@ -68,14 +67,14 @@ class Package:
68
67
 
69
68
  class PackageBundle:
70
69
 
71
- def __init__(self, km_id: str, org_id: str, version: str, name: str,
70
+ def __init__(self, *, km_id: str, org_id: str, version: str, name: str,
72
71
  metamodel_version: int):
73
72
  self.km_id = km_id
74
73
  self.org_id = org_id
75
74
  self.version = version
76
75
  self.name = name
77
76
  self.metamodel_version = metamodel_version
78
- self.packages = list() # type: list[Package]
77
+ self.packages: list[Package] = []
79
78
 
80
79
  @property
81
80
  def id(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dsw-models
3
- Version: 4.12.0
3
+ Version: 4.14.0
4
4
  Summary: Library with DSW models and basic IO operations
5
5
  Author-email: Marek Suchánek <marek.suchanek@ds-wizard.org>
6
6
  License: Apache License 2.0
@@ -11,11 +11,11 @@ Keywords: dsw,config,yaml,parser
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Topic :: Text Processing
17
17
  Classifier: Topic :: Utilities
18
- Requires-Python: <4,>=3.10
18
+ Requires-Python: <4,>=3.11
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
 
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
4
4
 
5
5
  [project]
6
6
  name = 'dsw-models'
7
- version = "4.12.0"
7
+ version = "4.14.0"
8
8
  description = 'Library with DSW models and basic IO operations'
9
9
  readme = 'README.md'
10
10
  keywords = ['dsw', 'config', 'yaml', 'parser']
@@ -16,12 +16,12 @@ classifiers = [
16
16
  'Development Status :: 4 - Beta',
17
17
  'License :: OSI Approved :: Apache Software License',
18
18
  'Programming Language :: Python',
19
- 'Programming Language :: Python :: 3.10',
20
19
  'Programming Language :: Python :: 3.11',
20
+ 'Programming Language :: Python :: 3.12',
21
21
  'Topic :: Text Processing',
22
22
  'Topic :: Utilities',
23
23
  ]
24
- requires-python = '>=3.10, <4'
24
+ requires-python = '>=3.11, <4'
25
25
  dependencies = [
26
26
  ]
27
27
 
@@ -1,10 +0,0 @@
1
- import json
2
-
3
-
4
- class DSWJSONEncoder(json.JSONEncoder):
5
-
6
- def default(self, value):
7
- if hasattr(value, 'to_dict') and callable(value.to_dict):
8
- return value.to_dict()
9
- else:
10
- return super().default(value)
File without changes
File without changes
File without changes
File without changes