malevich-coretools 0.3.64__py3-none-any.whl → 0.3.66__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.

Potentially problematic release.


This version of malevich-coretools might be problematic. Click here for more details.

@@ -27,6 +27,14 @@ from malevich_coretools.abstract.operations import (
27
27
  )
28
28
 
29
29
 
30
+ def _validation_common(arg: 'BaseArgument', other_k = 0) -> None:
31
+ k = (arg.id is not None) + (arg.collectionName is not None) + (arg.collectionId is not None) + other_k
32
+ if k == 0:
33
+ raise ValueError("argument construction requires exactly one parameter, got none")
34
+ if k > 1:
35
+ raise ValueError("argument construction requires exactly one parameter, multiple provided")
36
+
37
+
30
38
  class PullCollectionPolicy(IntEnum):
31
39
  INIT = 0
32
40
  IF_NOT_EXIST = 1
@@ -43,7 +51,7 @@ class BaseArgument(BaseModel):
43
51
  collectionId: Optional[str] = None # hardcode collection with id (or obj path)
44
52
 
45
53
  def validation(self) -> None:
46
- assert (self.id is not None) + (self.collectionName is not None) + (self.collectionId is not None) == 1, "one way of constructing the argument must be chosen"
54
+ _validation_common(self)
47
55
 
48
56
 
49
57
  class Argument(BaseArgument):
@@ -52,11 +60,11 @@ class Argument(BaseArgument):
52
60
 
53
61
  def validation(self) -> None:
54
62
  if self.group is not None:
55
- assert self.id is None and self.collectionName is None and self.collectionId is None, "one way of constructing the argument must be chosen"
63
+ _validation_common(self, 1)
56
64
  for subarg in self.group:
57
65
  subarg.validation()
58
66
  else:
59
- assert (self.id is not None) + (self.collectionName is not None) + (self.collectionId is not None) == 1, "one way of constructing the argument must be chosen"
67
+ _validation_common(self)
60
68
 
61
69
 
62
70
  class AlternativeArgument(BaseArgument):
@@ -65,19 +73,19 @@ class AlternativeArgument(BaseArgument):
65
73
 
66
74
  def validation(self) -> None:
67
75
  if self.group is not None:
68
- assert self.id is None and self.collectionName is None and self.collectionId is None, "one way of constructing the argument must be chosen"
76
+ _validation_common(self, 1)
69
77
  for subarg in self.group:
70
78
  subarg.validation()
71
79
  elif self.alternative is not None:
72
80
  for alt_arg in self.alternative:
73
81
  if alt_arg.group is not None:
74
- assert alt_arg.id is None and alt_arg.collectionName is None and alt_arg.collectionId is None, "one way of constructing the argument must be chosen"
82
+ _validation_common(self, 1)
75
83
  for subarg in alt_arg.group:
76
84
  subarg.validation()
77
85
  else:
78
- assert (self.id is not None) + (self.collectionName is not None) + (self.collectionId is not None) == 1, "one way of constructing the argument must be chosen"
86
+ _validation_common(self)
79
87
  else:
80
- assert (self.id is not None) + (self.collectionName is not None) + (self.collectionId is not None) == 1, "one way of constructing the argument must be chosen"
88
+ _validation_common(self)
81
89
 
82
90
 
83
91
  class AppEntity(BaseModel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: malevich-coretools
3
- Version: 0.3.64
3
+ Version: 0.3.66
4
4
  Author: Andrew Pogrebnoj
5
5
  Author-email: andrew@onjulius.co
6
6
  License-File: LICENSE
@@ -3,7 +3,7 @@ malevich_coretools/utils.py,sha256=nc88BxU6gbq5ANiYt3XgRp6YzMFJpFrOWnCtdWnYUBY,2
3
3
  malevich_coretools/abstract/__init__.py,sha256=6vQ08c8HPYyT_pPkKlc-EwQKE8xG3HTEo2p_GiI5rik,142
4
4
  malevich_coretools/abstract/abstract.py,sha256=QJMMzW98agH8pYWNjLPvshXC5jK3zAEyqJ0oK4ZfZ34,17695
5
5
  malevich_coretools/abstract/operations.py,sha256=cWlo2xzW-rzkTInzpDjBYeL68KfLYqSpZJRzCQ4OzjA,3070
6
- malevich_coretools/abstract/pipeline.py,sha256=DScnLqMSeF2k29RqblZBm5eRWquQDSkTSYUqwjkO-S0,8016
6
+ malevich_coretools/abstract/pipeline.py,sha256=yjeDaU-i2yNqnQTSwe9Kdv44dzf-p5AWk_qXxvoYvhM,7530
7
7
  malevich_coretools/abstract/statuses.py,sha256=9ISSw_evsylBshLXoU44TCoFOrZm4bXIxyAFFDqdUWc,333
8
8
  malevich_coretools/admin/__init__.py,sha256=zdIcHs3T_NZ8HYWts-O7OpBEWHIu779QDZMGF5HRCLg,35
9
9
  malevich_coretools/admin/utils.py,sha256=mGu-zge5FHW2Z2TDhE3YOhOlw2x8NA2CV_XKsY-g4nE,10378
@@ -21,8 +21,8 @@ malevich_coretools/secondary/kafka_utils.py,sha256=SIUnBFyfwsquN6MAUrEkKCw-1l797
21
21
  malevich_coretools/tools/__init__.py,sha256=jDxlCa5Dr6Y43qlI7JwsRAlBkKmFeTHTEnjNUvu-0iw,46
22
22
  malevich_coretools/tools/abstract.py,sha256=B1RW1FeNHrQ6r1k-cQZ4k4noCRXkIGt-JUwVoXEDkAg,4466
23
23
  malevich_coretools/tools/vast.py,sha256=63tvy70qQV9vnK0eWytlgjBGSnfA7l3kSIDgACBbMMs,12893
24
- malevich_coretools-0.3.64.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
- malevich_coretools-0.3.64.dist-info/METADATA,sha256=E54P2VaEKpu-Pay1Zop_isqgr7V4XfprTRR10NWA86s,347
26
- malevich_coretools-0.3.64.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
- malevich_coretools-0.3.64.dist-info/top_level.txt,sha256=wDX3s1Tso0otBPNrFRfXqyNpm48W4Bp5v6JfbITO2Z8,19
28
- malevich_coretools-0.3.64.dist-info/RECORD,,
24
+ malevich_coretools-0.3.66.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ malevich_coretools-0.3.66.dist-info/METADATA,sha256=4_no2l1oNwKjuRKfjp2nPxCIJxJq32_7NNmGV3HNYoU,347
26
+ malevich_coretools-0.3.66.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ malevich_coretools-0.3.66.dist-info/top_level.txt,sha256=wDX3s1Tso0otBPNrFRfXqyNpm48W4Bp5v6JfbITO2Z8,19
28
+ malevich_coretools-0.3.66.dist-info/RECORD,,