blue-assistant 4.32.1__tar.gz → 4.43.1__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.
Files changed (53) hide show
  1. {blue_assistant-4.32.1/blue_assistant.egg-info → blue_assistant-4.43.1}/PKG-INFO +8 -6
  2. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/README.md +6 -4
  3. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/script/run.sh +9 -3
  4. blue_assistant-4.43.1/blue_assistant/.abcli/tests/script_run.sh +27 -0
  5. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/__init__.py +2 -2
  6. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/help/script.py +10 -2
  7. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/script/__main__.py +21 -5
  8. blue_assistant-4.43.1/blue_assistant/script/load.py +17 -0
  9. blue_assistant-4.43.1/blue_assistant/script/repository/__init__.py +15 -0
  10. blue_assistant-4.43.1/blue_assistant/script/repository/blue_amo/__init__.py +1 -0
  11. blue_assistant-4.43.1/blue_assistant/script/repository/blue_amo/classes.py +42 -0
  12. blue_assistant-4.43.1/blue_assistant/script/repository/generic/__init__.py +1 -0
  13. blue_assistant-4.43.1/blue_assistant/script/repository/generic/classes.py +51 -0
  14. blue_assistant-4.43.1/blue_assistant/script/repository/moon_datasets/__init__.py +1 -0
  15. blue_assistant-4.43.1/blue_assistant/script/repository/moon_datasets/classes.py +16 -0
  16. {blue_assistant-4.32.1 → blue_assistant-4.43.1/blue_assistant.egg-info}/PKG-INFO +8 -6
  17. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant.egg-info/SOURCES.txt +8 -4
  18. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/setup.py +4 -0
  19. blue_assistant-4.32.1/blue_assistant/.abcli/tests/script_run.sh +0 -11
  20. blue_assistant-4.32.1/blue_assistant/script/blue_amo.py +0 -18
  21. blue_assistant-4.32.1/blue_assistant/script/functions.py +0 -40
  22. blue_assistant-4.32.1/blue_assistant/script/generic.py +0 -41
  23. blue_assistant-4.32.1/blue_assistant/script/kinds.py +0 -6
  24. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/LICENSE +0 -0
  25. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/MANIFEST.in +0 -0
  26. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/abcli.sh +0 -0
  27. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/actions.sh +0 -0
  28. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/alias.sh +0 -0
  29. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/blue_assistant.sh +0 -0
  30. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/browse.sh +0 -0
  31. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/script.sh +0 -0
  32. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/tests/README.sh +0 -0
  33. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/tests/help.sh +0 -0
  34. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/.abcli/tests/version.sh +0 -0
  35. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/README.py +0 -0
  36. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/__main__.py +0 -0
  37. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/config.env +0 -0
  38. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/env.py +0 -0
  39. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/functions.py +0 -0
  40. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/help/__init__.py +0 -0
  41. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/help/__main__.py +0 -0
  42. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/help/functions.py +0 -0
  43. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/host.py +0 -0
  44. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/logger.py +0 -0
  45. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/sample.env +0 -0
  46. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/script/__init__.py +0 -0
  47. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant/urls.py +0 -0
  48. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant.egg-info/dependency_links.txt +0 -0
  49. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant.egg-info/requires.txt +0 -0
  50. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/blue_assistant.egg-info/top_level.txt +0 -0
  51. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/pyproject.toml +0 -0
  52. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/requirements.txt +0 -0
  53. {blue_assistant-4.32.1 → blue_assistant-4.43.1}/setup.cfg +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.32.1
4
- Summary: 🌀 An AI Assistant.
3
+ Version: 4.43.1
4
+ Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
7
7
  Author-email: arash@kamangir.net
@@ -38,9 +38,9 @@ Dynamic: license
38
38
  Dynamic: requires-dist
39
39
  Dynamic: summary
40
40
 
41
- # 🌀 blue-assistant
41
+ # 🧠 blue-assistant
42
42
 
