malevich-coretools 0.3.19__tar.gz → 0.3.23__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.

Potentially problematic release.


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

Files changed (37) hide show
  1. {malevich_coretools-0.3.19/malevich_coretools.egg-info → malevich_coretools-0.3.23}/PKG-INFO +1 -1
  2. malevich_coretools-0.3.23/VERSION +1 -0
  3. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/abstract/pipeline.py +3 -2
  4. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/funcs/funcs.py +4 -0
  5. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/funcs/helpers.py +8 -2
  6. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/secondary/const.py +1 -0
  7. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/utils.py +38 -2
  8. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23/malevich_coretools.egg-info}/PKG-INFO +1 -1
  9. malevich_coretools-0.3.19/VERSION +0 -1
  10. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/LICENSE +0 -0
  11. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/MANIFEST.in +0 -0
  12. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/README.md +0 -0
  13. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/__init__.py +0 -0
  14. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/abstract/__init__.py +0 -0
  15. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/abstract/abstract.py +0 -0
  16. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/abstract/statuses.py +0 -0
  17. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/admin/__init__.py +0 -0
  18. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/admin/utils.py +0 -0
  19. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/batch/__init__.py +0 -0
  20. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/batch/utils.py +0 -0
  21. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/funcs/__init__.py +0 -0
  22. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/funcs/checks.py +0 -0
  23. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/secondary/__init__.py +0 -0
  24. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/secondary/config.py +0 -0
  25. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/secondary/helpers.py +0 -0
  26. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/secondary/kafka_utils.py +0 -0
  27. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/tools/__init__.py +0 -0
  28. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/tools/abstract.py +0 -0
  29. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools/tools/vast.py +0 -0
  30. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools.egg-info/SOURCES.txt +0 -0
  31. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools.egg-info/dependency_links.txt +0 -0
  32. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools.egg-info/requires.txt +0 -0
  33. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/malevich_coretools.egg-info/top_level.txt +0 -0
  34. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/pyproject.toml +0 -0
  35. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/requirements.txt +0 -0
  36. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/setup.cfg +0 -0
  37. {malevich_coretools-0.3.19 → malevich_coretools-0.3.23}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: malevich-coretools
3
- Version: 0.3.19
3
+ Version: 0.3.23
4
4
  Author: Andrew Pogrebnoj
5
5
  Author-email: andrew@onjulius.co
6
6
  License-File: LICENSE
@@ -0,0 +1 @@
1
+ 0.3.23
@@ -33,7 +33,7 @@ class BaseArgument(BaseModel):
33
33
 
34
34
  class Argument(BaseArgument):
35
35
  group: Optional[List[BaseArgument]] = None # for constructed dfs, sink
36
- conditions: Optional[Dict[str, bool]] = None # valid only for alternative, bindConditionId -> value, must be specified explicitly, then it will be derived from the pipeline structure
36
+ # conditions: Optional[Dict[str, bool]] = None # valid only for alternative, bindConditionId -> value, must be specified explicitly, then it will be derived from the pipeline structure
37
37
 
38
38
  def validation(self) -> None:
39
39
  if self.group is not None:
@@ -45,7 +45,8 @@ class Argument(BaseArgument):
45
45
 
46
46
 
47
47
  class AlternativeArgument(Argument):
48
- alternative: Optional[List[Argument]] = None # if set - should be only one valid argument with conditions
48
+ # alternative: Optional[List[Argument]] = None # if set - should be only one valid argument with conditions
49
+ pass
49
50
 
50
51
 
51
52
  class AppEntity(BaseModel):
@@ -30,6 +30,10 @@ def get_docs_id(id: str, *args, **kwargs) -> ResultDoc:
30
30
  return model_from_json(send_to_core_get(DOCS_ID(id, None), *args, **kwargs), ResultDoc)
31
31
 
32
32
 
33
+ def get_docs_name(name: str, *args, **kwargs) -> ResultDoc:
34
+ return model_from_json(send_to_core_get(DOCS_NAME(name, None), *args, **kwargs), ResultDoc)
35
+
36
+
33
37
  def post_docs(data: DocWithName, wait: bool, *args, **kwargs) -> Alias.Id:
34
38
  return send_to_core_modify(DOCS(wait), data, *args, **kwargs)
35
39
 
@@ -34,7 +34,10 @@ def create_collection_from_file_df(
34
34
  *args,
35
35
  **kwargs
36
36
  ) -> Alias.Id:
