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.
- bluer_objects/.abcli/abcli.sh +9 -0
- bluer_objects/.abcli/actions.sh +11 -0
- bluer_objects/.abcli/aka.sh +3 -0
- bluer_objects/.abcli/alias.sh +36 -0
- bluer_objects/.abcli/blue_objects.sh +11 -0
- bluer_objects/.abcli/cache.sh +5 -0
- bluer_objects/.abcli/clone.sh +94 -0
- bluer_objects/.abcli/download.sh +53 -0
- bluer_objects/.abcli/file.sh +8 -0
- bluer_objects/.abcli/gif.sh +27 -0
- bluer_objects/.abcli/host.sh +29 -0
- bluer_objects/.abcli/ls.sh +24 -0
- bluer_objects/.abcli/metadata/get.sh +24 -0
- bluer_objects/.abcli/metadata/post.sh +22 -0
- bluer_objects/.abcli/metadata.sh +16 -0
- bluer_objects/.abcli/mlflow/browse.sh +36 -0
- bluer_objects/.abcli/mlflow/cache.sh +31 -0
- bluer_objects/.abcli/mlflow/list_registered_models.sh +9 -0
- bluer_objects/.abcli/mlflow/log_artifacts.sh +10 -0
- bluer_objects/.abcli/mlflow/log_run.sh +10 -0
- bluer_objects/.abcli/mlflow/run.sh +11 -0
- bluer_objects/.abcli/mlflow/tags/clone.sh +15 -0
- bluer_objects/.abcli/mlflow/tags/get.sh +10 -0
- bluer_objects/.abcli/mlflow/tags/search.sh +12 -0
- bluer_objects/.abcli/mlflow/tags/set.sh +13 -0
- bluer_objects/.abcli/mlflow/tags.sh +16 -0
- bluer_objects/.abcli/mlflow/test.sh +11 -0
- bluer_objects/.abcli/mlflow/transition.sh +20 -0
- bluer_objects/.abcli/mlflow.sh +29 -0
- bluer_objects/.abcli/mysql/cache.sh +65 -0
- bluer_objects/.abcli/mysql/relations.sh +83 -0
- bluer_objects/.abcli/mysql/tags.sh +85 -0
- bluer_objects/.abcli/mysql.sh +16 -0
- bluer_objects/.abcli/object.sh +54 -0
- bluer_objects/.abcli/publish.sh +58 -0
- bluer_objects/.abcli/select.sh +34 -0
- bluer_objects/.abcli/storage/clear.sh +45 -0
- bluer_objects/.abcli/storage/download_file.sh +9 -0
- bluer_objects/.abcli/storage/exists.sh +8 -0
- bluer_objects/.abcli/storage/list.sh +8 -0
- bluer_objects/.abcli/storage/rm.sh +11 -0
- bluer_objects/.abcli/storage/status.sh +11 -0
- bluer_objects/.abcli/storage.sh +15 -0
- bluer_objects/.abcli/tags.sh +5 -0
- bluer_objects/.abcli/tests/README.sh +8 -0
- bluer_objects/.abcli/tests/clone.sh +32 -0
- bluer_objects/.abcli/tests/help.sh +85 -0
- bluer_objects/.abcli/tests/host.sh +7 -0
- bluer_objects/.abcli/tests/ls.sh +13 -0
- bluer_objects/.abcli/tests/metadata.sh +53 -0
- bluer_objects/.abcli/tests/mlflow_cache.sh +14 -0
- bluer_objects/.abcli/tests/mlflow_logging.sh +12 -0
- bluer_objects/.abcli/tests/mlflow_tags.sh +29 -0
- bluer_objects/.abcli/tests/mlflow_test.sh +7 -0
- bluer_objects/.abcli/tests/mysql_cache.sh +15 -0
- bluer_objects/.abcli/tests/mysql_relations.sh +20 -0
- bluer_objects/.abcli/tests/mysql_tags.sh +16 -0
- bluer_objects/.abcli/tests/test_gif.sh +13 -0
- bluer_objects/.abcli/tests/version.sh +10 -0
- bluer_objects/.abcli/upload.sh +73 -0
- bluer_objects/README/__init__.py +29 -0
- bluer_objects/README/functions.py +285 -0
- bluer_objects/README/items.py +30 -0
- bluer_objects/__init__.py +19 -0
- bluer_objects/__main__.py +16 -0
- bluer_objects/config.env +22 -0
- bluer_objects/env.py +72 -0
- bluer_objects/file/__init__.py +41 -0
- bluer_objects/file/__main__.py +51 -0
- bluer_objects/file/classes.py +38 -0
- bluer_objects/file/functions.py +290 -0
- bluer_objects/file/load.py +219 -0
- bluer_objects/file/save.py +280 -0
- bluer_objects/graphics/__init__.py +4 -0
- bluer_objects/graphics/__main__.py +84 -0
- bluer_objects/graphics/frame.py +15 -0
- bluer_objects/graphics/gif.py +86 -0
- bluer_objects/graphics/screen.py +63 -0
- bluer_objects/graphics/signature.py +97 -0
- bluer_objects/graphics/text.py +165 -0
- bluer_objects/help/__init__.py +0 -0
- bluer_objects/help/__main__.py +10 -0
- bluer_objects/help/functions.py +5 -0
- bluer_objects/host/__init__.py +1 -0
- bluer_objects/host/__main__.py +84 -0
- bluer_objects/host/functions.py +66 -0
- bluer_objects/logger/__init__.py +4 -0
- bluer_objects/logger/matrix.py +209 -0
- bluer_objects/markdown.py +43 -0
- bluer_objects/metadata/__init__.py +8 -0
- bluer_objects/metadata/__main__.py +110 -0
- bluer_objects/metadata/enums.py +29 -0
- bluer_objects/metadata/get.py +89 -0
- bluer_objects/metadata/post.py +101 -0
- bluer_objects/mlflow/__init__.py +28 -0
- bluer_objects/mlflow/__main__.py +271 -0
- bluer_objects/mlflow/cache.py +13 -0
- bluer_objects/mlflow/logging.py +81 -0
- bluer_objects/mlflow/models.py +57 -0
- bluer_objects/mlflow/objects.py +76 -0
- bluer_objects/mlflow/runs.py +100 -0
- bluer_objects/mlflow/tags.py +90 -0
- bluer_objects/mlflow/testing.py +39 -0
- bluer_objects/mysql/cache/__init__.py +8 -0
- bluer_objects/mysql/cache/__main__.py +91 -0
- bluer_objects/mysql/cache/functions.py +181 -0
- bluer_objects/mysql/relations/__init__.py +9 -0
- bluer_objects/mysql/relations/__main__.py +138 -0
- bluer_objects/mysql/relations/functions.py +180 -0
- bluer_objects/mysql/table.py +144 -0
- bluer_objects/mysql/tags/__init__.py +1 -0
- bluer_objects/mysql/tags/__main__.py +130 -0
- bluer_objects/mysql/tags/functions.py +203 -0
- bluer_objects/objects.py +167 -0
- bluer_objects/path.py +194 -0
- bluer_objects/sample.env +16 -0
- bluer_objects/storage/__init__.py +3 -0
- bluer_objects/storage/__main__.py +114 -0
- bluer_objects/storage/classes.py +237 -0
- bluer_objects/tests/__init__.py +0 -0
- bluer_objects/tests/test_README.py +5 -0
- bluer_objects/tests/test_env.py +27 -0
- bluer_objects/tests/test_file_load_save.py +105 -0
- bluer_objects/tests/test_fullname.py +5 -0
- bluer_objects/tests/test_graphics.py +28 -0
- bluer_objects/tests/test_graphics_frame.py +11 -0
- bluer_objects/tests/test_graphics_gif.py +29 -0
- bluer_objects/tests/test_graphics_screen.py +8 -0
- bluer_objects/tests/test_graphics_signature.py +80 -0
- bluer_objects/tests/test_graphics_text.py +14 -0
- bluer_objects/tests/test_logger.py +5 -0
- bluer_objects/tests/test_logger_matrix.py +73 -0
- bluer_objects/tests/test_markdown.py +10 -0
- bluer_objects/tests/test_metadata.py +204 -0
- bluer_objects/tests/test_mlflow.py +60 -0
- bluer_objects/tests/test_mysql_cache.py +14 -0
- bluer_objects/tests/test_mysql_relations.py +16 -0
- bluer_objects/tests/test_mysql_table.py +9 -0
- bluer_objects/tests/test_mysql_tags.py +13 -0
- bluer_objects/tests/test_objects.py +180 -0
- bluer_objects/tests/test_path.py +7 -0
- bluer_objects/tests/test_storage.py +7 -0
- bluer_objects/tests/test_version.py +5 -0
- bluer_objects/urls.py +3 -0
- bluer_objects-6.3.1.dist-info/METADATA +57 -0
- bluer_objects-6.3.1.dist-info/RECORD +149 -0
- bluer_objects-6.3.1.dist-info/WHEEL +5 -0
- bluer_objects-6.3.1.dist-info/licenses/LICENSE +121 -0
- bluer_objects-6.3.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import cv2
|
|
3
|
+
|
|
4
|
+
from bluer_objects import objects
|
|
5
|
+
from bluer_objects.logger.matrix import log_matrix, log_matrix_hist
|
|
6
|
+
from bluer_objects.tests.test_graphics import test_image
|
|
7
|
+
from bluer_objects.env import DUMMY_TEXT
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.parametrize(
|
|
11
|
+
["verbose"],
|
|
12
|
+
[
|
|
13
|
+
[True],
|
|
14
|
+
[False],
|
|
15
|
+
],
|
|
16
|
+
)
|
|
17
|
+
def test_log_matrix(
|
|
18
|
+
test_image,
|
|
19
|
+
verbose: bool,
|
|
20
|
+
):
|
|
21
|
+
object_name = objects.unique_object()
|
|
22
|
+
|
|
23
|
+
assert log_matrix(
|
|
24
|
+
matrix=test_image,
|
|
25
|
+
header=[DUMMY_TEXT for _ in range(4)],
|
|
26
|
+
footer=[DUMMY_TEXT for _ in range(2)],
|
|
27
|
+
filename=objects.path_of(
|
|
28
|
+
filename="log.png",
|
|
29
|
+
object_name=object_name,
|
|
30
|
+
),
|
|
31
|
+
log_range=True,
|
|
32
|
+
verbose=verbose,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
assert log_matrix(
|
|
36
|
+
matrix=test_image[:, :, 0],
|
|
37
|
+
dynamic_range=(0, 255.0),
|
|
38
|
+
header=[DUMMY_TEXT for _ in range(4)],
|
|
39
|
+
footer=[DUMMY_TEXT for _ in range(2)],
|
|
40
|
+
filename=objects.path_of(
|
|
41
|
+
filename="log.png",
|
|
42
|
+
object_name=object_name,
|
|
43
|
+
),
|
|
44
|
+
colormap=cv2.COLORMAP_JET,
|
|
45
|
+
log_range=True,
|
|
46
|
+
verbose=verbose,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@pytest.mark.parametrize(
|
|
51
|
+
["verbose"],
|
|
52
|
+
[
|
|
53
|
+
[True],
|
|
54
|
+
[False],
|
|
55
|
+
],
|
|
56
|
+
)
|
|
57
|
+
def test_log_matrix_hist(
|
|
58
|
+
test_image,
|
|
59
|
+
verbose: bool,
|
|
60
|
+
):
|
|
61
|
+
object_name = objects.unique_object()
|
|
62
|
+
|
|
63
|
+
assert log_matrix_hist(
|
|
64
|
+
matrix=test_image,
|
|
65
|
+
dynamic_range=(0, 255.0),
|
|
66
|
+
header=[DUMMY_TEXT for _ in range(4)],
|
|
67
|
+
footer=[DUMMY_TEXT for _ in range(2)],
|
|
68
|
+
filename=objects.path_of(
|
|
69
|
+
filename="log-histogram.png",
|
|
70
|
+
object_name=object_name,
|
|
71
|
+
),
|
|
72
|
+
verbose=verbose,
|
|
73
|
+
)
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from typing import Callable
|
|
3
|
+
|
|
4
|
+
from blue_options.string import random
|
|
5
|
+
|
|
6
|
+
from bluer_objects import file
|
|
7
|
+
from bluer_objects.objects import unique_object, object_path, path_of
|
|
8
|
+
from bluer_objects.metadata import (
|
|
9
|
+
get,
|
|
10
|
+
post,
|
|
11
|
+
get_from_file,
|
|
12
|
+
get_from_object,
|
|
13
|
+
get_from_path,
|
|
14
|
+
post,
|
|
15
|
+
post_to_file,
|
|
16
|
+
post_to_object,
|
|
17
|
+
post_to_path,
|
|
18
|
+
MetadataSourceType,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.parametrize(
|
|
23
|
+
[
|
|
24
|
+
"post_source",
|
|
25
|
+
"post_source_type",
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
[
|
|
29
|
+
lambda object_name: path_of(
|
|
30
|
+
filename="metadata.yaml",
|
|
31
|
+
object_name=object_name,
|
|
32
|
+
),
|
|
33
|
+
MetadataSourceType.FILENAME,
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
lambda object_name: object_name,
|
|
37
|
+
MetadataSourceType.OBJECT,
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
lambda object_name: object_path(
|
|
41
|
+
object_name=object_name,
|
|
42
|
+
create=True,
|
|
43
|
+
),
|
|
44
|
+
MetadataSourceType.PATH,
|
|
45
|
+
],
|
|
46
|
+
],
|
|
47
|
+
)
|
|
48
|
+
@pytest.mark.parametrize(
|
|
49
|
+
[
|
|
50
|
+
"get_source",
|
|
51
|
+
"get_source_type",
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
[
|
|
55
|
+
lambda object_name: path_of(
|
|
56
|
+
filename="metadata.yaml",
|
|
57
|
+
object_name=object_name,
|
|
58
|
+
),
|
|
59
|
+
MetadataSourceType.FILENAME,
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
lambda object_name: object_name,
|
|
63
|
+
MetadataSourceType.OBJECT,
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
lambda object_name: object_path(
|
|
67
|
+
object_name=object_name,
|
|
68
|
+
create=True,
|
|
69
|
+
),
|
|
70
|
+
MetadataSourceType.PATH,
|
|
71
|
+
],
|
|
72
|
+
],
|
|
73
|
+
)
|
|
74
|
+
def test_metadata(
|
|
75
|
+
post_source: Callable[[str], str],
|
|
76
|
+
post_source_type: MetadataSourceType,
|
|
77
|
+
get_source: Callable[[str], str],
|
|
78
|
+
get_source_type: MetadataSourceType,
|
|
79
|
+
):
|
|
80
|
+
object_name = unique_object()
|
|
81
|
+
key = random()
|
|
82
|
+
value = random()
|
|
83
|
+
|
|
84
|
+
assert post(
|
|
85
|
+
key=key,
|
|
86
|
+
value=value,
|
|
87
|
+
source=post_source(object_name),
|
|
88
|
+
source_type=post_source_type,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
returned_value = get(
|
|
92
|
+
key=key,
|
|
93
|
+
source=get_source(object_name),
|
|
94
|
+
source_type=get_source_type,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
assert value == returned_value
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_metadata_dict():
|
|
101
|
+
object_name = unique_object()
|
|
102
|
+
key = random()
|
|
103
|
+
value = {random(): random() for _ in range(10)}
|
|
104
|
+
|
|
105
|
+
assert post(
|
|
106
|
+
key=key,
|
|
107
|
+
value=value,
|
|
108
|
+
source=object_name,
|
|
109
|
+
source_type=MetadataSourceType.OBJECT,
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
assert (
|
|
113
|
+
get(
|
|
114
|
+
key=key,
|
|
115
|
+
source=object_name,
|
|
116
|
+
source_type=MetadataSourceType.OBJECT,
|
|
117
|
+
)
|
|
118
|
+
== value
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
assert sorted(
|
|
122
|
+
get(
|
|
123
|
+
key=key,
|
|
124
|
+
source=object_name,
|
|
125
|
+
source_type=MetadataSourceType.OBJECT,
|
|
126
|
+
dict_keys=True,
|
|
127
|
+
)
|
|
128
|
+
) == sorted(value.keys())
|
|
129
|
+
|
|
130
|
+
assert sorted(
|
|
131
|
+
get(
|
|
132
|
+
key=key,
|
|
133
|
+
source=object_name,
|
|
134
|
+
source_type=MetadataSourceType.OBJECT,
|
|
135
|
+
dict_values=True,
|
|
136
|
+
)
|
|
137
|
+
) == sorted(value.values())
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def test_metadata_file():
|
|
141
|
+
object_name = unique_object()
|
|
142
|
+
key = random()
|
|
143
|
+
value = random()
|
|
144
|
+
|
|
145
|
+
filename = path_of(
|
|
146
|
+
filename="metadata.yaml",
|
|
147
|
+
object_name=object_name,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
assert post_to_file(filename, key, value)
|
|
151
|
+
|
|
152
|
+
assert get_from_file(filename, key) == value
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def test_metadata_object():
|
|
156
|
+
object_name = unique_object()
|
|
157
|
+
key = random()
|
|
158
|
+
value = random()
|
|
159
|
+
|
|
160
|
+
assert post_to_object(object_name, key, value)
|
|
161
|
+
|
|
162
|
+
assert get_from_object(object_name, key) == value
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def test_metadata_path():
|
|
166
|
+
object_name = unique_object()
|
|
167
|
+
key = random()
|
|
168
|
+
value = random()
|
|
169
|
+
|
|
170
|
+
path = object_path(object_name=object_name, create=True)
|
|
171
|
+
|
|
172
|
+
assert post_to_path(path, key, value)
|
|
173
|
+
|
|
174
|
+
assert get_from_path(path, key) == value
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def test_metadata_upload():
|
|
178
|
+
object_name = unique_object()
|
|
179
|
+
key = random()
|
|
180
|
+
value = random()
|
|
181
|
+
|
|
182
|
+
assert post_to_object(
|
|
183
|
+
object_name,
|
|
184
|
+
key,
|
|
185
|
+
value,
|
|
186
|
+
download=True,
|
|
187
|
+
upload=True,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
assert file.delete(
|
|
191
|
+
path_of(
|
|
192
|
+
filename="metadata.yaml",
|
|
193
|
+
object_name=object_name,
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
assert (
|
|
198
|
+
get_from_object(
|
|
199
|
+
object_name,
|
|
200
|
+
key,
|
|
201
|
+
download=True,
|
|
202
|
+
)
|
|
203
|
+
== value
|
|
204
|
+
)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from blue_options.options import Options
|
|
4
|
+
from blue_options import string
|
|
5
|
+
|
|
6
|
+
from bluer_objects.objects import unique_object
|
|
7
|
+
from bluer_objects.mlflow import cache
|
|
8
|
+
from bluer_objects.mlflow import objects
|
|
9
|
+
from bluer_objects.mlflow import tags
|
|
10
|
+
from bluer_objects.mlflow import testing
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_from_and_to_experiment_name():
|
|
14
|
+
object_name = unique_object()
|
|
15
|
+
|
|
16
|
+
assert (
|
|
17
|
+
objects.to_object_name(objects.to_experiment_name(object_name)) == object_name
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_mlflow_testing():
|
|
22
|
+
assert testing.test()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.mark.parametrize(
|
|
26
|
+
["tags_str"],
|
|
27
|
+
[["x=1,y=2,z=3"]],
|
|
28
|
+
)
|
|
29
|
+
def test_mlflow_tag_set_get(tags_str: str):
|
|
30
|
+
object_name = unique_object("test_mlflow_tag_set")
|
|
31
|
+
|
|
32
|
+
assert tags.set_tags(
|
|
33
|
+
object_name,
|
|
34
|
+
tags_str,
|
|
35
|
+
log=False,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
success, tags_read = tags.get_tags(object_name)
|
|
39
|
+
assert success
|
|
40
|
+
|
|
41
|
+
tags_option = Options(tags_str)
|
|
42
|
+
for keyword, value in tags_option.items():
|
|
43
|
+
assert tags_read[keyword] == value
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@pytest.mark.parametrize(
|
|
47
|
+
["keyword", "value"],
|
|
48
|
+
[
|
|
49
|
+
[
|
|
50
|
+
f"test_mlflow_cache_read_write-keyword-{string.random()}",
|
|
51
|
+
string.random(),
|
|
52
|
+
]
|
|
53
|
+
],
|
|
54
|
+
)
|
|
55
|
+
def test_mlflow_cache_read_write(keyword: str, value: str):
|
|
56
|
+
assert cache.write(keyword, value)
|
|
57
|
+
|
|
58
|
+
success, value_read = cache.read(keyword)
|
|
59
|
+
assert success
|
|
60
|
+
assert value_read == value
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from blue_options import string
|
|
2
|
+
|
|
3
|
+
from bluer_objects.mysql.cache.functions import read, write
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_mysql_cache_write_read():
|
|
7
|
+
keyword = string.random()
|
|
8
|
+
value = string.random()
|
|
9
|
+
|
|
10
|
+
assert write(keyword, value)
|
|
11
|
+
|
|
12
|
+
value_as_read = read(keyword)
|
|
13
|
+
|
|
14
|
+
assert value_as_read == value
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from bluer_objects.objects import unique_object
|
|
2
|
+
|
|
3
|
+
from bluer_objects.mysql.relations.functions import set_, get, list_of
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_mysql_cache_write_read():
|
|
7
|
+
object_1 = unique_object()
|
|
8
|
+
object_2 = unique_object()
|
|
9
|
+
|
|
10
|
+
relation = list_of[0]
|
|
11
|
+
|
|
12
|
+
assert set_(object_1, object_2, relation)
|
|
13
|
+
|
|
14
|
+
relation_as_Read = get(object_1, object_2)
|
|
15
|
+
|
|
16
|
+
assert relation_as_Read == relation
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from bluer_objects.objects import unique_object
|
|
2
|
+
|
|
3
|
+
from bluer_objects.mysql.tags.functions import get, set_
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_mysql_tags_get_set():
|
|
7
|
+
object_name = unique_object()
|
|
8
|
+
|
|
9
|
+
assert set_(object_name, "this,that")
|
|
10
|
+
|
|
11
|
+
tags_as_read = get(object_name)
|
|
12
|
+
assert "this" in tags_as_read
|
|
13
|
+
assert "that" in tags_as_read
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from blueness import module
|
|
4
|
+
|
|
5
|
+
from bluer_objects import file, path, objects, NAME
|
|
6
|
+
from bluer_objects.env import VANWATCH_TEST_OBJECT
|
|
7
|
+
from bluer_objects.logger import logger
|
|
8
|
+
|
|
9
|
+
NAME = module.name(__file__, NAME)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.fixture
|
|
13
|
+
def test_object():
|
|
14
|
+
object_name = VANWATCH_TEST_OBJECT
|
|
15
|
+
|
|
16
|
+
assert objects.download(object_name=object_name)
|
|
17
|
+
|
|
18
|
+
yield object_name
|
|
19
|
+
|
|
20
|
+
logger.info(f"deleting {NAME}.test_object ...")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.mark.parametrize(
|
|
24
|
+
["object_name", "filename"],
|
|
25
|
+
[[VANWATCH_TEST_OBJECT, "vancouver.geojson"]],
|
|
26
|
+
)
|
|
27
|
+
def test_objects_download(
|
|
28
|
+
object_name: str,
|
|
29
|
+
filename: str,
|
|
30
|
+
):
|
|
31
|
+
filename_fullpath = objects.path_of(
|
|
32
|
+
filename=filename,
|
|
33
|
+
object_name=object_name,
|
|
34
|
+
)
|
|
35
|
+
if file.exists(filename_fullpath):
|
|
36
|
+
assert file.delete(filename_fullpath)
|
|
37
|
+
|
|
38
|
+
assert not file.exists(filename_fullpath)
|
|
39
|
+
|
|
40
|
+
assert objects.download(object_name=object_name)
|
|
41
|
+
|
|
42
|
+
assert file.exists(filename_fullpath)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@pytest.mark.parametrize(
|
|
46
|
+
["object_name", "filename"],
|
|
47
|
+
[[VANWATCH_TEST_OBJECT, "vancouver.geojson"]],
|
|
48
|
+
)
|
|
49
|
+
def test_objects_download_filename(
|
|
50
|
+
object_name: str,
|
|
51
|
+
filename: str,
|
|
52
|
+
):
|
|
53
|
+
filename_fullpath = objects.path_of(
|
|
54
|
+
filename=filename,
|
|
55
|
+
object_name=object_name,
|
|
56
|
+
)
|
|
57
|
+
if file.exists(filename_fullpath):
|
|
58
|
+
assert file.delete(filename_fullpath)
|
|
59
|
+
|
|
60
|
+
assert not file.exists(filename_fullpath)
|
|
61
|
+
|
|
62
|
+
assert objects.download(
|
|
63
|
+
object_name=object_name,
|
|
64
|
+
filename=filename,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
assert file.exists(filename_fullpath)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@pytest.mark.parametrize(
|
|
71
|
+
["cloud"],
|
|
72
|
+
[[True], [False]],
|
|
73
|
+
)
|
|
74
|
+
def test_objects_list_of_files(
|
|
75
|
+
test_object,
|
|
76
|
+
cloud: bool,
|
|
77
|
+
):
|
|
78
|
+
list_of_files = [
|
|
79
|
+
file.name_and_extension(filename)
|
|
80
|
+
for filename in objects.list_of_files(
|
|
81
|
+
object_name=test_object,
|
|
82
|
+
cloud=cloud,
|
|
83
|
+
)
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
assert "vancouver.json" in list_of_files
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_object_object_path():
|
|
90
|
+
object_name = objects.unique_object("test_object_object_path")
|
|
91
|
+
object_path = objects.object_path(object_name, create=True)
|
|
92
|
+
assert object_path
|
|
93
|
+
assert path.exists(object_path)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def test_objects_path_of(test_object):
|
|
97
|
+
assert file.exists(
|
|
98
|
+
objects.path_of(
|
|
99
|
+
object_name=test_object,
|
|
100
|
+
filename="vancouver.json",
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@pytest.mark.parametrize(
|
|
106
|
+
["prefix"],
|
|
107
|
+
[["test_objects_unique_object"]],
|
|
108
|
+
)
|
|
109
|
+
def test_objects_unique_object(prefix: str):
|
|
110
|
+
object_name = objects.unique_object(prefix)
|
|
111
|
+
assert object_name
|
|
112
|
+
assert object_name.startswith(prefix)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@pytest.mark.parametrize(
|
|
116
|
+
["filename"],
|
|
117
|
+
[["vancouver.geojson"]],
|
|
118
|
+
)
|
|
119
|
+
def test_objects_upload(
|
|
120
|
+
filename: str,
|
|
121
|
+
):
|
|
122
|
+
assert objects.download(object_name=VANWATCH_TEST_OBJECT)
|
|
123
|
+
|
|
124
|
+
object_name = objects.unique_object("test_objects_upload_filename")
|
|
125
|
+
|
|
126
|
+
source_filename = objects.path_of(
|
|
127
|
+
filename=filename,
|
|
128
|
+
object_name=VANWATCH_TEST_OBJECT,
|
|
129
|
+
)
|
|
130
|
+
destination_filename = objects.path_of(
|
|
131
|
+
filename=filename,
|
|
132
|
+
object_name=object_name,
|
|
133
|
+
)
|
|
134
|
+
assert file.copy(source_filename, destination_filename)
|
|
135
|
+
|
|
136
|
+
assert objects.upload(object_name=object_name)
|
|
137
|
+
|
|
138
|
+
assert file.delete(destination_filename)
|
|
139
|
+
assert not file.exists(destination_filename)
|
|
140
|
+
|
|
141
|
+
assert objects.download(object_name=object_name)
|
|
142
|
+
|
|
143
|
+
assert file.exists(destination_filename)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@pytest.mark.parametrize(
|
|
147
|
+
["filename"],
|
|
148
|
+
[["vancouver.geojson"]],
|
|
149
|
+
)
|
|
150
|
+
def test_objects_upload_filename(
|
|
151
|
+
filename: str,
|
|
152
|
+
):
|
|
153
|
+
assert objects.download(object_name=VANWATCH_TEST_OBJECT)
|
|
154
|
+
|
|
155
|
+
object_name = objects.unique_object("test_objects_upload_filename")
|
|
156
|
+
|
|
157
|
+
source_filename = objects.path_of(
|
|
158
|
+
filename=filename,
|
|
159
|
+
object_name=VANWATCH_TEST_OBJECT,
|
|
160
|
+
)
|
|
161
|
+
destination_filename = objects.path_of(
|
|
162
|
+
filename=filename,
|
|
163
|
+
object_name=object_name,
|
|
164
|
+
)
|
|
165
|
+
assert file.copy(source_filename, destination_filename)
|
|
166
|
+
|
|
167
|
+
assert objects.upload(
|
|
168
|
+
object_name=object_name,
|
|
169
|
+
filename=filename,
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
assert file.delete(destination_filename)
|
|
173
|
+
assert not file.exists(destination_filename)
|
|
174
|
+
|
|
175
|
+
assert objects.download(
|
|
176
|
+
object_name=object_name,
|
|
177
|
+
filename=filename,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
assert file.exists(destination_filename)
|
bluer_objects/urls.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bluer_objects
|
|
3
|
+
Version: 6.3.1
|
|
4
|
+
Summary: 🌀 data objects for Bash.
|
|
5
|
+
Home-page: https://github.com/kamangir/bluer-objects
|
|
6
|
+
Author: Arash Abadpour (Kamangir)
|
|
7
|
+
Author-email: arash@kamangir.net
|
|
8
|
+
License: Public Domain
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Unix Shell
|
|
11
|
+
Classifier: License :: Public Domain
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: abcli
|
|
16
|
+
Requires-Dist: dill
|
|
17
|
+
Requires-Dist: mlflow
|
|
18
|
+
Requires-Dist: pandas
|
|
19
|
+
Requires-Dist: urllib3
|
|
20
|
+
Provides-Extra: opencv
|
|
21
|
+
Requires-Dist: opencv-python; extra == "opencv"
|
|
22
|
+
Dynamic: author
|
|
23
|
+
Dynamic: author-email
|
|
24
|
+
Dynamic: classifier
|
|
25
|
+
Dynamic: description
|
|
26
|
+
Dynamic: description-content-type
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: license
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
Dynamic: provides-extra
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: summary
|
|
33
|
+
|
|
34
|
+
# 🌀 bluer-objects
|
|
35
|
+
|
|
36
|
+
🌀 `bluer-objects` are the inputs and outputs of [AI algo](https://github.com/kamangir/giza). They are maintained in cloud storage and their metadata is tracked by [MLflow](https://mlflow.org/).
|
|
37
|
+
|
|
38
|
+
For example, the Sentinel-2 [datacube](https://github.com/kamangir/blue-geo/tree/main/blue_geo/datacube) `datacube-EarthSearch-sentinel_2_l1c-S2A_10UDC_20240731_0_L1C` and 🌐 [`@geo watch` outputs](https://github.com/kamangir/blue-geo/tree/main/blue_geo/watch) are `bluer-objects`.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install bluer-objects
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Also home to [blue README](https://github.com/kamangir/bluer-objects/blob/main/bluer_objects/README/).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
> 🌀 [`blue-objects`](https://github.com/kamangir/blue-objects) for the [Global South](https://github.com/kamangir/blue-south).
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
[](https://github.com/kamangir/bluer-objects/actions/workflows/pylint.yml) [](https://github.com/kamangir/bluer-objects/actions/workflows/pytest.yml) [](https://github.com/kamangir/bluer-objects/actions/workflows/bashtest.yml) [](https://pypi.org/project/bluer-objects/) [](https://pypistats.org/packages/bluer-objects)
|
|
54
|
+
|
|
55
|
+
built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`bluer_objects-6.3.1`](https://github.com/kamangir/bluer-objects).
|
|
56
|
+
|
|
57
|
+
built by 🌀 [`blueness-3.96.1`](https://github.com/kamangir/blueness).
|