blue-assistant 4.319.1__tar.gz → 4.329.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 (83) hide show
  1. {blue_assistant-4.319.1/blue_assistant.egg-info → blue_assistant-4.329.1}/PKG-INFO +2 -2
  2. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/README.md +1 -1
  3. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/script/run.sh +3 -1
  4. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/__init__.py +1 -1
  5. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/help/script.py +26 -3
  6. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/__main__.py +6 -0
  7. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/load.py +9 -1
  8. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/base/root.py +116 -32
  9. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/blue_amo/classes.py +15 -8
  10. blue_assistant-4.329.1/blue_assistant/script/repository/functions.py +18 -0
  11. {blue_assistant-4.319.1 → blue_assistant-4.329.1/blue_assistant.egg-info}/PKG-INFO +2 -2
  12. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant.egg-info/SOURCES.txt +1 -0
  13. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/LICENSE +0 -0
  14. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/MANIFEST.in +0 -0
  15. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/abcli.sh +0 -0
  16. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/actions.sh +0 -0
  17. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/alias.sh +0 -0
  18. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/blue_assistant.sh +0 -0
  19. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/browse.sh +0 -0
  20. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/hue/create_user.sh +0 -0
  21. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/hue/list.sh +0 -0
  22. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/hue/set.sh +0 -0
  23. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/hue.sh +0 -0
  24. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/script/list.sh +0 -0
  25. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/script.sh +0 -0
  26. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/tests/README.sh +0 -0
  27. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/tests/help.sh +0 -0
  28. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/tests/script_list.sh +0 -0
  29. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/tests/script_run.sh +0 -0
  30. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/tests/version.sh +0 -0
  31. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/tests/web_crawl.sh +0 -0
  32. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/tests/web_fetch.sh +0 -0
  33. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/web/crawl.sh +0 -0
  34. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/web/fetch.sh +0 -0
  35. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/.abcli/web.sh +0 -0
  36. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/README.py +0 -0
  37. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/__main__.py +0 -0
  38. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/config.env +0 -0
  39. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/env.py +0 -0
  40. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/functions.py +0 -0
  41. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/help/__init__.py +0 -0
  42. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/help/__main__.py +0 -0
  43. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/help/functions.py +0 -0
  44. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/help/hue.py +0 -0
  45. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/help/web.py +0 -0
  46. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/host.py +0 -0
  47. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/logger.py +0 -0
  48. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/sample.env +0 -0
  49. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/__init__.py +0 -0
  50. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/actions/__init__.py +0 -0
  51. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/actions/generate_image.py +0 -0
  52. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/actions/generate_text.py +0 -0
  53. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/actions/generic.py +0 -0
  54. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/actions/web_crawl.py +0 -0
  55. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/__init__.py +0 -0
  56. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/base/__init__.py +0 -0
  57. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/base/classes.py +0 -0
  58. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/blue_amo/__init__.py +0 -0
  59. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/blue_amo/actions/__init__.py +0 -0
  60. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/blue_amo/actions/setting_frame_prompts.py +0 -0
  61. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/blue_amo/actions/stitching_the_frames.py +0 -0
  62. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/hue/__init__.py +0 -0
  63. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/hue/__main__.py +0 -0
  64. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/hue/api.py +0 -0
  65. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/hue/classes.py +0 -0
  66. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/hue/colors.py +0 -0
  67. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/orbital_data_explorer/__init__.py +0 -0
  68. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/orbital_data_explorer/actions/__init__.py +0 -0
  69. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/orbital_data_explorer/actions/expanding_the_extractions.py +0 -0
  70. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/script/repository/orbital_data_explorer/classes.py +0 -0
  71. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/urls.py +0 -0
  72. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/web/__init__.py +0 -0
  73. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/web/__main__.py +0 -0
  74. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/web/crawl.py +0 -0
  75. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/web/fetch.py +0 -0
  76. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant/web/functions.py +0 -0
  77. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant.egg-info/dependency_links.txt +0 -0
  78. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant.egg-info/requires.txt +0 -0
  79. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/blue_assistant.egg-info/top_level.txt +0 -0
  80. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/pyproject.toml +0 -0
  81. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/requirements.txt +0 -0
  82. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/setup.cfg +0 -0
  83. {blue_assistant-4.319.1 → blue_assistant-4.329.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.319.1
3
+ Version: 4.329.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -124,4 +124,4 @@ Also home to [`@web`](https://raw.githubusercontent.com/kamangir/blue-assistant/
124
124
 
125
125
  [![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)
126
126
 
127
- built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.319.1`](https://github.com/kamangir/blue-assistant).
127
+ built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.329.1`](https://github.com/kamangir/blue-assistant).
@@ -79,4 +79,4 @@ Also home to [`@web`](./blue_assistant/web/)
79
79
 
80
80
  [![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)
81
81
 
82
- built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.319.1`](https://github.com/kamangir/blue-assistant).
82
+ built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.329.1`](https://github.com/kamangir/blue-assistant).
@@ -8,8 +8,9 @@ function blue_assistant_script_run() {
8
8
 
9
9
  local script_options=$2
10
10
  local script_name=$(abcli_option "$script_options" script base)
11
+ local script_version=$(abcli_option "$script_options" version base)
11
12
 
12
- local object_name=$(abcli_clarify_object $3 $script_name-$(abcli_string_timestamp_short))
13
+ local object_name=$(abcli_clarify_object $3 $script_name-$script_version-$(abcli_string_timestamp_short))
13
14
  [[ "$do_download" == 1 ]] &&
14
15
  abcli_download - $object_name
15
16
 
@@ -19,6 +20,7 @@ function blue_assistant_script_run() {
19
20
  python3 -m blue_assistant.script \
20
21
  run \
21
22
  --script_name $script_name \
23
+ --script_version $script_version \
22
24
  --object_name $object_name \
23
25
  "${@:4}"
24
26
  [[ $? -ne 0 ]] && return 1
@@ -4,7 +4,7 @@ ICON = "🧠"
4
4
 
5
5
  DESCRIPTION = f"{ICON} An AI Assistant."
6
6
 
7
- VERSION = "4.319.1"
7
+ VERSION = "4.329.1"
8
8
 
9
9
  REPO_NAME = "blue-assistant"
10
10
 
@@ -1,8 +1,10 @@
1
1
  from typing import List
2
+ from functools import reduce
2
3
 
3
4
  from blue_options.terminal import show_usage, xtra
4
5
 
5
6
  from blue_assistant.script.repository import list_of_script_names
7
+ from blue_assistant.script.repository.functions import get_script_versions
6
8
 
7
9
 
8
10
  def help_list(
@@ -32,7 +34,7 @@ def help_run(
32
34
  ) -> str:
33
35
  options = xtra("~download,dryrun,~upload", mono=mono)
34
36
 
35
- script_options = "script=<script>"
37
+ script_options = "script=<name>,version=<version>"
36
38
 
37
39
  args = [
38
40
  "[--test_mode 1]",
@@ -40,6 +42,20 @@ def help_run(
40
42
  "[--runnable <~node_1,~node_2>]",
41
43
  ]
42
44
 
45
+ def script_version_details(script_name: str) -> List[str]:
46
+ list_of_script_versions = get_script_versions(script_name)
47
+
48
+ return (
49
+ [
50
+ "{}: {}".format(
51
+ script_name,
52
+ " | ".join(list_of_script_versions),
53
+ )
54
+ ]
55
+ if list_of_script_versions
56
+ else []
57
+ )
58
+
43
59
  return show_usage(
44
60
  [
45
61
  "@assistant",
@@ -50,9 +66,16 @@ def help_run(
50
66
  "[-|<object-name>]",
51
67
  ]
52
68
  + args,
53
- "run <object-name>.",
69
+ "run <script-name>/<script-version> in <object-name>.",
54
70
  {
55
- "script: {}".format(" | ".join(list_of_script_names)): [],
71
+ "name: {}".format(" | ".join(list_of_script_names)): reduce(
72
+ lambda x, y: x + y,
73
+ [
74
+ script_version_details(script_name)
75
+ for script_name in list_of_script_names
76
+ ],
77
+ [],
78
+ )
56
79
  },
57
80
  mono=mono,
58
81
  )
@@ -21,6 +21,11 @@ parser.add_argument(
21
21
  type=str,
22
22
  help=" | ".join(list_of_script_names),
23
23
  )
24
+ parser.add_argument(
25
+ "--script_version",
26
+ type=str,
27
+ default="base",
28
+ )
24
29
  parser.add_argument(
25
30
  "--object_name",
26
31
  type=str,
@@ -71,6 +76,7 @@ if args.task == "list":
71
76
  elif args.task == "run":
72
77
  success, script = load_script(
73
78
  script_name=args.script_name,
79
+ script_version=args.script_version,
74
80
  object_name=args.object_name,
75
81
  test_mode=args.test_mode == 1,
76
82
  verbose=args.verbose == 1,
@@ -8,8 +8,11 @@ from blue_assistant.logger import logger
8
8
  def load_script(
9
9
  script_name: str,
10
10
  object_name: str,
11
+ script_version: str = "base",
11
12
  test_mode: bool = False,
13
+ log: bool = True,
12
14
  verbose: bool = False,
15
+ save_graph: bool = True,
13
16
  ) -> Tuple[bool, BaseScript]:
14
17
  found: bool = False
15
18
  script_class: Type[BaseScript] = BaseScript
@@ -22,8 +25,13 @@ def load_script(
22
25
  if not found:
23
26
  logger.error(f"{script_name}: script not found.")
24
27
 
25
- return found, script_class(
28
+ script = script_class(
29
+ script_version=script_version,
26
30
  object_name=object_name,
27
31
  test_mode=test_mode,
32
+ log=log,
28
33
  verbose=verbose,
34
+ save_graph=save_graph,
29
35
  )
36
+
37
+ return found and script.valid, script
@@ -6,7 +6,7 @@ from tqdm import tqdm
6
6
 
7
7
  from blue_options.options import Options
8
8
  from blue_objects import file, path, objects
9
- from blue_objects.metadata import post_to_object
9
+ from blue_objects.metadata import post_to_object, get_from_object
10
10
  from blueflow.workflow import dot_file
11
11
 
12
12
  from blue_assistant.logger import logger
@@ -18,9 +18,14 @@ class RootScript:
18
18
  def __init__(
19
19
  self,
20
20
  object_name: str,
21
+ script_version: str = "base",
21
22
  test_mode: bool = False,
23
+ log: bool = True,
22
24
  verbose: bool = False,
25
+ save_graph: bool = True,
23
26
  ):
27
+ self.valid = False
28
+
24
29
  self.nodes_changed = False
25
30
 
26
31
  self.object_name = object_name
@@ -38,64 +43,133 @@ class RootScript:
38
43
  )
39
44
  self.metadata: Dict
40
45
  success, self.metadata = file.load_yaml(metadata_filename)
41
- assert success, f"cannot load {self.name}/metadata.yaml"
46
+ if not success:
47
+ logger.error(f"cannot load {self.name}/metadata.yaml")
48
+ return
49
+
50
+ # validate and set
51
+ last_script_version = get_from_object(
52
+ object_name,
53
+ "script_version",
54
+ script_version,
55
+ )
56
+ if script_version != last_script_version:
57
+ logger.error(
58
+ "script version in {} is {} != {}".format(
59
+ object_name,
60
+ last_script_version,
61
+ script_version,
62
+ )
63
+ )
64
+ return
65
+ if not post_to_object(
66
+ object_name,
67
+ "script_version",
68
+ script_version,
69
+ ):
70
+ return
71
+ if log:
72
+ logger.info(f"script version: {script_version}")
42
73
 
43
74
  self.metadata.setdefault("script", {})
44
- assert isinstance(
45
- self.script,
46
- dict,
47
- ), "script: expected dict, received {}.".format(
48
- self.script.__class__.__name__,
49
- )
75
+ if not isinstance(self.script, dict):
76
+ logger.error(
77
+ "script: expected dict, received {}.".format(
78
+ self.script.__class__.__name__,
79
+ )
80
+ )
81
+ return
50
82
 
51
83
  self.script.setdefault("nodes", {})
52
- assert isinstance(
84
+ if not isinstance(
53
85
  self.nodes,
54
86
  dict,
55
- ), "nodes: expected dict, received {}.".format(
56
- self.nodes.__class__.__name__,
57
- )
87
+ ):
88
+ logger.error(
89
+ "nodes: expected dict, received {}.".format(
90
+ self.nodes.__class__.__name__,
91
+ )
92
+ )
93
+ return
58
94
 
59
95
  self.script.setdefault("vars", {})
60
- assert isinstance(
96
+ if not isinstance(
61
97
  self.vars,
62
98
  dict,
63
- ), "vars: expected dict, received {}.".format(
64
- self.vars.__class__.__name__,
65
- )
99
+ ):
100
+ logger.error(
101
+ "vars: expected dict, received {}.".format(
102
+ self.vars.__class__.__name__,
103
+ )
104
+ )
105
+ return
106
+
107
+ self.script.setdefault("versions", {})
108
+ if not isinstance(
109
+ self.versions,
110
+ dict,
111
+ ):
112
+ logger.error(
113
+ "versions: expected dict, received {}.".format(
114
+ self.versions.__class__.__name__,
115
+ )
116
+ )
117
+ return
118
+
119
+ if script_version != "base":
120
+ if script_version not in self.versions:
121
+ logger.error(f"{script_version}: script version not found.")
122
+ return
123
+
124
+ for thing in ["vars", "nodes"]:
125
+ updates = self.versions[script_version].get(thing, {})
126
+ if len(updates) and log:
127
+ logger.info(f"{thing}.update({updates})")
128
+ self.metadata["script"][thing].update(updates)
66
129
 
67
130
  if self.test_mode:
68
- logger.info("🧪 test mode is on.")
131
+ if log:
132
+ logger.info("🧪 test mode is on.")
69
133
 
70
134
  if "test_mode" in self.script:
71
135
  updates = self.script["test_mode"]
72
- logger.info(f"🧪 vars.update({updates})")
136
+ if log:
137
+ logger.info(f"🧪 vars.update({updates})")
73
138
  self.vars.update(updates)
74
139
 
75
140
  for node_name, node in self.nodes.items():
76
141
  if "test_mode" in node:
77
142
  updates = node["test_mode"]
78
- logger.info(f"🧪 {node_name}.update({updates})")
143
+ if log:
144
+ logger.info(f"🧪 {node_name}.update({updates})")
79
145
  node.update(updates)
80
146
 
81
- logger.info(
82
- "loaded {} node(s): {}".format(
83
- len(self.nodes),
84
- ", ".join(self.nodes.keys()),
147
+ if log:
148
+ logger.info(
149
+ "loaded {} node(s): {}".format(
150
+ len(self.nodes),
151
+ ", ".join(self.nodes.keys()),
152
+ )
85
153
  )
86
- )
87
154
 
88
- logger.info(
89
- "loaded {} var(s): {}".format(
90
- len(self.vars),
91
- ", ".join(self.vars.keys()),
155
+ logger.info(
156
+ "loaded {} var(s): {}".format(
157
+ len(self.vars),
158
+ ", ".join(self.vars.keys()),
159
+ )
92
160
  )
93
- )
94
161
  if verbose:
95
162
  for var_name, var_value in self.vars.items():
96
163
  logger.info("{}: {}".format(var_name, var_value))
97
164
 
98
- assert self.generate_graph(), "cannot generate graph."
165
+ if not self.generate_graph(
166
+ log=log,
167
+ verbose=verbose,
168
+ save_graph=save_graph,
169
+ ):
170
+ return
171
+
172
+ self.valid = True
99
173
 
100
174
  def __str__(self) -> str:
101
175
  return "{}[{} var(s), {} node(s) -> {}]".format(
@@ -118,7 +192,9 @@ class RootScript:
118
192
 
119
193
  def generate_graph(
120
194
  self,
195
+ log: bool = True,
121
196
  verbose: bool = False,
197
+ save_graph: bool = True,
122
198
  ) -> bool:
123
199
  self.G: nx.DiGraph = nx.DiGraph()
124
200
 
@@ -143,7 +219,7 @@ class RootScript:
143
219
  if dependency:
144
220
  self.G.add_edge(node_name, dependency)
145
221
 
146
- return self.save_graph()
222
+ return self.save_graph(log=log) if save_graph else True
147
223
 
148
224
  def get_context(
149
225
  self,
@@ -246,7 +322,10 @@ class RootScript:
246
322
 
247
323
  return success
248
324
 
249
- def save_graph(self) -> bool:
325
+ def save_graph(
326
+ self,
327
+ log: bool = True,
328
+ ) -> bool:
250
329
  return dot_file.save_to_file(
251
330
  objects.path_of(
252
331
  filename="workflow.dot",
@@ -260,6 +339,7 @@ class RootScript:
260
339
  ]
261
340
  ),
262
341
  add_legend=False,
342
+ log=log,
263
343
  )
264
344
 
265
345
  # Aliases
@@ -274,3 +354,7 @@ class RootScript:
274
354
  @property
275
355
  def vars(self) -> Dict:
276
356
  return self.metadata["script"]["vars"]
357
+
358
+ @property
359
+ def versions(self) -> Dict:
360
+ return self.metadata["script"]["versions"]
@@ -21,19 +21,26 @@ class BlueAmoScript(BaseScript):
21
21
 
22
22
  def generate_graph(
23
23
  self,
24
+ log: bool = True,
24
25
  verbose: bool = False,
26
+ save_graph: bool = True,
25
27
  ) -> bool:
26
- if not super().generate_graph(verbose=verbose):
28
+ if not super().generate_graph(
29
+ log=log,
30
+ verbose=verbose,
31
+ save_graph=save_graph,
32
+ ):
27
33
  return False
28
34
 
29
35
  map_node_name = "generating_the_frames"
30
- logger.info(
31
- "{}: expanding {} X {}...".format(
32
- NAME,
33
- map_node_name,
34
- self.vars["frame_count"],
36
+ if log:
37
+ logger.info(
38
+ "{}: expanding {} X {}...".format(
39
+ NAME,
40
+ map_node_name,
41
+ self.vars["frame_count"],
42
+ )
35
43
  )
36
- )
37
44
 
38
45
  map_node = self.nodes[map_node_name]
39
46
  del self.nodes[map_node_name]
@@ -55,4 +62,4 @@ class BlueAmoScript(BaseScript):
55
62
  node_name,
56
63
  )
57
64
 
58
- return self.save_graph()
65
+ return self.save_graph(log=log) if save_graph else True
@@ -0,0 +1,18 @@
1
+ from typing import List, Tuple
2
+
3
+ from blue_options import string
4
+
5
+ from blue_assistant.script.load import load_script
6
+
7
+
8
+ def get_script_versions(
9
+ script_name: str,
10
+ ) -> List[str]:
11
+ success, script = load_script(
12
+ script_name=script_name,
13
+ object_name=string.timestamp(),
14
+ log=False,
15
+ save_graph=False,
16
+ )
17
+
18
+ return list(script.versions.keys()) if success else []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_assistant
3
- Version: 4.319.1
3
+ Version: 4.329.1
4
4
  Summary: 🧠 An AI Assistant.
5
5
  Home-page: https://github.com/kamangir/blue-assistant
6
6
  Author: Arash Abadpour (Kamangir)
@@ -124,4 +124,4 @@ Also home to [`@web`](https://raw.githubusercontent.com/kamangir/blue-assistant/
124
124
 
125
125
  [![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)
126
126
 
127
- built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.319.1`](https://github.com/kamangir/blue-assistant).
127
+ built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🧠 [`blue_assistant-4.329.1`](https://github.com/kamangir/blue-assistant).
@@ -56,6 +56,7 @@ blue_assistant/script/actions/generate_text.py
56
56
  blue_assistant/script/actions/generic.py
57
57
  blue_assistant/script/actions/web_crawl.py
58
58
  blue_assistant/script/repository/__init__.py
59
+ blue_assistant/script/repository/functions.py
59
60
  blue_assistant/script/repository/base/__init__.py
60
61
  blue_assistant/script/repository/base/classes.py
61
62
  blue_assistant/script/repository/base/root.py