bluer-objects 6.3.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.

Potentially problematic release.


This version of bluer-objects might be problematic. Click here for more details.

Files changed (149) hide show
  1. bluer_objects/.abcli/abcli.sh +9 -0
  2. bluer_objects/.abcli/actions.sh +11 -0
  3. bluer_objects/.abcli/aka.sh +3 -0
  4. bluer_objects/.abcli/alias.sh +36 -0
  5. bluer_objects/.abcli/blue_objects.sh +11 -0
  6. bluer_objects/.abcli/cache.sh +5 -0
  7. bluer_objects/.abcli/clone.sh +94 -0
  8. bluer_objects/.abcli/download.sh +53 -0
  9. bluer_objects/.abcli/file.sh +8 -0
  10. bluer_objects/.abcli/gif.sh +27 -0
  11. bluer_objects/.abcli/host.sh +29 -0
  12. bluer_objects/.abcli/ls.sh +24 -0
  13. bluer_objects/.abcli/metadata/get.sh +24 -0
  14. bluer_objects/.abcli/metadata/post.sh +22 -0
  15. bluer_objects/.abcli/metadata.sh +16 -0
  16. bluer_objects/.abcli/mlflow/browse.sh +36 -0
  17. bluer_objects/.abcli/mlflow/cache.sh +31 -0
  18. bluer_objects/.abcli/mlflow/list_registered_models.sh +9 -0
  19. bluer_objects/.abcli/mlflow/log_artifacts.sh +10 -0
  20. bluer_objects/.abcli/mlflow/log_run.sh +10 -0
  21. bluer_objects/.abcli/mlflow/run.sh +11 -0
  22. bluer_objects/.abcli/mlflow/tags/clone.sh +15 -0
  23. bluer_objects/.abcli/mlflow/tags/get.sh +10 -0
  24. bluer_objects/.abcli/mlflow/tags/search.sh +12 -0
  25. bluer_objects/.abcli/mlflow/tags/set.sh +13 -0
  26. bluer_objects/.abcli/mlflow/tags.sh +16 -0
  27. bluer_objects/.abcli/mlflow/test.sh +11 -0
  28. bluer_objects/.abcli/mlflow/transition.sh +20 -0
  29. bluer_objects/.abcli/mlflow.sh +29 -0
  30. bluer_objects/.abcli/mysql/cache.sh +65 -0
  31. bluer_objects/.abcli/mysql/relations.sh +83 -0
  32. bluer_objects/.abcli/mysql/tags.sh +85 -0
  33. bluer_objects/.abcli/mysql.sh +16 -0
  34. bluer_objects/.abcli/object.sh +54 -0
  35. bluer_objects/.abcli/publish.sh +58 -0
  36. bluer_objects/.abcli/select.sh +34 -0
  37. bluer_objects/.abcli/storage/clear.sh +45 -0
  38. bluer_objects/.abcli/storage/download_file.sh +9 -0
  39. bluer_objects/.abcli/storage/exists.sh +8 -0
  40. bluer_objects/.abcli/storage/list.sh +8 -0
  41. bluer_objects/.abcli/storage/rm.sh +11 -0
  42. bluer_objects/.abcli/storage/status.sh +11 -0
  43. bluer_objects/.abcli/storage.sh +15 -0
  44. bluer_objects/.abcli/tags.sh +5 -0
  45. bluer_objects/.abcli/tests/README.sh +8 -0
  46. bluer_objects/.abcli/tests/clone.sh +32 -0
  47. bluer_objects/.abcli/tests/help.sh +85 -0
  48. bluer_objects/.abcli/tests/host.sh +7 -0
  49. bluer_objects/.abcli/tests/ls.sh +13 -0
  50. bluer_objects/.abcli/tests/metadata.sh +53 -0
  51. bluer_objects/.abcli/tests/mlflow_cache.sh +14 -0
  52. bluer_objects/.abcli/tests/mlflow_logging.sh +12 -0
  53. bluer_objects/.abcli/tests/mlflow_tags.sh +29 -0
  54. bluer_objects/.abcli/tests/mlflow_test.sh +7 -0
  55. bluer_objects/.abcli/tests/mysql_cache.sh +15 -0
  56. bluer_objects/.abcli/tests/mysql_relations.sh +20 -0
  57. bluer_objects/.abcli/tests/mysql_tags.sh +16 -0
  58. bluer_objects/.abcli/tests/test_gif.sh +13 -0
  59. bluer_objects/.abcli/tests/version.sh +10 -0
  60. bluer_objects/.abcli/upload.sh +73 -0
  61. bluer_objects/README/__init__.py +29 -0
  62. bluer_objects/README/functions.py +285 -0
  63. bluer_objects/README/items.py +30 -0
  64. bluer_objects/__init__.py +19 -0
  65. bluer_objects/__main__.py +16 -0
  66. bluer_objects/config.env +22 -0
  67. bluer_objects/env.py +72 -0
  68. bluer_objects/file/__init__.py +41 -0
  69. bluer_objects/file/__main__.py +51 -0
  70. bluer_objects/file/classes.py +38 -0
  71. bluer_objects/file/functions.py +290 -0
  72. bluer_objects/file/load.py +219 -0
  73. bluer_objects/file/save.py +280 -0
  74. bluer_objects/graphics/__init__.py +4 -0
  75. bluer_objects/graphics/__main__.py +84 -0
  76. bluer_objects/graphics/frame.py +15 -0
  77. bluer_objects/graphics/gif.py +86 -0
  78. bluer_objects/graphics/screen.py +63 -0
  79. bluer_objects/graphics/signature.py +97 -0
  80. bluer_objects/graphics/text.py +165 -0
  81. bluer_objects/help/__init__.py +0 -0
  82. bluer_objects/help/__main__.py +10 -0
  83. bluer_objects/help/functions.py +5 -0
  84. bluer_objects/host/__init__.py +1 -0
  85. bluer_objects/host/__main__.py +84 -0
  86. bluer_objects/host/functions.py +66 -0
  87. bluer_objects/logger/__init__.py +4 -0
  88. bluer_objects/logger/matrix.py +209 -0
  89. bluer_objects/markdown.py +43 -0
  90. bluer_objects/metadata/__init__.py +8 -0
  91. bluer_objects/metadata/__main__.py +110 -0
  92. bluer_objects/metadata/enums.py +29 -0
  93. bluer_objects/metadata/get.py +89 -0
  94. bluer_objects/metadata/post.py +101 -0
  95. bluer_objects/mlflow/__init__.py +28 -0
  96. bluer_objects/mlflow/__main__.py +271 -0
  97. bluer_objects/mlflow/cache.py +13 -0
  98. bluer_objects/mlflow/logging.py +81 -0
  99. bluer_objects/mlflow/models.py +57 -0
  100. bluer_objects/mlflow/objects.py +76 -0
  101. bluer_objects/mlflow/runs.py +100 -0
  102. bluer_objects/mlflow/tags.py +90 -0
  103. bluer_objects/mlflow/testing.py +39 -0
  104. bluer_objects/mysql/cache/__init__.py +8 -0
  105. bluer_objects/mysql/cache/__main__.py +91 -0
  106. bluer_objects/mysql/cache/functions.py +181 -0
  107. bluer_objects/mysql/relations/__init__.py +9 -0
  108. bluer_objects/mysql/relations/__main__.py +138 -0
  109. bluer_objects/mysql/relations/functions.py +180 -0
  110. bluer_objects/mysql/table.py +144 -0
  111. bluer_objects/mysql/tags/__init__.py +1 -0
  112. bluer_objects/mysql/tags/__main__.py +130 -0
  113. bluer_objects/mysql/tags/functions.py +203 -0
  114. bluer_objects/objects.py +167 -0
  115. bluer_objects/path.py +194 -0
  116. bluer_objects/sample.env +16 -0
  117. bluer_objects/storage/__init__.py +3 -0
  118. bluer_objects/storage/__main__.py +114 -0
  119. bluer_objects/storage/classes.py +237 -0
  120. bluer_objects/tests/__init__.py +0 -0
  121. bluer_objects/tests/test_README.py +5 -0
  122. bluer_objects/tests/test_env.py +27 -0
  123. bluer_objects/tests/test_file_load_save.py +105 -0
  124. bluer_objects/tests/test_fullname.py +5 -0
  125. bluer_objects/tests/test_graphics.py +28 -0
  126. bluer_objects/tests/test_graphics_frame.py +11 -0
  127. bluer_objects/tests/test_graphics_gif.py +29 -0
  128. bluer_objects/tests/test_graphics_screen.py +8 -0
  129. bluer_objects/tests/test_graphics_signature.py +80 -0
  130. bluer_objects/tests/test_graphics_text.py +14 -0
  131. bluer_objects/tests/test_logger.py +5 -0
  132. bluer_objects/tests/test_logger_matrix.py +73 -0
  133. bluer_objects/tests/test_markdown.py +10 -0
  134. bluer_objects/tests/test_metadata.py +204 -0
  135. bluer_objects/tests/test_mlflow.py +60 -0
  136. bluer_objects/tests/test_mysql_cache.py +14 -0
  137. bluer_objects/tests/test_mysql_relations.py +16 -0
  138. bluer_objects/tests/test_mysql_table.py +9 -0
  139. bluer_objects/tests/test_mysql_tags.py +13 -0
  140. bluer_objects/tests/test_objects.py +180 -0
  141. bluer_objects/tests/test_path.py +7 -0
  142. bluer_objects/tests/test_storage.py +7 -0
  143. bluer_objects/tests/test_version.py +5 -0
  144. bluer_objects/urls.py +3 -0
  145. bluer_objects-6.3.1.dist-info/METADATA +57 -0
  146. bluer_objects-6.3.1.dist-info/RECORD +149 -0
  147. bluer_objects-6.3.1.dist-info/WHEEL +5 -0
  148. bluer_objects-6.3.1.dist-info/licenses/LICENSE +121 -0
  149. bluer_objects-6.3.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,65 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_mysql_cache() {
4
+ local task=$(abcli_unpack_keyword $1 help)
5
+ local keyword=$2
6
+
7
+ if [ "$task" == "help" ]; then
8
+ abcli_show_usage "@mysql cache clone$ABCUL<object-1>$ABCUL<object-2>" \
9
+ "clone the mysql cache from <object-1> to <object-2>."
10
+
11
+ abcli_show_usage "@mysql cache read$ABCUL<keyword>" \
12
+ "read mysql.cache[<keyword>]."
13
+
14
+ abcli_show_usage "@mysql cache search$ABCUL<keyword>" \
15
+ "search in the mysql cache for <keyword>."
16
+
17
+ abcli_show_usage "@mysql cache write$ABCUL<keyword> <value>$ABCUL[validate]" \
18
+ "write mysql.cache[<keyword>]=value."
19
+ return
20
+ fi
21
+
22
+ if [ "$task" == "clone" ]; then
23
+ python3 -m bluer_objects.mysql.cache \
24
+ clone \
25
+ --source "$2" \
26
+ --destination "$3" \
27
+ "${@:4}"
28
+ return
29
+ fi
30
+
31
+ if [ "$task" == "read" ]; then
32
+ python3 -m bluer_objects.mysql.cache \
33
+ read \
34
+ --keyword "$keyword" \
35
+ "${@:3}"
36
+ return
37
+ fi
38
+
39
+ if [ "$task" == "search" ]; then
40
+ python3 -m bluer_objects.mysql.cache \
41
+ search \
42
+ --keyword "$keyword" \
43
+ "${@:3}"
44
+ return
45
+ fi
46
+
47
+ if [ "$task" == "write" ]; then
48
+ local options=$4
49
+ local do_validate=$(abcli_option_int "$options" "validate" 0)
50
+
51
+ python3 -m bluer_objects.mysql.cache \
52
+ write \
53
+ --keyword "$keyword" \
54
+ --value "$3" \
55
+ "${@:5}"
56
+
57
+ [[ "$do_validate" == 1 ]] &&
58
+ abcli_log "@mysql: cache[$keyword] <- $(abcli_mysql_cache read $keyword)"
59
+
60
+ return 0
61
+ fi
62
+
63
+ abcli_log_error "@mysql: cache: $task: command not found."
64
+ return 1
65
+ }
@@ -0,0 +1,83 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_mysql_relations() {
4
+ local task=$(abcli_unpack_keyword $1 help)
5
+ local object_1=$(abcli_clarify_object $2 .)
6
+
7
+ if [ "$task" == "help" ]; then
8
+ abcli_show_usage "@mysql relations clone$ABCUL<object-1>$ABCUL<object-2>" \
9
+ "clone <object-1> mysql relations -> <object-2>."
10
+
11
+ abcli_show_usage "@mysql relations get$ABCUL<object-1>$ABCUL<object-2>" \
12
+ "get the mysql relation between object_1 and object_2."
13
+
14
+ local args="[--count <count>]$ABCUL[--delim space]$ABCUL[--log 0]$ABCUL[--return_list 1]"
15
+ abcli_show_usage "@mysql relations list$ABCUL$args" \
16
+ "list possible mysql relations."
17
+
18
+ abcli_show_usage "@mysql relations search$ABCUL<object-name>$ABCUL[--relation <relation>]" \
19
+ "search for all mysql relations of/relation to <object-name>."
20
+
21
+ abcli_show_usage "@mysql relations set$ABCUL<object-1>$ABCUL<object-2>$ABCUL<relation>$ABCUL[validate]" \
22
+ "set <object-1> =mysql.relation=> <object-2>."
23
+
24
+ return
25
+ fi
26
+
27
+ if [ "$task" == "clone" ] || [ "$task" == "get" ] || [ "$task" == "set" ]; then
28
+ local object_2=$(abcli_clarify_object $3 .)
29
+ fi
30
+
31
+ if [ "$task" == "clone" ]; then
32
+ python3 -m bluer_objects.mysql.relations \
33
+ clone \
34
+ --object_1 $object_1 \
35
+ --object_2 $object_2 \
36
+ "${@:4}"
37
+ return
38
+ fi
39
+
40
+ if [ "$task" == "get" ]; then
41
+ python3 -m bluer_objects.mysql.relations \
42
+ get \
43
+ --object_1 $object_1 \
44
+ --object_2 $object_2 \
45
+ "${@:4}"
46
+ return
47
+ fi
48
+
49
+ if [ "$task" == "list" ]; then
50
+ python3 -m bluer_objects.mysql.relations \
51
+ list \
52
+ "${@:2}"
53
+ return
54
+ fi
55
+
56
+ if [ "$task" == "search" ]; then
57
+ python3 -m bluer_objects.mysql.relations \
58
+ search \
59
+ --object_1 $object_1 \
60
+ "${@:3}"
61
+ return
62
+ fi
63
+
64
+ if [ "$task" == "set" ]; then
65
+ local options=$5
66
+ local do_validate=$(abcli_option_int "$options" validate 0)
67
+
68
+ python3 -m bluer_objects.mysql.relations \
69
+ set \
70
+ --object_1 $object_1 \
71
+ --object_2 $object_2 \
72
+ --relation $4 \
73
+ "${@:6}"
74
+
75
+ [[ "$do_validate" == 1 ]] &&
76
+ abcli_log "@mysql: relations: $object_1 -$(abcli_mysql_relations get $object_1 $object_2 --log 0)-> $object_2"
77
+
78
+ return 0
79
+ fi
80
+
81
+ abcli_log_error "@mysql: relations: $task: command not found."
82
+ return 1
83
+ }
@@ -0,0 +1,85 @@
1
+ #! /usr/bin/env bash
2
+
3
+ export abcli_tag_search_args="[--count <count>]$ABCUL[--delim space]$ABCUL[--log 0]$ABCUL[--offset <offset>]"
4
+
5
+ function abcli_mysql_tags() {
6
+ local task=$(abcli_unpack_keyword $1 help)
7
+ local object=$(abcli_clarify_object $2 .)
8
+
9
+ if [ "$task" == "help" ]; then
10
+ abcli_show_usage "@mysql tags clone$ABCUL<object-1>$ABCUL<object-2>" \
11
+ "clone <object-1> mysql tags -> <object-2>."
12
+
13
+ abcli_show_usage "@mysql tags get$ABCUL<object-name>" \
14
+ "get <object-name> mysql tags."
15
+
16
+ abcli_show_usage "@mysql tags search$ABCUL<tag>$ABCUL$abcli_tag_search_args" \
17
+ "search for all objects that are tagged tag in mysql."
18
+
19
+ abcli_show_usage "@mysql tags set$ABCUL<object-1,object-2>$ABCUL<tag-1,~tag-2>$ABCUL[validate]" \
20
+ "add <tag-1> and remove <tag-2> from <object-1> and <object-2> in mysql."
21
+
22
+ abcli_show_usage "@mysql tags set${ABCUL}disable|enable" \
23
+ "disable|enable '@mysql tags set'."
24
+ return
25
+ fi
26
+
27
+ if [ "$task" == "clone" ]; then
28
+ python3 -m bluer_objects.mysql.tags \
29
+ clone \
30
+ --object $object \
31
+ --object_2 $(abcli_clarify_object $3 .) \
32
+ "${@:4}"
33
+ return
34
+ fi
35
+
36
+ if [ "$task" == "get" ]; then
37
+ python3 -m bluer_objects.mysql.tags \
38
+ get \
39
+ --item_name tag \
40
+ --object $object \
41
+ "${@:3}"
42
+ return
43
+ fi
44
+
45
+ if [ "$task" == "search" ]; then
46
+ python3 -m bluer_objects.mysql.tags \
47
+ search \
48
+ --tags $2 \
49
+ "${@:3}"
50
+ return
51
+ fi
52
+
53
+ if [ "$task" == "set" ]; then
54
+ if [ "$object" == "disable" ]; then
55
+ export ABCLI_TAG_DISABLE=true
56
+ return
57
+ elif [ "$object" == "enable" ]; then
58
+ export ABCLI_TAG_DISABLE=false
59
+ return
60
+ elif [ "$ABCLI_TAG_DISABLE" == true ]; then
61
+ abcli_log_warning "ignored '@mysql tags set ${@:2}'."
62
+ return
63
+ fi
64
+
65
+ local options=$4
66
+ local do_validate=$(abcli_option_int "$options" validate 0)
67
+
68
+ local object
69
+ for object in $(echo "$object" | tr , " "); do
70
+ python3 -m bluer_objects.mysql.tags \
71
+ set \
72
+ --object $object \
73
+ --tags $3 \
74
+ "${@:5}"
75
+
76
+ [[ "$do_validate" == 1 ]] &&
77
+ abcli_log "mysql: $object: $(abcli_mysql_tags get $object --log 0)"
78
+ done
79
+
80
+ return 0
81
+ fi
82
+
83
+ abcli_log_error "@mysql: tags: $task: command not found."
84
+ return 1
85
+ }
@@ -0,0 +1,16 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_mysql() {
4
+ local task=$(abcli_unpack_keyword $1 void)
5
+
6
+ local function_name=abcli_mysql_$task
7
+ if [[ $(type -t $function_name) == "function" ]]; then
8
+ $function_name "${@:2}"
9
+ return
10
+ fi
11
+
12
+ abcli_log_error "@mysql: $task: command not found."
13
+ return 1
14
+ }
15
+
16
+ abcli_source_caller_suffix_path /mysql
@@ -0,0 +1,54 @@
1
+ #! /usr/bin/env bash
2
+
3
+ export ABCLI_S3_OBJECT_PREFIX=s3://$ABCLI_AWS_S3_BUCKET_NAME/$ABCLI_AWS_S3_PREFIX
4
+
5
+ function abcli_clarify_object() {
6
+ local object_name=$1
7
+ local default=${2:-$(abcli_string_timestamp)}
8
+ local type_name=${3:-object}
9
+
10
+ local object_var=abcli_${type_name}_name
11
+ local object_var_prev=abcli_${type_name}_name_prev
12
+ local object_var_prev2=abcli_${type_name}_name_prev2
13
+
14
+ [[ -z "$object_name" ]] || [[ "$object_name" == "-" ]] &&
15
+ object_name=$default
16
+
17
+ if [ "$object_name" == "." ]; then
18
+ object_name=${!object_var}
19
+ elif [ "$object_name" == ".." ]; then
20
+ object_name=${!object_var_prev}
21
+ elif [ "$object_name" == "..." ]; then
22
+ object_name=${!object_var_prev2}
23
+ fi
24
+
25
+ if [ "$(abcli_keyword_is $object_name validate)" == true ]; then
26
+ local object_name="validate"
27
+ fi
28
+
29
+ mkdir -p $ABCLI_OBJECT_ROOT/$object_name
30
+
31
+ echo $object_name
32
+ }
33
+
34
+ function abcli_object() {
35
+ local task=$(abcli_unpack_keyword $1 void)
36
+
37
+ if [ "$task" == "open" ]; then
38
+ local object_name=$(abcli_clarify_object $2 .)
39
+
40
+ abcli_download - $object_name
41
+
42
+ rm -v ../$object_name.tar.gz
43
+ aws s3 rm "$ABCLI_S3_OBJECT_PREFIX/$object_name.tar.gz"
44
+
45
+ abcli_tags set $object_name ~solid
46
+
47
+ abcli_upload - $object_name
48
+
49
+ return
50
+ fi
51
+
52
+ abcli_log_error "@object: $task: command not found."
53
+ return 1
54
+ }
@@ -0,0 +1,58 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_publish() {
4
+ local options=$1
5
+ local do_download=$(abcli_option_int "$options" download 1)
6
+ local do_tar=$(abcli_option_int "$options" tar 0)
7
+ local prefix=$(abcli_option "$options" prefix)
8
+ local suffix=$(abcli_option "$options" suffix)
9
+
10
+ local object_name=$(abcli_clarify_object $2 .)
11
+ [[ "$do_download" == 1 ]] &&
12
+ abcli_download - $object_name
13
+
14
+ abcli_tags set $object_name published
15
+
16
+ local public_object_name=$(abcli_option "$options" as $object_name)
17
+
18
+ if [ "$do_tar" == 1 ]; then
19
+ abcli_log "publishing $object_name -> $public_object_name.tar.gz"
20
+
21
+ abcli_upload ~open,solid $object_name
22
+ aws s3 cp \
23
+ $ABCLI_S3_OBJECT_PREFIX/$object_name.tar.gz \
24
+ s3://$ABCLI_AWS_S3_PUBLIC_BUCKET_NAME/$public_object_name.tar.gz
25
+ abcli_object open $object_name
26
+
27
+ abcli_log "🔗 $ABCLI_PUBLIC_PREFIX/$public_object_name.tar.gz"
28
+ return
29
+ fi
30
+
31
+ local object_path=$ABCLI_OBJECT_ROOT/$object_name
32
+
33
+ if [[ -z "$prefix$suffix" ]]; then
34
+ abcli_log "publishing $object_name -> $public_object_name"
35
+
36
+ aws s3 sync \
37
+ $object_path/ \
38
+ s3://$ABCLI_AWS_S3_PUBLIC_BUCKET_NAME/$public_object_name/
39
+
40
+ abcli_log "🔗 $ABCLI_PUBLIC_PREFIX/$public_object_name/"
41
+ return
42
+ fi
43
+
44
+ abcli_log "publishing $object_name/$prefix*$suffix -> $public_object_name"
45
+
46
+ pushd $object_path >/dev/null
47
+ local filename
48
+ for filename in $(ls *); do
49
+ [[ "$filename" != "$prefix"*"$suffix" ]] && continue
50
+
51
+ aws s3 cp \
52
+ $filename \
53
+ s3://$ABCLI_AWS_S3_PUBLIC_BUCKET_NAME/$public_object_name/$filename
54
+
55
+ abcli_log "🔗 $ABCLI_PUBLIC_PREFIX/$public_object_name/$filename"
56
+ done
57
+ popd >/dev/null
58
+ }
@@ -0,0 +1,34 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_select() {
4
+ local object_name=$(abcli_clarify_object "$1" $(abcli_string_timestamp))
5
+
6
+ local options=$2
7
+ local update_trail=$(abcli_option_int "$options" trail 1)
8
+ local do_open=$(abcli_option_int "$options" open 0)
9
+ local type_name=$(abcli_option "$options" type object)
10
+
11
+ local object_name_var_prev=abcli_${type_name}_name_prev
12
+ export abcli_${type_name}_name_prev2=${!object_name_var_prev}
13
+
14
+ local object_name_var=abcli_${type_name}_name
15
+ export abcli_${type_name}_name_prev=${!object_name_var}
16
+
17
+ export abcli_${type_name}_name=$object_name
18
+
19
+ local object_path=$ABCLI_OBJECT_ROOT/$object_name
20
+ export abcli_${type_name}_path=$object_path
21
+ mkdir -p $object_path
22
+
23
+ if [ "$type_name" == object ]; then
24
+ cd $object_path
25
+
26
+ [[ "$update_trail" == 1 ]] &&
27
+ abcli_trail $object_path/$object_name
28
+ fi
29
+
30
+ abcli_log "📂 $type_name :: $object_name"
31
+
32
+ [[ "$do_open" == 1 ]] &&
33
+ open $object_path
34
+ }
@@ -0,0 +1,45 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_storage_clear() {
4
+ local options=$1
5
+ local do_dryrun=$(abcli_option_int "$options" dryrun 1)
6
+
7
+ if [[ "$abcli_is_rpi" == true ]]; then
8
+ abcli_eval dryrun=$do_dryrun \
9
+ rm -rfv $ABCLI_OBJECT_ROOT
10
+ return
11
+ fi
12
+
13
+ local recent_filename=$ABCLI_OBJECT_ROOT/QGIS-recent.yaml
14
+ if [[ ! -f "$recent_filename" ]]; then
15
+ abcli_log_warning "run \"QGIS.list_recent_projects\" first."
16
+ return 1
17
+ fi
18
+
19
+ local recent_projects=$(python3 -c "from bluer_objects import file; print('+'.join(file.load_yaml('$recent_filename')[1]))")
20
+ abcli_log_list "$recent_projects" \
21
+ --delim + \
22
+ --after "object(s) to keep."
23
+
24
+ pushd $ABCLI_OBJECT_ROOT >/dev/null
25
+ local folder
26
+ local object_name
27
+ for folder in ./*; do
28
+ object_name=$(basename "$folder")
29
+
30
+ if [[ "+$recent_projects+" == *"+$object_name+"* ]]; then
31
+ abcli_log "will keep $object_name ..."
32
+ else
33
+ abcli_log_warning "will delete $object_name ..."
34
+
35
+ [[ "$do_dryrun" == 0 ]] &&
36
+ rm -rfv $object_name
37
+ fi
38
+ done
39
+ popd >/dev/null
40
+
41
+ [[ "$do_dryrun" == 0 ]] &&
42
+ rm -v $recent_filename
43
+
44
+ return 0
45
+ }
@@ -0,0 +1,9 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_storage_download_file() {
4
+ python3 -m bluer_objects.storage \
5
+ download_file \
6
+ --object_name "$1" \
7
+ --filename "$2" \
8
+ "${@:3}"
9
+ }
@@ -0,0 +1,8 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_storage_exists() {
4
+ python3 -m bluer_objects.storage \
5
+ exists \
6
+ --object_name "$1" \
7
+ "${@:2}"
8
+ }
@@ -0,0 +1,8 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_storage_list() {
4
+ python3 -m bluer_objects.storage \
5
+ list_of_objects \
6
+ --prefix "$1" \
7
+ "${@:2}"
8
+ }
@@ -0,0 +1,11 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_storage_rm() {
4
+ local options=$1
5
+ local do_dryrun=$(abcli_option_int "$options" dryrun 1)
6
+
7
+ local object_name=$(abcli_clarify_object $2 void)
8
+
9
+ abcli_eval dryrun=$do_dryrun \
10
+ rm -rfv $ABCLI_OBJECT_ROOT/$object_name
11
+ }
@@ -0,0 +1,11 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_storage_status() {
4
+ local options=$1
5
+ local count=$(abcli_option_int "$options" count 10)
6
+ local depth=$(abcli_option_int "$options" depth 2)
7
+ local do_dryrun=$(abcli_option_int "$options" dryrun 0)
8
+
9
+ abcli_eval dryrun=$do_dryrun,path=$ABCLI_PATH_STORAGE \
10
+ "du -hc -d $depth | sort -h -r | head -n $count"
11
+ }
@@ -0,0 +1,15 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_storage() {
4
+ local task=$(abcli_unpack_keyword $1 void)
5
+
6
+ local function_name=abcli_storage_$task
7
+ if [[ $(type -t $function_name) == "function" ]]; then
8
+ $function_name "${@:2}"
9
+ return
10
+ fi
11
+
12
+ python3 -m bluer_objects.storage "$@"
13
+ }
14
+
15
+ abcli_source_caller_suffix_path /storage
@@ -0,0 +1,5 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_tags() {
4
+ abcli_mlflow_tags "$@"
5
+ }
@@ -0,0 +1,8 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function test_bluer_objects_README() {
4
+ local options=$1
5
+
6
+ abcli_eval ,$options \
7
+ bluer_objects build_README
8
+ }
@@ -0,0 +1,32 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function test_bluer_objects_clone() {
4
+ local options=$1
5
+
6
+ local source_object_name=$(abcli_mlflow_tags_search \
7
+ contains=latest-giza \
8
+ --log 0 \
9
+ --count 1)
10
+ abcli_assert $source_object_name - non-empty
11
+
12
+ local from_s3
13
+ for from_s3 in 0 1; do
14
+ local object_name=test_bluer_objects_clone-$(abcli_string_timestamp_short)
15
+
16
+ if [[ "$from_s3" == 0 ]]; then
17
+ abcli_clone \
18
+ ~relate,~tags,~upload,$options \
19
+ $source_object_name \
20
+ $object_name
21
+ [[ $? -ne 0 ]] && return 1
22
+ else
23
+ abcli_clone \
24
+ ~relate,s3,~upload,$options \
25
+ $ABCLI_S3_OBJECT_PREFIX/$source_object_name \
26
+ $object_name
27
+ [[ $? -ne 0 ]] && return 1
28
+ fi
29
+ done
30
+
31
+ return 0
32
+ }
@@ -0,0 +1,85 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function test_bluer_objects_help() {
4
+ local options=$1
5
+
6
+ # legacy, not tested:
7
+ # - @mysql
8
+
9
+ local module
10
+ for module in \
11
+ "@assets" \
12
+ "@assets publish" \
13
+ \
14
+ "@objects" \
15
+ \
16
+ "@objects pypi" \
17
+ "@objects pypi browse" \
18
+ "@objects pypi build" \
19
+ "@objects pypi install" \
20
+ \
21
+ "@objects pytest" \
22
+ \
23
+ "@objects test" \
24
+ "@objects test list" \
25
+ \
26
+ "@cp" \
27
+ \
28
+ "@download" \
29
+ \
30
+ "@gif" \
31
+ \
32
+ "@host" \
33
+ "@host get" \
34
+ "@host reboot" \
35
+ "@host shutdown" \
36
+ \
37
+ "@metadata" \
38
+ "@metadata get" \
39
+ "@metadata post" \
40
+ \
41
+ "@mlflow" \
42
+ "@mlflow browse" \
43
+ "@mlflow cache" \
44
+ "@mlflow get_id" \
45
+ "@mlflow get_run_id" \
46
+ "@mlflow list_registered_models" \
47
+ "@mlflow log_artifacts" \
48
+ "@mlflow log_run" \
49
+ "@mlflow rm" \
50
+ "@mlflow run" \
51
+ "@mlflow tags" \
52
+ "@mlflow tags clone" \
53
+ "@mlflow tags get" \
54
+ "@mlflow tags search" \
55
+ "@mlflow tags set" \
56
+ "@mlflow test" \
57
+ "@mlflow transition" \
58
+ \
59
+ "@object" \
60
+ "@object open" \
61
+ \
62
+ "@publish" \
63
+ \
64
+ "@select" \
65
+ \
66
+ "@storage" \
67
+ "@storage clear" \
68
+ "@storage download_file" \
69
+ "@storage exists" \
70
+ "@storage list" \
71
+ "@storage rm" \
72
+ "@storage status" \
73
+ \
74
+ "@upload" \
75
+ \
76
+ "bluer_objects"; do
77
+ abcli_eval ,$options \
78
+ abcli_help $module
79
+ [[ $? -ne 0 ]] && return 1
80
+
81
+ abcli_hr
82
+ done
83
+
84
+ return 0
85
+ }
@@ -0,0 +1,7 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function test_bluer_objects_host() {
4
+ abcli_assert \
5
+ $(abcli_host get name) \
6
+ - non-empty
7
+ }
@@ -0,0 +1,13 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function test_bluer_objects_ls() {
4
+ abcli_select
5
+
6
+ abcli_upload
7
+
8
+ abcli_ls cloud
9
+
10
+ abcli_ls local
11
+
12
+ abcli_ls "$abcli_path_bash/tests/*.sh"
13
+ }