37
- data = pd.read_csv(file)
37
+ try:
38
+ data = pd.read_csv(file)
39
+ except pd.errors.EmptyDataError:
40
+ data = pd.DataFrame()
38
41
  if name is None:
39
42
  name = file
40
43
  return create_collection_from_df(data, name=file, metadata=metadata, *args, **kwargs)
@@ -63,7 +66,10 @@ def raw_collection_from_file(
63
66
  name: Optional[str] = None,
64
67
  metadata: Optional[Union[Dict[str, Any], str]] = None,
65
68
  ) -> DocsDataCollection:
66
- data = pd.read_csv(file)
69
+ try:
70
+ data = pd.read_csv(file)
71
+ except pd.errors.EmptyDataError:
72
+ data = pd.DataFrame()
67
73
  return raw_collection_from_df(data, name, metadata)
68
74
 
69
75
 
@@ -39,6 +39,7 @@ def with_key_values(url: str, key_values: Dict[str, Optional[str]]) -> str:
39
39
  DOCS_MAIN = f"{API_VERSION}/docs"
40
40
  DOCS = lambda wait: with_wait(f"{DOCS_MAIN}/", wait)
41
41
  DOCS_ID = lambda id, wait: with_wait(f"{DOCS_MAIN}/{id}", wait)
42
+ DOCS_NAME = lambda name, wait: with_wait(f"{DOCS_MAIN}/name/{name}", wait)
42
43
 
43
44
  ## CollectionsController
44
45
  COLLECTIONS_MAIN = f"{API_VERSION}/collections"
@@ -2,7 +2,7 @@ import json
2
2
  import os
3
3
  import re
4
4
  import subprocess
5
- from typing import Union
5
+ from typing import Type, Union
6
6
 
7
7
  import pandas as pd
8
8
 
@@ -148,8 +148,23 @@ def get_doc(
148
148
  return f.get_docs_id(id, auth=auth, conn_url=conn_url)
149
149
 
150
150
 
151
+ def get_doc_by_name(
152
+ name: str,
153
+ *,
154
+ auth: Optional[AUTH] = None,
155
+ conn_url: Optional[str] = None,
156
+ batcher: Optional[Batcher] = None,
157
+ ) -> ResultDoc:
158
+ """return doc by `name` """
159
+ if batcher is None:
160
+ batcher = Config.BATCHER
161
+ if batcher is not None:
162
+ return batcher.add("getDocByName", vars={"name": name}, result_model=ResultDoc)
163
+ return f.get_docs_name(name, auth=auth, conn_url=conn_url)
164
+
165
+
151
166
  def create_doc(
152
- data: Alias.Json,
167
+ data: Union[Alias.Json, Dict, Type[BaseModel]],
153
168
  name: Optional[str],
154
169
  wait: bool = True,
155
170
  *,
@@ -160,6 +175,10 @@ def create_doc(
160
175
  """save doc with `data` and `name`, return `id` """
161
176
  if batcher is None:
162
177
  batcher = Config.BATCHER
178
+ if isinstance(data, Dict):
179
+ data = json.dumps(data)
180
+ elif issubclass(data.__class__, BaseModel):
181
+ data = data.model_dump_json()
163
182
  data = DocWithName(data=data, name=name)
164
183
  if batcher is not None:
165
184
  return batcher.add("postDoc", data=data)
@@ -3267,6 +3286,23 @@ def get_collection_by_name_to_df(
3267
3286
  return pd.DataFrame.from_records(records)
3268
3287
 
3269
3288
 
3289
+ def create_doc_from_file(
3290
+ filename: str,
3291
+ name: Optional[str] = None,
3292
+ *,
3293
+ auth: Optional[AUTH] = None,
3294
+ conn_url: Optional[str] = None,
3295
+ batcher: Optional[Batcher] = None,
3296
+ ) -> Alias.Id:
3297
+ """create doc\n
3298
+ return doc id"""
3299
+ with open(filename) as f:
3300
+ data = json.load(f)
3301
+ return create_doc(
3302
+ data, name, auth=auth, conn_url=conn_url, batcher=batcher
3303
+ )
3304
+
3305
+
3270
3306
  def create_schemes_by_path(
3271
3307
  path: str,
3272
3308
  wait: bool = True,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: malevich-coretools
3
- Version: 0.3.19
3
+ Version: 0.3.23
4
4
  Author: Andrew Pogrebnoj
5
5
  Author-email: andrew@onjulius.co
6
6
  License-File: LICENSE
@@ -1 +0,0 @@
1
- 0.3.19