malevich-coretools 0.3.50__py3-none-any.whl → 0.3.51__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.
- malevich_coretools/funcs/helpers.py +111 -5
- malevich_coretools/utils.py +5313 -263
- {malevich_coretools-0.3.50.dist-info → malevich_coretools-0.3.51.dist-info}/METADATA +1 -1
- {malevich_coretools-0.3.50.dist-info → malevich_coretools-0.3.51.dist-info}/RECORD +7 -7
- {malevich_coretools-0.3.50.dist-info → malevich_coretools-0.3.51.dist-info}/WHEEL +1 -1
- {malevich_coretools-0.3.50.dist-info → malevich_coretools-0.3.51.dist-info}/licenses/LICENSE +0 -0
- {malevich_coretools-0.3.50.dist-info → malevich_coretools-0.3.51.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
-
from typing import Any, Dict, List, Optional, Union
|
|
2
|
+
from typing import Any, Coroutine, Dict, List, Literal, Optional, Union, overload
|
|
3
3
|
from uuid import uuid4
|
|
4
4
|
|
|
5
5
|
import pandas as pd
|
|
@@ -32,37 +32,89 @@ from malevich_coretools.secondary import Config, to_json
|
|
|
32
32
|
__all__ = ["create_collection_from_file_df", "update_collection_from_file_df", "raw_collection_from_df", "raw_collection_from_file", "create_collection_from_df", "update_collection_from_df", "create_app_settings", "create_user_config", "create_task_component", "create_task_policy", "create_restrictions", "create_run_settings", "create_endpoint_override", "create_cfg_struct"]
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
@overload
|
|
35
36
|
def create_collection_from_file_df(
|
|
36
37
|
file: str,
|
|
37
38
|
name: Optional[str],
|
|
38
39
|
metadata: Optional[Union[Dict[str, Any], str]],
|
|
39
40
|
*args,
|
|
41
|
+
is_async: Literal[False],
|
|
40
42
|
**kwargs
|
|
41
43
|
) -> Alias.Id:
|
|
44
|
+
pass
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@overload
|
|
48
|
+
def create_collection_from_file_df(
|
|
49
|
+
file: str,
|
|
50
|
+
name: Optional[str],
|
|
51
|
+
metadata: Optional[Union[Dict[str, Any], str]],
|
|
52
|
+
*args,
|
|
53
|
+
is_async: Literal[True],
|
|
54
|
+
**kwargs
|
|
55
|
+
) -> Coroutine[Any, Any, Alias.Id]:
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def create_collection_from_file_df(
|
|
60
|
+
file: str,
|
|
61
|
+
name: Optional[str],
|
|
62
|
+
metadata: Optional[Union[Dict[str, Any], str]],
|
|
63
|
+
*args,
|
|
64
|
+
is_async: bool = False,
|
|
65
|
+
**kwargs
|
|
66
|
+
) -> Union[Alias.Id, Coroutine[Any, Any, Alias.Id]]:
|
|
42
67
|
try:
|
|
43
68
|
data = pd.read_csv(file)
|
|
44
69
|
except pd.errors.EmptyDataError:
|
|
45
70
|
data = pd.DataFrame()
|
|
46
71
|
if name is None:
|
|
47
72
|
name = file
|
|
48
|
-
return create_collection_from_df(data, name=file, metadata=metadata, *args, **kwargs)
|
|
73
|
+
return create_collection_from_df(data, name=file, metadata=metadata, *args, is_async=is_async, **kwargs)
|
|
49
74
|
|
|
50
75
|
|
|
76
|
+
@overload
|
|
51
77
|
def update_collection_from_file_df(
|
|
52
78
|
id: str,
|
|
53
79
|
file: str,
|
|
54
80
|
name: Optional[str],
|
|
55
81
|
metadata: Optional[Union[Dict[str, Any], str]],
|
|
56
82
|
*args,
|
|
83
|
+
is_async: Literal[False],
|
|
57
84
|
**kwargs
|
|
58
85
|
) -> Alias.Id:
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@overload
|
|
90
|
+
def update_collection_from_file_df(
|
|
91
|
+
id: str,
|
|
92
|
+
file: str,
|
|
93
|
+
name: Optional[str],
|
|
94
|
+
metadata: Optional[Union[Dict[str, Any], str]],
|
|
95
|
+
*args,
|
|
96
|
+
is_async: Literal[True],
|
|
97
|
+
**kwargs
|
|
98
|
+
) -> Coroutine[Any, Any, Alias.Id]:
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def update_collection_from_file_df(
|
|
103
|
+
id: str,
|
|
104
|
+
file: str,
|
|
105
|
+
name: Optional[str],
|
|
106
|
+
metadata: Optional[Union[Dict[str, Any], str]],
|
|
107
|
+
*args,
|
|
108
|
+
is_async: bool = False,
|
|
109
|
+
**kwargs
|
|
110
|
+
) -> Union[Alias.Id, Coroutine[Any, Any, Alias.Id]]:
|
|
59
111
|
try:
|
|
60
112
|
data = pd.read_csv(file)
|
|
61
113
|
except pd.errors.EmptyDataError:
|
|
62
114
|
data = pd.DataFrame()
|
|
63
115
|
if name is None:
|
|
64
116
|
name = file
|
|
65
|
-
return update_collection_from_df(id, data, name=file, metadata=metadata, *args, **kwargs)
|
|
117
|
+
return update_collection_from_df(id, data, name=file, metadata=metadata, *args, is_async=is_async, **kwargs)
|
|
66
118
|
|
|
67
119
|
|
|
68
120
|
def raw_collection_from_df(
|
|
@@ -95,15 +147,41 @@ def raw_collection_from_file(
|
|
|
95
147
|
return raw_collection_from_df(data, name, metadata)
|
|
96
148
|
|
|
97
149
|
|
|
150
|
+
@overload
|
|
98
151
|
def create_collection_from_df(
|
|
99
152
|
data: pd.DataFrame,
|
|
100
153
|
name: Optional[str],
|
|
101
154
|
metadata: Optional[Union[Dict[str, Any], str]],
|
|
102
155
|
batcher: Optional[Batcher] = None,
|
|
103
|
-
is_async: bool = False,
|
|
104
156
|
*args,
|
|
157
|
+
is_async: Literal[False],
|
|
105
158
|
**kwargs
|
|
106
159
|
) -> Alias.Id:
|
|
160
|
+
pass
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
@overload
|
|
164
|
+
def create_collection_from_df(
|
|
165
|
+
data: pd.DataFrame,
|
|
166
|
+
name: Optional[str],
|
|
167
|
+
metadata: Optional[Union[Dict[str, Any], str]],
|
|
168
|
+
batcher: Optional[Batcher] = None,
|
|
169
|
+
*args,
|
|
170
|
+
is_async: Literal[True],
|
|
171
|
+
**kwargs
|
|
172
|
+
) -> Coroutine[Any, Any, Alias.Id]:
|
|
173
|
+
pass
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def create_collection_from_df(
|
|
177
|
+
data: pd.DataFrame,
|
|
178
|
+
name: Optional[str],
|
|
179
|
+
metadata: Optional[Union[Dict[str, Any], str]],
|
|
180
|
+
batcher: Optional[Batcher] = None,
|
|
181
|
+
*args,
|
|
182
|
+
is_async: bool = False,
|
|
183
|
+
**kwargs
|
|
184
|
+
) -> Union[Alias.Id, Coroutine[Any, Any, Alias.Id]]:
|
|
107
185
|
if batcher is None:
|
|
108
186
|
batcher = Config.BATCHER
|
|
109
187
|
data = raw_collection_from_df(data, name, metadata)
|
|
@@ -114,16 +192,44 @@ def create_collection_from_df(
|
|
|
114
192
|
return post_collections_data(data, *args, **kwargs)
|
|
115
193
|
|
|
116
194
|
|
|
195
|
+
@overload
|
|
117
196
|
def update_collection_from_df(
|
|
118
197
|
id: str,
|
|
119
198
|
data: pd.DataFrame,
|
|
120
199
|
name: Optional[str],
|
|
121
200
|
metadata: Optional[Union[Dict[str, Any], str]],
|
|
122
201
|
batcher: Optional[Batcher] = None,
|
|
123
|
-
is_async: bool = False,
|
|
124
202
|
*args,
|
|
203
|
+
is_async: Literal[False],
|
|
125
204
|
**kwargs
|
|
126
205
|
) -> Alias.Id:
|
|
206
|
+
pass
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
@overload
|
|
210
|
+
def update_collection_from_df(
|
|
211
|
+
id: str,
|
|
212
|
+
data: pd.DataFrame,
|
|
213
|
+
name: Optional[str],
|
|
214
|
+
metadata: Optional[Union[Dict[str, Any], str]],
|
|
215
|
+
batcher: Optional[Batcher] = None,
|
|
216
|
+
*args,
|
|
217
|
+
is_async: Literal[True],
|
|
218
|
+
**kwargs
|
|
219
|
+
) -> Coroutine[Any, Any, Alias.Id]:
|
|
220
|
+
pass
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def update_collection_from_df(
|
|
224
|
+
id: str,
|
|
225
|
+
data: pd.DataFrame,
|
|
226
|
+
name: Optional[str],
|
|
227
|
+
metadata: Optional[Union[Dict[str, Any], str]],
|
|
228
|
+
batcher: Optional[Batcher] = None,
|
|
229
|
+
*args,
|
|
230
|
+
is_async: bool = False,
|
|
231
|
+
**kwargs
|
|
232
|
+
) -> Union[Alias.Id, Coroutine[Any, Any, Alias.Id]]:
|
|
127
233
|
if batcher is None:
|
|
128
234
|
batcher = Config.BATCHER
|
|
129
235
|
data = raw_collection_from_df(data, name, metadata)
|