bluer-objects 6.104.1__py3-none-any.whl → 6.377.1__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.
Files changed (146) hide show
  1. bluer_objects/.abcli/abcli.sh +6 -0
  2. bluer_objects/.abcli/alias.sh +11 -0
  3. bluer_objects/.abcli/assets/cd.sh +20 -0
  4. bluer_objects/.abcli/assets/mv.sh +34 -0
  5. bluer_objects/.abcli/assets/publish.sh +37 -0
  6. bluer_objects/.abcli/assets.sh +15 -0
  7. bluer_objects/.abcli/create_test_asset.sh +10 -0
  8. bluer_objects/.abcli/download.sh +3 -1
  9. bluer_objects/.abcli/file.sh +15 -4
  10. bluer_objects/.abcli/gif.sh +18 -0
  11. bluer_objects/.abcli/host.sh +23 -7
  12. bluer_objects/.abcli/ls.sh +19 -8
  13. bluer_objects/.abcli/metadata/download.sh +9 -0
  14. bluer_objects/.abcli/metadata/edit.sh +15 -0
  15. bluer_objects/.abcli/metadata/upload.sh +9 -0
  16. bluer_objects/.abcli/mlflow/browse.sh +2 -0
  17. bluer_objects/.abcli/mlflow/deploy.sh +21 -5
  18. bluer_objects/.abcli/mlflow/lock/lock.sh +11 -0
  19. bluer_objects/.abcli/mlflow/lock/unlock.sh +12 -0
  20. bluer_objects/.abcli/mlflow/lock.sh +15 -0
  21. bluer_objects/.abcli/mlflow.sh +0 -2
  22. bluer_objects/.abcli/pdf/convert.sh +92 -0
  23. bluer_objects/.abcli/pdf.sh +15 -0
  24. bluer_objects/.abcli/storage/clear.sh +2 -0
  25. bluer_objects/.abcli/tests/clone.sh +2 -3
  26. bluer_objects/.abcli/tests/create_test_asset.sh +16 -0
  27. bluer_objects/.abcli/tests/file.sh +64 -0
  28. bluer_objects/.abcli/tests/gif.sh +3 -3
  29. bluer_objects/.abcli/tests/help.sh +27 -4
  30. bluer_objects/.abcli/tests/ls.sh +11 -4
  31. bluer_objects/.abcli/tests/metadata.sh +35 -0
  32. bluer_objects/.abcli/tests/mlflow_lock.sh +30 -0
  33. bluer_objects/.abcli/tests/open.sh +11 -0
  34. bluer_objects/.abcli/tests/open_gif_open.sh +14 -0
  35. bluer_objects/.abcli/tests/pdf.sh +31 -0
  36. bluer_objects/.abcli/tests/storage_clear.sh +11 -0
  37. bluer_objects/.abcli/tests/storage_public_upload.sh +25 -0
  38. bluer_objects/.abcli/tests/storage_status.sh +12 -0
  39. bluer_objects/.abcli/tests/{storage.sh → storage_upload_download.sh} +26 -8
  40. bluer_objects/.abcli/tests/web_is_accessible.sh +17 -0
  41. bluer_objects/.abcli/tests/web_where_am_ai.sh +5 -0
  42. bluer_objects/.abcli/upload.sh +26 -2
  43. bluer_objects/.abcli/url.sh +15 -0
  44. bluer_objects/.abcli/web/is_accessible.sh +13 -0
  45. bluer_objects/.abcli/web/where_am_i.sh +5 -0
  46. bluer_objects/README/__init__.py +24 -9
  47. bluer_objects/README/alias.py +56 -0
  48. bluer_objects/README/consts.py +39 -0
  49. bluer_objects/README/functions.py +127 -205
  50. bluer_objects/README/items.py +78 -6
  51. bluer_objects/README/utils.py +275 -0
  52. bluer_objects/__init__.py +1 -1
  53. bluer_objects/assets/__init__.py +0 -0
  54. bluer_objects/assets/__main__.py +57 -0
  55. bluer_objects/assets/functions.py +62 -0
  56. bluer_objects/config.env +9 -1
  57. bluer_objects/env.py +23 -0
  58. bluer_objects/file/__main__.py +52 -7
  59. bluer_objects/file/functions.py +13 -3
  60. bluer_objects/file/load.py +2 -9
  61. bluer_objects/file/save.py +17 -24
  62. bluer_objects/graphics/__main__.py +7 -0
  63. bluer_objects/graphics/gif.py +11 -7
  64. bluer_objects/graphics/screen.py +9 -8
  65. bluer_objects/help/assets.py +96 -0
  66. bluer_objects/help/create_test_asset.py +22 -0
  67. bluer_objects/help/download.py +17 -3
  68. bluer_objects/help/file.py +59 -0
  69. bluer_objects/help/functions.py +11 -1
  70. bluer_objects/help/gif.py +25 -0
  71. bluer_objects/help/host.py +6 -4
  72. bluer_objects/help/ls.py +26 -3
  73. bluer_objects/help/metadata.py +51 -0
  74. bluer_objects/help/mlflow/__init__.py +23 -2
  75. bluer_objects/help/mlflow/lock.py +52 -0
  76. bluer_objects/help/pdf.py +67 -0
  77. bluer_objects/help/upload.py +10 -3
  78. bluer_objects/help/web.py +38 -0
  79. bluer_objects/host/functions.py +4 -1
  80. bluer_objects/logger/confusion_matrix.py +76 -0
  81. bluer_objects/logger/image.py +110 -0
  82. bluer_objects/logger/stitch.py +107 -0
  83. bluer_objects/markdown.py +8 -6
  84. bluer_objects/metadata/__init__.py +1 -0
  85. bluer_objects/metadata/flatten.py +27 -0
  86. bluer_objects/mlflow/lock/__init__.py +1 -0
  87. bluer_objects/mlflow/lock/__main__.py +58 -0
  88. bluer_objects/mlflow/lock/functions.py +121 -0
  89. bluer_objects/mlflow/logging.py +47 -41
  90. bluer_objects/pdf/__init__.py +1 -0
  91. bluer_objects/pdf/__main__.py +78 -0
  92. bluer_objects/pdf/convert/__init__.py +0 -0
  93. bluer_objects/pdf/convert/batch.py +54 -0
  94. bluer_objects/pdf/convert/combination.py +32 -0
  95. bluer_objects/pdf/convert/convert.py +111 -0
  96. bluer_objects/pdf/convert/image.py +53 -0
  97. bluer_objects/pdf/convert/md.py +97 -0
  98. bluer_objects/pdf/convert/missing.py +96 -0
  99. bluer_objects/pdf/convert/pdf.py +37 -0
  100. bluer_objects/sample.env +6 -0
  101. bluer_objects/storage/WebDAV.py +11 -7
  102. bluer_objects/storage/WebDAVrequest.py +360 -0
  103. bluer_objects/storage/WebDAVzip.py +26 -29
  104. bluer_objects/storage/__init__.py +28 -1
  105. bluer_objects/storage/__main__.py +40 -6
  106. bluer_objects/storage/base.py +84 -5
  107. bluer_objects/storage/policies.py +7 -0
  108. bluer_objects/storage/s3.py +367 -0
  109. bluer_objects/testing/__main__.py +6 -0
  110. bluer_objects/tests/test_README_consts.py +71 -0
  111. bluer_objects/tests/test_README_items.py +128 -0
  112. bluer_objects/tests/test_alias.py +33 -0
  113. bluer_objects/tests/test_env.py +25 -2
  114. bluer_objects/tests/test_file_download.py +25 -0
  115. bluer_objects/tests/test_file_load_save.py +1 -2
  116. bluer_objects/tests/test_file_load_save_text.py +46 -0
  117. bluer_objects/tests/test_graphics_gif.py +2 -0
  118. bluer_objects/tests/test_log_image_grid.py +29 -0
  119. bluer_objects/tests/test_logger_confusion_matrix.py +18 -0
  120. bluer_objects/tests/test_logger_matrix.py +2 -2
  121. bluer_objects/tests/test_logger_stitch_images.py +47 -0
  122. bluer_objects/tests/test_metadata.py +12 -6
  123. bluer_objects/tests/test_metadata_flatten.py +109 -0
  124. bluer_objects/tests/test_mlflow.py +2 -2
  125. bluer_objects/tests/test_mlflow_lock.py +26 -0
  126. bluer_objects/tests/test_objects.py +2 -0
  127. bluer_objects/tests/test_shell.py +34 -0
  128. bluer_objects/tests/test_storage.py +8 -21
  129. bluer_objects/tests/test_storage_base.py +39 -0
  130. bluer_objects/tests/test_storage_s3.py +67 -0
  131. bluer_objects/tests/test_storage_webdav_request.py +75 -0
  132. bluer_objects/tests/test_storage_webdav_zip.py +42 -0
  133. bluer_objects/tests/test_web_is_accessible.py +11 -0
  134. bluer_objects/web/__init__.py +1 -0
  135. bluer_objects/web/__main__.py +31 -0
  136. bluer_objects/web/functions.py +9 -0
  137. {bluer_objects-6.104.1.dist-info → bluer_objects-6.377.1.dist-info}/METADATA +6 -3
  138. bluer_objects-6.377.1.dist-info/RECORD +217 -0
  139. {bluer_objects-6.104.1.dist-info → bluer_objects-6.377.1.dist-info}/WHEEL +1 -1
  140. bluer_objects/.abcli/storage/download_file.sh +0 -9
  141. bluer_objects/.abcli/storage/exists.sh +0 -8
  142. bluer_objects/.abcli/storage/list.sh +0 -8
  143. bluer_objects/.abcli/storage/rm.sh +0 -11
  144. bluer_objects-6.104.1.dist-info/RECORD +0 -143
  145. {bluer_objects-6.104.1.dist-info → bluer_objects-6.377.1.dist-info}/licenses/LICENSE +0 -0
  146. {bluer_objects-6.104.1.dist-info → bluer_objects-6.377.1.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- from typing import Any, Dict, List
1
+ from typing import Any, Dict, List, Union
2
2
  import yaml
3
3
  import numpy as np
4
4
  import json
@@ -13,7 +13,6 @@ from bluer_options.host import is_jupyter
13
13
  from bluer_objects import NAME
14
14
  from bluer_objects.file.classes import JsonEncoder
15
15
  from bluer_objects.file.functions import path as file_path
16
- from bluer_objects.file.load import load_text
17
16
  from bluer_objects.path import create as path_create
18
17
  from bluer_objects.logger import logger
19
18
 
@@ -31,9 +30,15 @@ def finish_saving(
31
30
  success: bool,
32
31
  message: str,
33
32
  log: bool = True,
33
+ exception: Union[Exception, None] = None,
34
34
  ) -> bool:
35
35
  if not success:
36
- crash_report(f"{message}: failed.")
36
+ crash_report(
37
+ "{}: failed: {}".format(
38
+ message,
39
+ exception,
40
+ )
41
+ )
37
42
  elif log:
38
43
  logger.info(message)
39
44
 
@@ -105,9 +110,9 @@ def save_fig(
105
110
  try:
106
111
  import matplotlib.pyplot as plt
107
112
 
113
+ plt.savefig(filename, bbox_inches="tight")
108
114
  if is_jupyter():
109
115
  plt.show()
110
- plt.savefig(filename, bbox_inches="tight")
111
116
  plt.close()
112
117
  except:
113
118
  success = False
@@ -137,7 +142,9 @@ def save_image(
137
142
  data = np.flip(data, axis=2)
138
143
 
139
144
  cv2.imwrite(filename, data)
140
- except:
145
+ except Exception as e:
146
+ if log:
147
+ logger.error(e)
141
148
  success = False
142
149
 
143
150
  return finish_saving(
@@ -214,32 +221,15 @@ def save_matrix(
214
221
  def save_text(
215
222
  filename: str,
216
223
  text: List[str],
217
- if_different: bool = False,
218
224
  log: bool = False,
219
- remove_empty_lines: bool = False,
220
225
  ) -> bool:
221
- if remove_empty_lines:
222
- text = [
223
- line
224
- for line, next_line in zip(text, text[1:] + ["x"])
225
- if line.strip() or next_line.strip()
226
- ]
227
-
228
- if if_different:
229
- _, content = load_text(filename, ignore_error=True)
230
-
231
- if "|".join([line for line in content if line]) == "|".join(
232
- [line for line in text if line]
233
- ):
234
- return True
235
-
236
226
  if not prepare_for_saving(filename):
237
227
  return False
238
228
 
239
229
  success = True
240
230
  try:
241
231
  with open(filename, "w") as fp:
242
- fp.writelines([string + "\n" for string in text])
232
+ fp.writelines(string + "\n" for string in text)
243
233
  except:
244
234
  success = False
245
235
 
@@ -262,12 +252,14 @@ def save_yaml(
262
252
  if not prepare_for_saving(filename):
263
253
  return False
264
254
 
255
+ exception = None
265
256
  success = True
266
257
  try:
267
258
  with open(filename, "w") as f:
268
259
  yaml.dump(data, f)
269
- except:
260
+ except Exception as e:
270
261
  success = False
262
+ exception = e
271
263
 
272
264
  return finish_saving(
273
265
  success,
@@ -277,4 +269,5 @@ def save_yaml(
277
269
  filename,
278
270
  ),
279
271
  log,
272
+ exception,
280
273
  )
@@ -34,6 +34,12 @@ parser.add_argument(
34
34
  type=str,
35
35
  help="blank: <object-name>.gif",
36
36
  )
37
+ parser.add_argument(
38
+ "--frame_count",
39
+ default=-1,
40
+ type=int,
41
+ help="-1: all",
42
+ )
37
43
  parser.add_argument(
38
44
  "--frame_duration",
39
45
  default=150,
@@ -72,6 +78,7 @@ if args.task == "generate_animated_gif":
72
78
  ),
73
79
  object_name=args.object_name,
74
80
  ),
81
+ frame_count=args.frame_count,
75
82
  frame_duration=args.frame_duration,
76
83
  scale=args.scale,
77
84
  )
@@ -15,6 +15,7 @@ NAME = module.name(__file__, NAME)
15
15
  def generate_animated_gif(
16
16
  list_of_images: List[str],
17
17
  output_filename: str,
18
+ frame_count: int = -1,
18
19
  frame_duration: int = 150,
19
20
  scale: int = 1,
20
21
  log: bool = True,
@@ -22,17 +23,19 @@ def generate_animated_gif(
22
23
  if not list_of_images:
23
24
  return True
24
25
 
26
+ if frame_count != -1:
27
+ list_of_images = list_of_images[:frame_count]
28
+
25
29
  max_width = 0
26
30
  max_height = 0
27
31
  frames = []
28
32
  for filename in tqdm(list_of_images):
29
- image = Image.open(filename)
30
-
31
- frames.append(image)
33
+ with Image.open(filename) as image:
34
+ frames.append(image.copy())
32
35
 
33
- width, height = image.size
34
- max_width = max(max_width, width)
35
- max_height = max(max_height, height)
36
+ width, height = image.size
37
+ max_width = max(max_width, width)
38
+ max_height = max(max_height, height)
36
39
 
37
40
  padded_frames = []
38
41
  for image in frames:
@@ -67,7 +70,7 @@ def generate_animated_gif(
67
70
  except Exception:
68
71
  success = False
69
72
 
70
- message = "{}.generate_animated_gif({}x{}x{}) -scale={}-> {} @ {:.2f}ms".format(
73
+ message = "{}.generate_animated_gif({}x{}x{}) -scale={}-> {} @ {:.2f}ms{}".format(
71
74
  NAME,
72
75
  len(list_of_images),
73
76
  height,
@@ -75,6 +78,7 @@ def generate_animated_gif(
75
78
  scale,
76
79
  output_filename,
77
80
  frame_duration,
81
+ "" if frame_count == -1 else " [{} frame(s)]".format(frame_count),
78
82
  )
79
83
 
80
84
  if success:
@@ -24,14 +24,15 @@ def get_size() -> Tuple[int, int]:
24
24
  screen_height = 480
25
25
  screen_width = 640
26
26
 
27
- if is_rpi() and not is_headless():
28
- try:
29
- # https://stackoverflow.com/a/14124257
30
- screen = os.popen("xrandr -q -d :0").readlines()[0]
31
- screen_width = int(screen.split()[7])
32
- screen_height = int(screen.split()[9][:-1])
33
- except Exception as e:
34
- logger.error(f"{NAME}: Failed: {e}.")
27
+ if is_rpi():
28
+ if not is_headless():
29
+ try:
30
+ # https://stackoverflow.com/a/14124257
31
+ screen = os.popen("xrandr -q -d :0").readlines()[0]
32
+ screen_width = int(screen.split()[7])
33
+ screen_height = int(screen.split()[9][:-1])
34
+ except Exception as e:
35
+ logger.error(f"{NAME}: Failed: {e}.")
35
36
  elif is_mac():
36
37
  success, output = shell(
37
38
  "system_profiler SPDisplaysDataType | grep Resolution",
@@ -0,0 +1,96 @@
1
+ from typing import List
2
+
3
+ from bluer_options.terminal import show_usage, xtra
4
+ from bluer_ai.help.git import push_options
5
+
6
+
7
+ def help_cd(
8
+ tokens: List[str],
9
+ mono: bool,
10
+ ) -> str:
11
+ options = "".join(
12
+ [
13
+ xtra("create,", mono=mono),
14
+ "vol=<2>",
15
+ ]
16
+ )
17
+
18
+ return show_usage(
19
+ [
20
+ "@assets",
21
+ "cd",
22
+ f"[{options}]",
23
+ "[<path>]",
24
+ ],
25
+ "cd assets volume.",
26
+ mono=mono,
27
+ )
28
+
29
+
30
+ def help_mv(
31
+ tokens: List[str],
32
+ mono: bool,
33
+ ) -> str:
34
+ options = "".join(
35
+ [
36
+ xtra("create,", mono=mono),
37
+ "extension=<png>,vol=<2>",
38
+ ]
39
+ )
40
+
41
+ return show_usage(
42
+ [
43
+ "@assets",
44
+ "mv",
45
+ f"[{options}]",
46
+ "[<path>]",
47
+ "[push,{}]".format(
48
+ push_options(
49
+ mono=mono,
50
+ uses_actions=False,
51
+ uses_pull_request=False,
52
+ uses_workflows=False,
53
+ )
54
+ ),
55
+ ],
56
+ "mv assets to volume.",
57
+ mono=mono,
58
+ )
59
+
60
+
61
+ def help_publish(
62
+ tokens: List[str],
63
+ mono: bool,
64
+ ) -> str:
65
+ options = "".join(
66
+ [
67
+ xtra("download,", mono=mono),
68
+ "extensions=<png+txt>",
69
+ xtra(",~pull,", mono=mono),
70
+ "push",
71
+ ]
72
+ )
73
+
74
+ args = [
75
+ "[--asset_name <other-object-name>]",
76
+ "[--prefix <prefix>]",
77
+ ]
78
+
79
+ return show_usage(
80
+ [
81
+ "@assets",
82
+ "publish",
83
+ f"[{options}]",
84
+ "[.|<object-name>]",
85
+ ]
86
+ + args,
87
+ "<object-name>/<prefix> -> assets.",
88
+ mono=mono,
89
+ )
90
+
91
+
92
+ help_functions = {
93
+ "cd": help_cd,
94
+ "mv": help_mv,
95
+ "publish": help_publish,
96
+ }
@@ -0,0 +1,22 @@
1
+ from typing import List
2
+
3
+ from bluer_options.terminal import show_usage
4
+
5
+
6
+ def help_create_test_asset(
7
+ tokens: List[str],
8
+ mono: bool,
9
+ ) -> str:
10
+ args = [
11
+ "[--depth 10]",
12
+ ]
13
+
14
+ return show_usage(
15
+ [
16
+ "@create_test_asset",
17
+ "[.|<object-name>]",
18
+ ]
19
+ + args,
20
+ "create test asset.",
21
+ mono=mono,
22
+ )
@@ -2,19 +2,33 @@ from typing import List
2
2
 
3
3
  from bluer_options.terminal import show_usage, xtra
4
4
 
5
+ from bluer_objects.storage.policies import DownloadPolicy
6
+
7
+
8
+ def options(mono: bool) -> str:
9
+ return "".join(
10
+ [
11
+ "filename=<filename>",
12
+ xtra(
13
+ ",policy={}".format(
14
+ "|".join(sorted([policy.name.lower() for policy in DownloadPolicy]))
15
+ ),
16
+ mono=mono,
17
+ ),
18
+ ]
19
+ )
20
+
5
21
 
6
22
  def help_download(
7
23
  tokens: List[str],
8
24
  mono: bool,
9
25
  ) -> str:
10
- options = "filename=<filename>"
11
-
12
26
  open_options = "open,QGIS"
13
27
 
14
28
  return show_usage(
15
29
  [
16
30
  "@download",
17
- f"[{options}]",
31
+ f"[{options(mono=mono)}]",
18
32
  "[.|<object-name>]",
19
33
  f"[{open_options}]",
20
34
  ],
@@ -0,0 +1,59 @@
1
+ from typing import List
2
+
3
+ from bluer_options.terminal import show_usage, xtra
4
+
5
+
6
+ def help_replace(
7
+ tokens: List[str],
8
+ mono: bool,
9
+ ) -> str:
10
+ options = xtra("sudo", mono=mono)
11
+
12
+ args = [
13
+ "--cat 1",
14
+ "--save 0",
15
+ "--this this-1+this-2",
16
+ "--that that-1+that-2",
17
+ "--whole_line 1",
18
+ ]
19
+
20
+ return show_usage(
21
+ [
22
+ "@file",
23
+ f"[{options}]",
24
+ "replace",
25
+ "<filename>",
26
+ ]
27
+ + args,
28
+ "<this> -> <that> in <filename>.",
29
+ mono=mono,
30
+ )
31
+
32
+
33
+ def help_size(
34
+ tokens: List[str],
35
+ mono: bool,
36
+ ) -> str:
37
+ options = "-"
38
+
39
+ args = [
40
+ "--pretty 0",
41
+ ]
42
+
43
+ return show_usage(
44
+ [
45
+ "@file",
46
+ f"[{options}]",
47
+ "size",
48
+ "<filename>",
49
+ ]
50
+ + args,
51
+ "size of <filename>",
52
+ mono=mono,
53
+ )
54
+
55
+
56
+ help_functions = {
57
+ "replace": help_replace,
58
+ "size": help_size,
59
+ }
@@ -1,26 +1,36 @@
1
1
  from bluer_ai.help.generic import help_functions as generic_help_functions
2
2
 
3
3
  from bluer_objects import ALIAS
4
+ from bluer_objects.help.assets import help_functions as help_assets
4
5
  from bluer_objects.help.clone import help_clone
6
+ from bluer_objects.help.create_test_asset import help_create_test_asset
5
7
  from bluer_objects.help.download import help_download
6
- from bluer_objects.help.gif import help_gif
8
+ from bluer_objects.help.gif import help_functions as help_gif
9
+ from bluer_objects.help.file import help_functions as help_file
7
10
  from bluer_objects.help.host import help_functions as help_host
8
11
  from bluer_objects.help.ls import help_ls
9
12
  from bluer_objects.help.metadata import help_functions as help_metadata
10
13
  from bluer_objects.help.mlflow import help_functions as help_mlflow
14
+ from bluer_objects.help.pdf import help_functions as help_pdf
11
15
  from bluer_objects.help.upload import help_upload
16
+ from bluer_objects.help.web import help_functions as help_web
12
17
 
13
18
  help_functions = generic_help_functions(plugin_name=ALIAS)
14
19
 
15
20
  help_functions.update(
16
21
  {
22
+ "assets": help_assets,
17
23
  "clone": help_clone,
24
+ "create_test_asset": help_create_test_asset,
18
25
  "download": help_download,
26
+ "file": help_file,
19
27
  "gif": help_gif,
20
28
  "host": help_host,
21
29
  "ls": help_ls,
22
30
  "metadata": help_metadata,
23
31
  "mlflow": help_mlflow,
32
+ "pdf": help_pdf,
24
33
  "upload": help_upload,
34
+ "web": help_web,
25
35
  }
26
36
  )
bluer_objects/help/gif.py CHANGED
@@ -10,6 +10,7 @@ def help_gif(
10
10
  options = xtra("~download,dryrun,~upload", mono=mono)
11
11
 
12
12
  args = [
13
+ "[--frame_count <100>]",
13
14
  "[--frame_duration <150>]",
14
15
  "[--output_filename <object-name>.gif]",
15
16
  "[--scale <1>]",
@@ -26,3 +27,27 @@ def help_gif(
26
27
  "generate <object-name>.gif.",
27
28
  mono=mono,
28
29
  )
30
+
31
+
32
+ def help_gif_open(
33
+ tokens: List[str],
34
+ mono: bool,
35
+ ) -> str:
36
+ options = xtra("download,filename=<filename.gif>", mono=mono)
37
+
38
+ return show_usage(
39
+ [
40
+ "@gif",
41
+ "open",
42
+ f"[{options}]",
43
+ "[.|<object-name>]",
44
+ ],
45
+ "open <object-name>.gif.",
46
+ mono=mono,
47
+ )
48
+
49
+
50
+ help_functions = {
51
+ "": help_gif,
52
+ "open": help_gif_open,
53
+ }
@@ -24,15 +24,16 @@ def help_reboot(
24
24
  tokens: List[str],
25
25
  mono: bool,
26
26
  ) -> str:
27
- options = xtra("dryrun", mono=mono)
27
+ options = xtra("dryrun,rpi", mono=mono)
28
28
 
29
29
  return show_usage(
30
30
  [
31
31
  "@host",
32
32
  "reboot",
33
33
  f"[{options}]",
34
+ "[<machine-name>]",
34
35
  ],
35
- "reboot host.",
36
+ "reboot.",
36
37
  mono=mono,
37
38
  )
38
39
 
@@ -41,15 +42,16 @@ def help_shutdown(
41
42
  tokens: List[str],
42
43
  mono: bool,
43
44
  ) -> str:
44
- options = xtra("dryrun", mono=mono)
45
+ options = xtra("dryrun,rpi", mono=mono)
45
46
 
46
47
  return show_usage(
47
48
  [
48
49
  "@host",
49
50
  "shutdown",
50
51
  f"[{options}]",
52
+ "[<machine-name>]",
51
53
  ],
52
- "shutdown host.",
54
+ "shutdown.",
53
55
  mono=mono,
54
56
  )
55
57
 
bluer_objects/help/ls.py CHANGED
@@ -15,26 +15,49 @@ def help_ls(
15
15
  usage_1 = show_usage(
16
16
  [
17
17
  "@ls",
18
- "cloud | local",
19
- "<object-name>",
18
+ "[cloud|local]",
19
+ "[.|<object-name>]",
20
20
  ]
21
21
  + args,
22
22
  "ls <object-name>.",
23
23
  mono=mono,
24
24
  )
25
25
 
26
+ # ---
27
+
28
+ args = [
29
+ "[--delim <space>]",
30
+ "[--log <0>]",
31
+ "[--prefix <prefix>]",
32
+ ]
33
+
26
34
  usage_2 = show_usage(
27
35
  [
28
36
  "@ls",
29
- "<path>",
37
+ "[cloud|local,objects]",
38
+ ]
39
+ + args,
40
+ "ls objects.",
41
+ mono=mono,
42
+ )
43
+
44
+ # ---
45
+
46
+ usage_3 = show_usage(
47
+ [
48
+ "@ls",
49
+ "[<path>]",
30
50
  ],
31
51
  "ls <path>.",
32
52
  mono=mono,
33
53
  )
34
54
 
55
+ # ---
56
+
35
57
  return "\n".join(
36
58
  [
37
59
  usage_1,
38
60
  usage_2,
61
+ usage_3,
39
62
  ]
40
63
  )
@@ -3,6 +3,39 @@ from typing import List
3
3
  from bluer_options.terminal import show_usage, xtra
4
4
 
5
5
 
6
+ def help_download(
7
+ tokens: List[str],
8
+ mono: bool,
9
+ ) -> str:
10
+ return show_usage(
11
+ [
12
+ "@metadata",
13
+ "download",
14
+ "[. | <object-name>]",
15
+ ],
16
+ "download <object-name>/metadata",
17
+ mono=mono,
18
+ )
19
+
20
+
21
+ def help_edit(
22
+ tokens: List[str],
23
+ mono: bool,
24
+ ) -> str:
25
+ options = "download"
26
+
27
+ return show_usage(
28
+ [
29
+ "@metadata",
30
+ "edit",
31
+ f"[{options}]",
32
+ "[.|<object-name>]",
33
+ ],
34
+ "edit <object-name>/metadata",
35
+ mono=mono,
36
+ )
37
+
38
+
6
39
  def help_get(
7
40
  tokens: List[str],
8
41
  mono: bool,
@@ -146,7 +179,25 @@ def help_post(
146
179
  )
147
180
 
148
181
 
182
+ def help_upload(
183
+ tokens: List[str],
184
+ mono: bool,
185
+ ) -> str:
186
+ return show_usage(
187
+ [
188
+ "@metadata",
189
+ "upload",
190
+ "[. | <object-name>]",
191
+ ],
192
+ "upload <object-name>/metadata",
193
+ mono=mono,
194
+ )
195
+
196
+
149
197
  help_functions = {
198
+ "download": help_download,
199
+ "edit": help_edit,
150
200
  "get": help_get,
151
201
  "post": help_post,
202
+ "upload": help_upload,
152
203
  }