43
- 🌀 `@assistant` is an AI assistant.
43
+ 🧠 `@assistant` is an AI assistant.
44
44
 
45
45
  ```bash
46
46
  pip install blue-assistant
@@ -48,10 +48,12 @@ pip install blue-assistant
48
48
 
49
49
  ```mermaid
50
50
  graph LR
51
- assistant_script_run["@assistant<br>script<br>run -<br>&lt;object-name&gt;"]
51
+ assistant_script_run["@assistant<br>script<br>run -<br>&lt;script&gt;<br>&lt;object-name&gt;"]
52
52
 
53
+ script["📜 script"]:::folder
53
54
  object["📂 object"]:::folder
54
55
 
56
+ script --> assistant_script_run
55
57
  object --> assistant_script_run
56
58
  assistant_script_run --> object
57
59
 
@@ -63,4 +65,4 @@ graph LR
63
65
 
64
66
  [![pylint](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-assistant.svg)](https://pypi.org/project/blue-assistant/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-assistant)](https://pypistats.org/packages/blue-assistant)
65
67
 
66
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.32.1`](https://github.com/kamangir/blue-assistant).
68
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.43.1`](https://github.com/kamangir/blue-assistant).
@@ -1,6 +1,6 @@
1
- # 🌀 blue-assistant
1
+ # 🧠 blue-assistant
2
2
 
3
- 🌀 `@assistant` is an AI assistant.
3
+ 🧠 `@assistant` is an AI assistant.
4
4
 
5
5
  ```bash
6
6
  pip install blue-assistant
@@ -8,10 +8,12 @@ pip install blue-assistant
8
8
 
9
9
  ```mermaid
10
10
  graph LR
11
- assistant_script_run["@assistant<br>script<br>run -<br>&lt;object-name&gt;"]
11
+ assistant_script_run["@assistant<br>script<br>run -<br>&lt;script&gt;<br>&lt;object-name&gt;"]
12
12
 
13
+ script["📜 script"]:::folder
13
14
  object["📂 object"]:::folder
14
15
 
16
+ script --> assistant_script_run
15
17
  object --> assistant_script_run
16
18
  assistant_script_run --> object
17
19
 
@@ -23,4 +25,4 @@ graph LR
23
25
 
24
26
  [![pylint](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-assistant.svg)](https://pypi.org/project/blue-assistant/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-assistant)](https://pypistats.org/packages/blue-assistant)
25
27
 
26
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.32.1`](https://github.com/kamangir/blue-assistant).
28
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.43.1`](https://github.com/kamangir/blue-assistant).
@@ -3,18 +3,24 @@
3
3
  function blue_assistant_script_run() {
4
4
  local options=$1
5
5
  local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
- local do_download=$(abcli_option_int "$options" download $(abcli_not $do_dryrun))
6
+ local do_download=$(abcli_option_int "$options" download 0)
7
7
  local do_upload=$(abcli_option_int "$options" upload $(abcli_not $do_dryrun))
8
8
 
9
- local object_name=$(abcli_clarify_object $2 .)
9
+ local script_options=$2
10
+ local script_name=$(abcli_option "$script_options" script generic)
11
+
12
+ local object_name=$(abcli_clarify_object $3 $script_name-$(abcli_string_timestamp_short))
10
13
  [[ "$do_download" == 1 ]] &&
11
14
  abcli_download - $object_name
12
15
 
16
+ abcli_log "running $script_name -> $object_name ..."
17
+
13
18
  abcli_eval dryrun=$do_dryrun \
14
19
  python3 -m blue_assistant.script \
15
20
  run \
21
+ --script_name $script_name \
16
22
  --object_name $object_name \
17
- "${@:3}"
23
+ "${@:4}"
18
24
  [[ $? -ne 0 ]] && return 1
19
25
 
20
26
  [[ "$do_upload" == 1 ]] &&
@@ -0,0 +1,27 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function test_blue_assistant_script_run() {
4
+ local options=$1
5
+ local list_of_script_name=$(python3 -m blue_assistant.script \
6
+ get_list_of \
7
+ --delim +)
8
+ list_of_script_name=$(abcli_option "$options" script $list_of_script_name)
9
+
10
+ local script_name
11
+ for script_name in $(echo "$list_of_script_name" | tr + " "); do
12
+ abcli_log "testing $script_name ..."
13
+
14
+ abcli_eval ,$options \
15
+ blue_assistant_script_run \
16
+ ~upload,$options \
17
+ script=$script_name \
18
+ test_blue_assistant_script_run-$(abcli_string_timestamp_short) \
19
+ "${@:2}"
20
+
21
+ [[ $? -ne 0 ]] && return 1
22
+
23
+ abcli_hr
24
+ done
25
+
26
+ return 0
27
+ }
@@ -1,10 +1,10 @@
1
1
  NAME = "blue_assistant"
2
2
 
3
- ICON = "🌀"
3
+ ICON = "🧠"
4
4
 
5
5
  DESCRIPTION = f"{ICON} An AI Assistant."
6
6
 
7
- VERSION = "4.32.1"
7
+ VERSION = "4.43.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -2,12 +2,16 @@ from typing import List
2
2
 
3
3
  from blue_options.terminal import show_usage, xtra
4
4
 
5
+ from blue_assistant.script.repository import list_of_script_names
6
+
5
7
 
6
8
  def help_run(
7
9
  tokens: List[str],
8
10
  mono: bool,
9
11
  ) -> str:
10
- options = xtra("~download,dryrun,~upload", mono=mono)
12
+ options = xtra("download,dryrun,~upload", mono=mono)
13
+
14
+ script_options = "script=<script>"
11
15
 
12
16
  args = ["--verbose 1"]
13
17
 
@@ -17,10 +21,14 @@ def help_run(
17
21
  "script",
18
22
  "run",
19
23
  f"[{options}]",
20
- "[.|<object-name>]",
24
+ f"[{script_options}]",
25
+ "[-|<object-name>]",
21
26
  ]
22
27
  + args,
23
28
  "run <object-name>.",
29
+ {
30
+ "script: {}".format(" | ".join(list_of_script_names)): [],
31
+ },
24
32
  mono=mono,
25
33
  )
26
34
 
@@ -4,7 +4,8 @@ from blueness import module
4
4
  from blueness.argparse.generic import sys_exit
5
5
 
6
6
  from blue_assistant import NAME
7
- from blue_assistant.script.functions import load_script
7
+ from blue_assistant.script.load import load_script
8
+ from blue_assistant.script.repository import list_of_script_names
8
9
  from blue_assistant.logger import logger
9
10
 
10
11
  NAME = module.name(__file__, NAME)
@@ -13,7 +14,12 @@ parser = argparse.ArgumentParser(NAME)
13
14
  parser.add_argument(
14
15
  "task",
15
16
  type=str,
16
- help="run",
17
+ help="get_list_of | run",
18
+ )
19
+ parser.add_argument(
20
+ "--script_name",
21
+ type=str,
22
+ help=" | ".join(list_of_script_names),
17
23
  )
18
24
  parser.add_argument(
19
25
  "--object_name",
@@ -25,17 +31,27 @@ parser.add_argument(
25
31
  default=0,
26
32
  help="0 | 1",
27
33
  )
34
+ parser.add_argument(
35
+ "--delim",
36
+ type=str,
37
+ default="+",
38
+ )
28
39
  args = parser.parse_args()
29
40
 
41
+ delim = " " if args.delim == "space" else args.delim
42
+
30
43
  success = False
31
- if args.task == "run":
44
+ if args.task == "get_list_of":
45
+ success = True
46
+ print(delim.join(list_of_script_names))
47
+ elif args.task == "run":
32
48
  success, script = load_script(
33
- object_name=args.object_name,
49
+ script_name=args.script_name,
34
50
  verbose=args.verbose == 1,
35
51
  )
36
52
 
37
53
  if success:
38
- success = script.run()
54
+ success = script.run(object_name=args.object_name)
39
55
  else:
40
56
  success = None
41
57
 
@@ -0,0 +1,17 @@
1
+ from typing import Tuple
2
+
3
+ from blue_assistant.script.repository import list_of_script_classes
4
+ from blue_assistant.script.repository.generic import GenericScript
5
+ from blue_assistant.logger import logger
6
+
7
+
8
+ def load_script(
9
+ script_name: str,
10
+ verbose: bool = False,
11
+ ) -> Tuple[bool, GenericScript]:
12
+ for script_class in list_of_script_classes:
13
+ if script_class.name == script_name:
14
+ return True, script_class(verbose=verbose)
15
+
16
+ logger.error(f"{script_name}: script not found.")
17
+ return False, GenericScript(verbose=verbose)
@@ -0,0 +1,15 @@
1
+ from typing import List, Type
2
+
3
+ from blue_assistant.script.repository.generic import GenericScript
4
+ from blue_assistant.script.repository.blue_amo.classes import BlueAmoScript
5
+ from blue_assistant.script.repository.moon_datasets.classes import MiningOnMoonScript
6
+
7
+ list_of_script_classes: List[Type[GenericScript]] = [
8
+ GenericScript,
9
+ BlueAmoScript,
10
+ MiningOnMoonScript,
11
+ ]
12
+
13
+ list_of_script_names: List[str] = [
14
+ script_class.name for script_class in list_of_script_classes
15
+ ]
@@ -0,0 +1 @@
1
+ from blue_assistant.script.repository.blue_amo.classes import BlueAmoScript
@@ -0,0 +1,42 @@
1
+ from typing import Dict
2
+ from tqdm import tqdm
3
+
4
+ from blue_objects import file, path
5
+ from blue_objects.metadata import post_to_object
6
+
7
+ from blue_assistant.script.repository.generic.classes import GenericScript
8
+ from blue_assistant.logger import logger
9
+
10
+
11
+ class BlueAmoScript(GenericScript):
12
+ name = path.name(file.path(__file__))
13
+
14
+ def __init__(
15
+ self,
16
+ verbose: bool = False,
17
+ ):
18
+ super().__init__(verbose=verbose)
19
+
20
+ def run(
21
+ self,
22
+ object_name: str,
23
+ ) -> bool:
24
+ if not super().run(object_name=object_name):
25
+ return False
26
+
27
+ metadata: Dict[Dict] = {"nodes": {}}
28
+ for node_name, node in tqdm(self.script["nodes"].items()):
29
+ logger.info(
30
+ "{}{}".format(
31
+ node_name,
32
+ f": {node}" if self.verbose else " ...",
33
+ )
34
+ )
35
+
36
+ metadata["nodes"][node_name] = "..."
37
+
38
+ return post_to_object(
39
+ object_name,
40
+ "output",
41
+ metadata,
42
+ )
@@ -0,0 +1 @@
1
+ from blue_assistant.script.repository.generic.classes import GenericScript
@@ -0,0 +1,51 @@
1
+ import os
2
+
3
+ from blueness import module
4
+ from blue_objects import file, path
5
+ from blue_objects.metadata import post_to_object
6
+
7
+ from blue_assistant import NAME
8
+ from blue_assistant.logger import logger
9
+
10
+
11
+ NAME = module.name(__file__, NAME)
12
+
13
+
14
+ class GenericScript:
15
+ name = path.name(file.path(__file__))
16
+
17
+ def __init__(
18
+ self,
19
+ verbose: bool = False,
20
+ ):
21
+ self.verbose = verbose
22
+
23
+ metadata_filename = os.path.join(
24
+ file.path(__file__),
25
+ f"../{self.name}",
26
+ "metadata.yaml",
27
+ )
28
+ success, self.metadata = file.load_yaml(metadata_filename)
29
+
30
+ self.script = self.metadata.get("script", [])
31
+
32
+ assert success, f"cannot load {self.name}/metadata.yaml"
33
+
34
+ def run(
35
+ self,
36
+ object_name: str,
37
+ ) -> bool:
38
+ logger.info(
39
+ "{}.run: {}:{} -> {}".format(
40
+ NAME,
41
+ self.__class__.__name__,
42
+ self.name,
43
+ object_name,
44
+ )
45
+ )
46
+
47
+ return post_to_object(
48
+ object_name,
49
+ "input",
50
+ self.script,
51
+ )
@@ -0,0 +1 @@
1
+ from blue_assistant.script.repository.moon_datasets.classes import MiningOnMoonScript
@@ -0,0 +1,16 @@
1
+ from typing import Dict
2
+ from tqdm import tqdm
3
+
4
+ from blue_objects import file, path
5
+
6
+ from blue_assistant.script.repository.generic.classes import GenericScript
7
+
8
+
9
+ class MiningOnMoonScript(GenericScript):
10
+ name = path.name(file.path(__file__))
11
+
12
+ def __init__(
13
+ self,
14
+ verbose: bool = False,
15
+ ):
16
+ super().__init__(verbose=verbose)
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.32.1
4
- Summary: 🌀 An AI Assistant.
3
+ Version: 4.43.1
4
+ Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
7
7
  Author-email: arash@kamangir.net
@@ -38,9 +38,9 @@ Dynamic: license
38
38
  Dynamic: requires-dist
39
39
  Dynamic: summary
40
40
 
41
- # 🌀 blue-assistant
41
+ # 🧠 blue-assistant
42
42
 
43
- 🌀 `@assistant` is an AI assistant.
43
+ 🧠 `@assistant` is an AI assistant.
44
44
 
45
45
  ```bash
46
46
  pip install blue-assistant
@@ -48,10 +48,12 @@ pip install blue-assistant
48
48
 
49
49
  ```mermaid
50
50
  graph LR
51
- assistant_script_run["@assistant<br>script<br>run -<br>&lt;object-name&gt;"]
51
+ assistant_script_run["@assistant<br>script<br>run -<br>&lt;script&gt;<br>&lt;object-name&gt;"]
52
52
 
53
+ script["📜 script"]:::folder
53
54
  object["📂 object"]:::folder
54
55
 
56
+ script --> assistant_script_run
55
57
  object --> assistant_script_run
56
58
  assistant_script_run --> object
57
59
 
@@ -63,4 +65,4 @@ graph LR
63
65
 
64
66
  [![pylint](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-assistant/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-assistant.svg)](https://pypi.org/project/blue-assistant/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-assistant)](https://pypistats.org/packages/blue-assistant)
65
67
 
66
- built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_assistant-4.32.1`](https://github.com/kamangir/blue-assistant).
68
+ built by 🌀 [`blue_options-4.207.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.43.1`](https://github.com/kamangir/blue-assistant).
@@ -36,7 +36,11 @@ blue_assistant/help/functions.py
36
36
  blue_assistant/help/script.py
37
37
  blue_assistant/script/__init__.py
38
38
  blue_assistant/script/__main__.py
39
- blue_assistant/script/blue_amo.py
40
- blue_assistant/script/functions.py
41
- blue_assistant/script/generic.py
42
- blue_assistant/script/kinds.py
39
+ blue_assistant/script/load.py
40
+ blue_assistant/script/repository/__init__.py
41
+ blue_assistant/script/repository/blue_amo/__init__.py
42
+ blue_assistant/script/repository/blue_amo/classes.py
43
+ blue_assistant/script/repository/generic/__init__.py
44
+ blue_assistant/script/repository/generic/classes.py
45
+ blue_assistant/script/repository/moon_datasets/__init__.py
46
+ blue_assistant/script/repository/moon_datasets/classes.py
@@ -11,6 +11,10 @@ setup(
11
11
  NAME,
12
12
  f"{NAME}.help",
13
13
  f"{NAME}.script",
14
+ f"{NAME}.script.repository",
15
+ f"{NAME}.script.repository.blue_amo",
16
+ f"{NAME}.script.repository.generic",
17
+ f"{NAME}.script.repository.moon_datasets",
14
18
  ],
15
19
  include_package_data=True,
16
20
  package_data={
@@ -1,11 +0,0 @@
1
- #! /usr/bin/env bash
2
-
3
- function test_blue_assistant_script_run() {
4
- local options=$1
5
-
6
- abcli_eval ,$options \
7
- blue_assistant_script_run \
8
- ~upload,$options \
9
- $BLUE_ASSISTANT_TEST_OBJECT \
10
- "${@:2}"
11
- }
@@ -1,18 +0,0 @@
1
- from blue_assistant.script.generic import GenericScript
2
- from blue_assistant.script.kinds import ScriptKind
3
-
4
-
5
- class BlueAmoScript(GenericScript):
6
- def __init__(
7
- self,
8
- object_name: str,
9
- verbose: bool = False,
10
- download: bool = False,
11
- ):
12
- super().__init__(
13
- object_name=object_name,
14
- verbose=verbose,
15
- download=download,
16
- )
17
-
18
- self.kind = ScriptKind.BLUE_AMO
@@ -1,40 +0,0 @@
1
- from typing import Tuple, Union, Type
2
-
3
- from blueness import module
4
- from blue_objects.metadata import get_from_object
5
-
6
- from blue_assistant import NAME
7
- from blue_assistant.script.generic import GenericScript
8
- from blue_assistant.script.blue_amo import BlueAmoScript
9
- from blue_assistant.logger import logger
10
-
11
-
12
- NAME = module.name(__file__, NAME)
13
-
14
-
15
- def load_script(
16
- object_name: str,
17
- verbose: bool = False,
18
- download: bool = False,
19
- ) -> Tuple[bool, Union[GenericScript, None]]:
20
- script_kind = get_from_object(
21
- object_name=object_name,
22
- key="script.kind",
23
- default="generic",
24
- )
25
-
26
- script_class: Type[GenericScript] = GenericScript
27
- if script_kind == "blue_amo":
28
- script_class = BlueAmoScript
29
- if verbose:
30
- logger.info(f"script class: {script_class.__name__}")
31
-
32
- script = script_class(
33
- object_name=object_name,
34
- verbose=verbose,
35
- download=download,
36
- )
37
- if verbose:
38
- logger.info(f"script kind: {script.kind}")
39
-
40
- return True, script
@@ -1,41 +0,0 @@
1
- from blueness import module
2
- from blue_objects.metadata import get_from_object
3
-
4
- from blue_assistant import NAME
5
- from blue_assistant.script.kinds import ScriptKind
6
- from blue_assistant.logger import logger
7
-
8
-
9
- NAME = module.name(__file__, NAME)
10
-
11
-
12
- class GenericScript:
13
- def __init__(
14
- self,
15
- object_name: str,
16
- verbose: bool = False,
17
- download: bool = False,
18
- ):
19
- self.verbose = verbose
20
-
21
- self.object_name = object_name
22
-
23
- self.kind = ScriptKind.GENERIC
24
-
25
- self.script = get_from_object(
26
- object_name=object_name,
27
- key="script",
28
- default={},
29
- download=download,
30
- )
31
-
32
- def run(self) -> bool:
33
- logger.info(
34
- "{}.run({} @ {})".format(
35
- NAME,
36
- self.__class__.__name__,
37
- self.object_name,
38
- )
39
- )
40
-
41
- return True
@@ -1,6 +0,0 @@
1
- from enum import Enum, auto
2
-
3
-
4
- class ScriptKind(Enum):
5
- GENERIC = auto()
6
- BLUE_AMO = auto()
File without changes