bluer-objects 6.104.1__py3-none-any.whl → 6.464.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.
- bluer_objects/.abcli/abcli.sh +6 -0
- bluer_objects/.abcli/alias.sh +13 -6
- bluer_objects/.abcli/assets/cd.sh +20 -0
- bluer_objects/.abcli/assets/mv.sh +34 -0
- bluer_objects/.abcli/assets/publish.sh +40 -0
- bluer_objects/.abcli/assets.sh +15 -0
- bluer_objects/.abcli/create_test_asset.sh +10 -0
- bluer_objects/.abcli/download.sh +3 -1
- bluer_objects/.abcli/file.sh +15 -4
- bluer_objects/.abcli/gif.sh +18 -0
- bluer_objects/.abcli/host.sh +23 -7
- bluer_objects/.abcli/ls.sh +19 -8
- bluer_objects/.abcli/metadata/download.sh +9 -0
- bluer_objects/.abcli/metadata/edit.sh +15 -0
- bluer_objects/.abcli/metadata/upload.sh +9 -0
- bluer_objects/.abcli/mlflow/browse.sh +2 -0
- bluer_objects/.abcli/mlflow/deploy.sh +21 -5
- bluer_objects/.abcli/mlflow/lock/lock.sh +11 -0
- bluer_objects/.abcli/mlflow/lock/unlock.sh +12 -0
- bluer_objects/.abcli/mlflow/lock.sh +15 -0
- bluer_objects/.abcli/mlflow/tags/search.sh +1 -5
- bluer_objects/.abcli/mlflow.sh +0 -2
- bluer_objects/.abcli/pdf/convert.sh +92 -0
- bluer_objects/.abcli/pdf.sh +15 -0
- bluer_objects/.abcli/storage/clear.sh +2 -0
- bluer_objects/.abcli/tests/clone.sh +2 -3
- bluer_objects/.abcli/tests/create_test_asset.sh +16 -0
- bluer_objects/.abcli/tests/file.sh +64 -0
- bluer_objects/.abcli/tests/gif.sh +3 -3
- bluer_objects/.abcli/tests/help.sh +23 -7
- bluer_objects/.abcli/tests/ls.sh +11 -4
- bluer_objects/.abcli/tests/metadata.sh +35 -0
- bluer_objects/.abcli/tests/mlflow_lock.sh +30 -0
- bluer_objects/.abcli/tests/mlflow_tags.sh +1 -1
- bluer_objects/.abcli/tests/open.sh +11 -0
- bluer_objects/.abcli/tests/open_gif_open.sh +14 -0
- bluer_objects/.abcli/tests/pdf.sh +39 -0
- bluer_objects/.abcli/tests/storage_clear.sh +11 -0
- bluer_objects/.abcli/tests/storage_public_upload.sh +25 -0
- bluer_objects/.abcli/tests/storage_status.sh +12 -0
- bluer_objects/.abcli/tests/{storage.sh → storage_upload_download.sh} +26 -8
- bluer_objects/.abcli/upload.sh +26 -2
- bluer_objects/README/__init__.py +7 -22
- bluer_objects/README/alias.py +67 -0
- bluer_objects/README/build/__init__.py +0 -0
- bluer_objects/README/build/aliases.py +23 -0
- bluer_objects/README/build/docs.py +23 -0
- bluer_objects/README/build/modules.py +9 -0
- bluer_objects/README/consts.py +44 -0
- bluer_objects/README/functions.py +154 -204
- bluer_objects/README/items.py +78 -6
- bluer_objects/README/process/__init__.py +0 -0
- bluer_objects/README/process/assets.py +36 -0
- bluer_objects/README/process/details.py +20 -0
- bluer_objects/README/process/envs.py +23 -0
- bluer_objects/README/process/help.py +27 -0
- bluer_objects/README/process/include.py +40 -0
- bluer_objects/README/process/legacy.py +21 -0
- bluer_objects/README/process/mermaid.py +20 -0
- bluer_objects/README/process/national_internet.py +55 -0
- bluer_objects/README/process/objects.py +32 -0
- bluer_objects/README/process/signature.py +35 -0
- bluer_objects/README/process/title.py +44 -0
- bluer_objects/README/process/variables.py +12 -0
- bluer_objects/__init__.py +1 -1
- bluer_objects/assets/__init__.py +0 -0
- bluer_objects/assets/__main__.py +57 -0
- bluer_objects/assets/functions.py +62 -0
- bluer_objects/config.env +13 -1
- bluer_objects/env.py +27 -1
- bluer_objects/file/__main__.py +52 -7
- bluer_objects/file/functions.py +21 -4
- bluer_objects/file/load.py +2 -9
- bluer_objects/file/save.py +17 -24
- bluer_objects/graphics/__main__.py +7 -0
- bluer_objects/graphics/gif.py +11 -7
- bluer_objects/graphics/screen.py +9 -8
- bluer_objects/help/assets.py +93 -0
- bluer_objects/help/create_test_asset.py +22 -0
- bluer_objects/help/download.py +17 -3
- bluer_objects/help/file.py +59 -0
- bluer_objects/help/functions.py +9 -1
- bluer_objects/help/gif.py +25 -0
- bluer_objects/help/host.py +6 -4
- bluer_objects/help/ls.py +26 -3
- bluer_objects/help/metadata.py +51 -0
- bluer_objects/help/mlflow/__init__.py +23 -2
- bluer_objects/help/mlflow/cache.py +2 -4
- bluer_objects/help/mlflow/lock.py +52 -0
- bluer_objects/help/mlflow/tags.py +34 -23
- bluer_objects/help/pdf.py +67 -0
- bluer_objects/help/upload.py +10 -3
- bluer_objects/host/functions.py +4 -1
- bluer_objects/logger/confusion_matrix.py +76 -0
- bluer_objects/logger/image.py +110 -0
- bluer_objects/logger/stitch.py +107 -0
- bluer_objects/markdown.py +8 -6
- bluer_objects/metadata/__init__.py +1 -0
- bluer_objects/metadata/flatten.py +27 -0
- bluer_objects/mlflow/__init__.py +1 -1
- bluer_objects/mlflow/__main__.py +49 -31
- bluer_objects/mlflow/lock/__init__.py +1 -0
- bluer_objects/mlflow/lock/__main__.py +58 -0
- bluer_objects/mlflow/lock/functions.py +121 -0
- bluer_objects/mlflow/logging.py +53 -41
- bluer_objects/mlflow/models.py +7 -0
- bluer_objects/mlflow/objects.py +7 -0
- bluer_objects/mlflow/runs.py +10 -1
- bluer_objects/mlflow/serverless/__init__.py +3 -0
- bluer_objects/mlflow/serverless/api.py +88 -0
- bluer_objects/mlflow/serverless/read.py +19 -0
- bluer_objects/mlflow/serverless/search.py +35 -0
- bluer_objects/mlflow/serverless/write.py +42 -0
- bluer_objects/mlflow/tags.py +59 -9
- bluer_objects/objects.py +3 -1
- bluer_objects/pdf/__init__.py +1 -0
- bluer_objects/pdf/__main__.py +78 -0
- bluer_objects/pdf/convert/__init__.py +0 -0
- bluer_objects/pdf/convert/batch.py +54 -0
- bluer_objects/pdf/convert/combination.py +32 -0
- bluer_objects/pdf/convert/convert.py +110 -0
- bluer_objects/pdf/convert/image.py +53 -0
- bluer_objects/pdf/convert/md.py +97 -0
- bluer_objects/pdf/convert/missing.py +96 -0
- bluer_objects/pdf/convert/pdf.py +37 -0
- bluer_objects/sample.env +6 -0
- bluer_objects/storage/WebDAV.py +11 -7
- bluer_objects/storage/WebDAVrequest.py +360 -0
- bluer_objects/storage/WebDAVzip.py +26 -29
- bluer_objects/storage/__init__.py +28 -1
- bluer_objects/storage/__main__.py +40 -6
- bluer_objects/storage/base.py +84 -5
- bluer_objects/storage/policies.py +7 -0
- bluer_objects/storage/s3.py +367 -0
- bluer_objects/testing/__main__.py +6 -0
- bluer_objects/tests/test_README_consts.py +71 -0
- bluer_objects/tests/test_README_items.py +128 -0
- bluer_objects/tests/test_alias.py +33 -0
- bluer_objects/tests/test_env.py +42 -7
- bluer_objects/tests/test_file_download.py +30 -0
- bluer_objects/tests/test_file_load_save.py +1 -2
- bluer_objects/tests/test_file_load_save_text.py +46 -0
- bluer_objects/tests/test_graphics_gif.py +2 -0
- bluer_objects/tests/test_log_image_grid.py +29 -0
- bluer_objects/tests/test_logger_confusion_matrix.py +18 -0
- bluer_objects/tests/test_logger_matrix.py +2 -2
- bluer_objects/tests/test_logger_stitch_images.py +47 -0
- bluer_objects/tests/test_metadata.py +12 -6
- bluer_objects/tests/test_metadata_flatten.py +109 -0
- bluer_objects/tests/test_mlflow.py +114 -5
- bluer_objects/tests/test_mlflow_lock.py +26 -0
- bluer_objects/tests/test_objects.py +2 -0
- bluer_objects/tests/test_shell.py +34 -0
- bluer_objects/tests/test_storage.py +8 -21
- bluer_objects/tests/test_storage_base.py +39 -0
- bluer_objects/tests/test_storage_s3.py +67 -0
- bluer_objects/tests/test_storage_webdav_request.py +75 -0
- bluer_objects/tests/test_storage_webdav_zip.py +42 -0
- bluer_objects/tests/test_web_is_accessible.py +11 -0
- {bluer_objects-6.104.1.dist-info → bluer_objects-6.464.1.dist-info}/METADATA +20 -11
- bluer_objects-6.464.1.dist-info/RECORD +228 -0
- {bluer_objects-6.104.1.dist-info → bluer_objects-6.464.1.dist-info}/WHEEL +1 -1
- bluer_objects/.abcli/storage/download_file.sh +0 -9
- bluer_objects/.abcli/storage/exists.sh +0 -8
- bluer_objects/.abcli/storage/list.sh +0 -8
- bluer_objects/.abcli/storage/rm.sh +0 -11
- bluer_objects/.abcli/tests/mlflow_test.sh +0 -7
- bluer_objects-6.104.1.dist-info/RECORD +0 -143
- {bluer_objects-6.104.1.dist-info → bluer_objects-6.464.1.dist-info}/licenses/LICENSE +0 -0
- {bluer_objects-6.104.1.dist-info → bluer_objects-6.464.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
from bluer_objects.README.items import ImageItems, Items, Items_of_dict, list_of_dict
|
|
2
|
+
from bluer_objects.README.consts import assets, assets2
|
|
3
|
+
from bluer_objects import markdown
|
|
4
|
+
from bluer_objects import env
|
|
5
|
+
|
|
6
|
+
dict_of_validations = dict_of_validations = {
|
|
7
|
+
"village-1": {
|
|
8
|
+
"ugv_name": [
|
|
9
|
+
"arzhang1:ugv",
|
|
10
|
+
"arzhang2:ugv",
|
|
11
|
+
"arzhang3:anchor",
|
|
12
|
+
],
|
|
13
|
+
"items": ImageItems(
|
|
14
|
+
{
|
|
15
|
+
f"{assets2}/arzhang/20250905_120526.jpg": "",
|
|
16
|
+
f"{assets2}/arzhang/20250905_120808.jpg": "",
|
|
17
|
+
f"{assets2}/arzhang/20250905_121030.jpg": "",
|
|
18
|
+
f"{assets2}/arzhang/20250905_121032.jpg": "",
|
|
19
|
+
f"{assets2}/arzhang/20250905_121702.jpg": "",
|
|
20
|
+
f"{assets2}/arzhang/20250905_121711.jpg": "",
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
"marquee": f"{assets}/2025-09-05-11-48-27-d56azo/VID-20250905-WA0014_1.gif",
|
|
24
|
+
},
|
|
25
|
+
"village-2": {
|
|
26
|
+
"ugv_name": [
|
|
27
|
+
"arzhang1:ugv",
|
|
28
|
+
"arzhang2:ugv",
|
|
29
|
+
"arzhang3:anchor",
|
|
30
|
+
],
|
|
31
|
+
"items": ImageItems(
|
|
32
|
+
{
|
|
33
|
+
f"{assets2}/arzhang/20250922_094548.jpg": "",
|
|
34
|
+
f"{assets2}/arzhang/20250922_101156.jpg": "",
|
|
35
|
+
f"{assets2}/arzhang/20250922_101409.jpg": "",
|
|
36
|
+
f"{assets2}/arzhang/20250922_101557.jpg": "",
|
|
37
|
+
f"{assets2}/arzhang/20250922_101653.jpg": "",
|
|
38
|
+
f"{assets2}/arzhang/20250922_102822.jpg": "",
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
"macros": {
|
|
42
|
+
"debug_objects": markdown.generate_table(
|
|
43
|
+
Items(
|
|
44
|
+
[
|
|
45
|
+
{
|
|
46
|
+
"name": object_name,
|
|
47
|
+
"url": "https://{}.{}/{}".format(
|
|
48
|
+
env.S3_PUBLIC_STORAGE_BUCKET,
|
|
49
|
+
env.S3_STORAGE_ENDPOINT_URL.split("https://", 1)[1],
|
|
50
|
+
f"{object_name}.tar.gz",
|
|
51
|
+
),
|
|
52
|
+
"marquee": f"{assets}/{object_name}/{object_name}.gif",
|
|
53
|
+
}
|
|
54
|
+
for object_name in [
|
|
55
|
+
"swallow-debug-2025-09-22-09-47-32-85hag3",
|
|
56
|
+
"swallow-debug-2025-09-22-09-59-29-emj29v",
|
|
57
|
+
"swallow-debug-2025-09-22-10-01-01-uzray6",
|
|
58
|
+
"swallow-debug-2025-09-22-10-06-19-hcyl1v",
|
|
59
|
+
"swallow-debug-2025-09-22-10-09-44-z6q9kn",
|
|
60
|
+
"swallow-debug-2025-09-22-10-19-35-mobajm",
|
|
61
|
+
]
|
|
62
|
+
]
|
|
63
|
+
),
|
|
64
|
+
cols=3,
|
|
65
|
+
log=False,
|
|
66
|
+
),
|
|
67
|
+
},
|
|
68
|
+
"marquee": f"{assets}/arzhang/20250922_101202_1.gif",
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_ImageItems():
|
|
74
|
+
items = ImageItems(
|
|
75
|
+
{
|
|
76
|
+
f"{assets2}/swallow/20250701_2206342_1.gif": "",
|
|
77
|
+
f"{assets2}/swallow/20250913_203635~2_1.gif": "",
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
assert isinstance(items, list)
|
|
82
|
+
for item in items:
|
|
83
|
+
assert isinstance(item, str)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_Items():
|
|
87
|
+
items = Items(
|
|
88
|
+
[
|
|
89
|
+
{
|
|
90
|
+
"name": "yolo",
|
|
91
|
+
"description": "a yolo interface.",
|
|
92
|
+
"marquee": "https://github.com/kamangir/assets/raw/main/swallow-debug-2025-09-16-19-53-19-4yzsp8/swallow-debug-2025-09-16-19-53-19-4yzsp8-2.gif?raw=true",
|
|
93
|
+
"url": "./bluer_algo/docs/yolo",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "tracker",
|
|
97
|
+
"marquee": "https://github.com/kamangir/assets/raw/main/tracker-camshift-2025-07-16-11-07-52-4u3nu4/tracker.gif?raw=true",
|
|
98
|
+
"description": "a visual tracker.",
|
|
99
|
+
"url": "./bluer_algo/docs/tracker",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "image classifier",
|
|
103
|
+
"marquee": "https://github.com/kamangir/assets/raw/main/swallow-model-2025-07-11-15-04-03-2glcch/evaluation.png?raw=true",
|
|
104
|
+
"description": "an image classifier.",
|
|
105
|
+
"url": "./bluer_algo/docs/image_classifier",
|
|
106
|
+
},
|
|
107
|
+
]
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
assert isinstance(items, list)
|
|
111
|
+
for item in items:
|
|
112
|
+
assert isinstance(item, str)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def test_Items_of_dict():
|
|
116
|
+
items = Items_of_dict(dict_of_validations)
|
|
117
|
+
|
|
118
|
+
assert isinstance(items, list)
|
|
119
|
+
for item in items:
|
|
120
|
+
assert isinstance(item, str)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def test_list_of_dict():
|
|
124
|
+
items = list_of_dict(dict_of_validations)
|
|
125
|
+
|
|
126
|
+
assert isinstance(items, list)
|
|
127
|
+
for item in items:
|
|
128
|
+
assert isinstance(item, str)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from bluer_objects import NAME
|
|
3
|
+
from bluer_objects.README.alias import list_of_aliases
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@pytest.mark.parametrize(
|
|
7
|
+
["alias_name", "expected_to_exist", "as_markdown", "itemized"],
|
|
8
|
+
[
|
|
9
|
+
["void", False, False, False],
|
|
10
|
+
["host", True, True, False],
|
|
11
|
+
["host", True, True, True],
|
|
12
|
+
],
|
|
13
|
+
)
|
|
14
|
+
def test_alias_list_of_aliases(
|
|
15
|
+
alias_name: str,
|
|
16
|
+
expected_to_exist: bool,
|
|
17
|
+
as_markdown: bool,
|
|
18
|
+
itemized: bool,
|
|
19
|
+
):
|
|
20
|
+
output = list_of_aliases(
|
|
21
|
+
module_name=NAME,
|
|
22
|
+
as_markdown=as_markdown,
|
|
23
|
+
itemized=itemized,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
assert isinstance(output, list)
|
|
27
|
+
for thing in output:
|
|
28
|
+
assert isinstance(thing, str)
|
|
29
|
+
|
|
30
|
+
if as_markdown:
|
|
31
|
+
return
|
|
32
|
+
|
|
33
|
+
assert (alias_name in output) == expected_to_exist
|
bluer_objects/tests/test_env.py
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
from bluer_options.testing import (
|
|
2
|
+
are_01,
|
|
3
|
+
are_positive_ints,
|
|
4
|
+
are_nonempty_strs,
|
|
5
|
+
)
|
|
1
6
|
from bluer_ai.tests.test_env import test_bluer_ai_env
|
|
2
7
|
|
|
3
8
|
from bluer_objects import env
|
|
4
|
-
from bluer_objects.storage
|
|
5
|
-
|
|
9
|
+
from bluer_objects.storage import (
|
|
10
|
+
S3Interface,
|
|
11
|
+
WebDAVInterface,
|
|
12
|
+
WebDAVRequestInterface,
|
|
13
|
+
WebDAVzipInterface,
|
|
14
|
+
)
|
|
6
15
|
|
|
7
16
|
|
|
8
17
|
def test_required_env():
|
|
@@ -10,13 +19,39 @@ def test_required_env():
|
|
|
10
19
|
|
|
11
20
|
|
|
12
21
|
def test_bluer_objects_env():
|
|
13
|
-
assert
|
|
22
|
+
assert are_01(
|
|
23
|
+
[
|
|
24
|
+
env.MLFLOW_IS_SERVERLESS,
|
|
25
|
+
]
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
assert are_nonempty_strs(
|
|
29
|
+
[
|
|
30
|
+
env.ABCLI_MLFLOW_EXPERIMENT_PREFIX,
|
|
31
|
+
env.BLUER_OBJECTS_DEFAULT_ASSETS_VOL,
|
|
32
|
+
env.BLUER_OBJECTS_TEST_OBJECT,
|
|
33
|
+
env.MLFLOW_DEPLOYMENT,
|
|
34
|
+
env.S3_PUBLIC_STORAGE_BUCKET,
|
|
35
|
+
env.S3_STORAGE_AWS_ACCESS_KEY_ID,
|
|
36
|
+
env.S3_STORAGE_AWS_SECRET_ACCESS_KEY,
|
|
37
|
+
env.S3_STORAGE_BUCKET,
|
|
38
|
+
env.S3_STORAGE_ENDPOINT_URL,
|
|
39
|
+
env.WEBDAV_HOSTNAME,
|
|
40
|
+
env.WEBDAV_LOGIN,
|
|
41
|
+
env.WEBDAV_PASSWORD,
|
|
42
|
+
]
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
assert are_positive_ints(
|
|
46
|
+
[
|
|
47
|
+
env.MLFLOW_LOCK_WAIT_FOR_CLEARANCE,
|
|
48
|
+
env.MLFLOW_LOCK_WAIT_FOR_EXCLUSIVITY,
|
|
49
|
+
]
|
|
50
|
+
)
|
|
14
51
|
|
|
15
52
|
assert env.BLUER_OBJECTS_STORAGE_INTERFACE in [
|
|
53
|
+
S3Interface.name,
|
|
16
54
|
WebDAVInterface.name,
|
|
55
|
+
WebDAVRequestInterface.name,
|
|
17
56
|
WebDAVzipInterface.name,
|
|
18
57
|
]
|
|
19
|
-
|
|
20
|
-
assert env.WEBDAV_HOSTNAME
|
|
21
|
-
assert env.WEBDAV_LOGIN
|
|
22
|
-
assert env.WEBDAV_PASSWORD
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from bluer_options.env import BLUER_AI_WEB_STATUS
|
|
4
|
+
|
|
5
|
+
from bluer_objects import objects, file
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@pytest.mark.parametrize(
|
|
9
|
+
["url"],
|
|
10
|
+
[
|
|
11
|
+
["https://raw.githubusercontent.com/jbrownlee/Datasets/master/shampoo.csv"],
|
|
12
|
+
],
|
|
13
|
+
)
|
|
14
|
+
def test_file_download(url: str):
|
|
15
|
+
if BLUER_AI_WEB_STATUS != "online":
|
|
16
|
+
return
|
|
17
|
+
|
|
18
|
+
object_name = objects.unique_object("test_file_download")
|
|
19
|
+
|
|
20
|
+
filename = objects.path_of(
|
|
21
|
+
object_name=object_name,
|
|
22
|
+
filename=url.split("/")[-1],
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
assert file.download(
|
|
26
|
+
url=url,
|
|
27
|
+
filename=filename,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
assert file.exists(filename)
|
|
@@ -78,7 +78,6 @@ def test_file_load_save(
|
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
@pytest.mark.unit
|
|
82
81
|
@pytest.mark.parametrize(
|
|
83
82
|
["size", "dtype"],
|
|
84
83
|
[
|
|
@@ -94,7 +93,7 @@ def test_file_load_save_matrix(
|
|
|
94
93
|
size: Tuple[int, ...],
|
|
95
94
|
dtype: Union[np.dtype, type],
|
|
96
95
|
) -> None:
|
|
97
|
-
object_name = objects.unique_object(test_file_load_save_matrix)
|
|
96
|
+
object_name = objects.unique_object("test_file_load_save_matrix")
|
|
98
97
|
|
|
99
98
|
test_matrix = (
|
|
100
99
|
np.random.randint(0, 256, size=size, dtype=dtype)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from bluer_options import string
|
|
4
|
+
|
|
5
|
+
from bluer_objects import file, objects
|
|
6
|
+
from bluer_objects.file.load import load_text
|
|
7
|
+
from bluer_objects.file.save import save_text
|
|
8
|
+
from bluer_objects.tests.test_objects import test_object
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.parametrize(
|
|
12
|
+
[
|
|
13
|
+
"filename",
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
["test.json"],
|
|
17
|
+
["test.yaml"],
|
|
18
|
+
["test.yaml"],
|
|
19
|
+
],
|
|
20
|
+
)
|
|
21
|
+
def test_file_load_save_text(
|
|
22
|
+
test_object,
|
|
23
|
+
filename: str,
|
|
24
|
+
):
|
|
25
|
+
filename_input = objects.path_of(
|
|
26
|
+
object_name=test_object,
|
|
27
|
+
filename=filename,
|
|
28
|
+
)
|
|
29
|
+
success, text_input = load_text(filename_input)
|
|
30
|
+
assert success
|
|
31
|
+
|
|
32
|
+
filename_test = file.add_suffix(
|
|
33
|
+
filename_input,
|
|
34
|
+
string.random(),
|
|
35
|
+
)
|
|
36
|
+
assert save_text(
|
|
37
|
+
filename_test,
|
|
38
|
+
text_input,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
success, text_output = load_text(filename_test)
|
|
42
|
+
assert success
|
|
43
|
+
|
|
44
|
+
assert len(text_input) == len(text_output)
|
|
45
|
+
for line_input, line_output in zip(text_input, text_output):
|
|
46
|
+
assert line_input == line_output
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from bluer_objects import objects
|
|
2
|
+
from bluer_objects.testing import create_test_asset
|
|
3
|
+
from bluer_objects.logger.image import log_image_grid
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_log_image_grid():
|
|
7
|
+
object_name = objects.unique_object("test_log_image_grid")
|
|
8
|
+
|
|
9
|
+
depth = 10
|
|
10
|
+
|
|
11
|
+
assert create_test_asset(
|
|
12
|
+
object_name=object_name,
|
|
13
|
+
depth=depth,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
assert log_image_grid(
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
"filename": objects.path_of(
|
|
20
|
+
object_name=object_name,
|
|
21
|
+
filename=f"test-{suffix:02d}.png",
|
|
22
|
+
)
|
|
23
|
+
for suffix in range(depth)
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
objects.path_of(object_name=object_name, filename="image_grid.png"),
|
|
27
|
+
rows=2,
|
|
28
|
+
cols=5,
|
|
29
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
from bluer_objects import objects
|
|
4
|
+
from bluer_objects.logger.confusion_matrix import log_confusion_matrix
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_logger_confusion_matrix():
|
|
8
|
+
object_name = objects.unique_object("test_logger_confusion_matrix")
|
|
9
|
+
|
|
10
|
+
confusion_matrix = np.random.random((10, 8))
|
|
11
|
+
|
|
12
|
+
assert log_confusion_matrix(
|
|
13
|
+
confusion_matrix,
|
|
14
|
+
objects.path_of(
|
|
15
|
+
object_name=object_name,
|
|
16
|
+
filename="confusion_matrix.png",
|
|
17
|
+
),
|
|
18
|
+
)
|
|
@@ -18,7 +18,7 @@ def test_log_matrix(
|
|
|
18
18
|
test_image,
|
|
19
19
|
verbose: bool,
|
|
20
20
|
):
|
|
21
|
-
object_name = objects.unique_object()
|
|
21
|
+
object_name = objects.unique_object("test_log_matrix")
|
|
22
22
|
|
|
23
23
|
assert log_matrix(
|
|
24
24
|
matrix=test_image,
|
|
@@ -58,7 +58,7 @@ def test_log_matrix_hist(
|
|
|
58
58
|
test_image,
|
|
59
59
|
verbose: bool,
|
|
60
60
|
):
|
|
61
|
-
object_name = objects.unique_object()
|
|
61
|
+
object_name = objects.unique_object("test_log_matrix_hist")
|
|
62
62
|
|
|
63
63
|
assert log_matrix_hist(
|
|
64
64
|
matrix=test_image,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import numpy as np
|
|
3
|
+
import random
|
|
4
|
+
|
|
5
|
+
from bluer_objects.logger.stitch import stitch_images
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@pytest.mark.parametrize(
|
|
9
|
+
["count"],
|
|
10
|
+
[[count] for count in range(10)],
|
|
11
|
+
)
|
|
12
|
+
@pytest.mark.parametrize(
|
|
13
|
+
["cols"],
|
|
14
|
+
[[cols] for cols in [-1, 1, 3]],
|
|
15
|
+
)
|
|
16
|
+
@pytest.mark.parametrize(
|
|
17
|
+
["rows"],
|
|
18
|
+
[[rows] for rows in [-1, 1, 3]],
|
|
19
|
+
)
|
|
20
|
+
def test_logger_stitch_images(
|
|
21
|
+
count: int,
|
|
22
|
+
cols: int,
|
|
23
|
+
rows: int,
|
|
24
|
+
):
|
|
25
|
+
rng = np.random.default_rng()
|
|
26
|
+
|
|
27
|
+
list_of_images = list_of_images = [
|
|
28
|
+
rng.integers(
|
|
29
|
+
0,
|
|
30
|
+
256,
|
|
31
|
+
(
|
|
32
|
+
random.randint(1, 512),
|
|
33
|
+
random.randint(1, 512),
|
|
34
|
+
random.choice([1, 3]),
|
|
35
|
+
),
|
|
36
|
+
dtype=np.uint8,
|
|
37
|
+
)
|
|
38
|
+
for _ in range(count)
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
image = stitch_images(
|
|
42
|
+
list_of_images,
|
|
43
|
+
cols=cols,
|
|
44
|
+
rows=rows,
|
|
45
|
+
log=True,
|
|
46
|
+
)
|
|
47
|
+
assert isinstance(image, np.ndarray)
|
|
@@ -77,7 +77,8 @@ def test_metadata(
|
|
|
77
77
|
get_source: Callable[[str], str],
|
|
78
78
|
get_source_type: MetadataSourceType,
|
|
79
79
|
):
|
|
80
|
-
object_name = unique_object()
|
|
80
|
+
object_name = unique_object("test_metadata")
|
|
81
|
+
|
|
81
82
|
key = random()
|
|
82
83
|
value = random()
|
|
83
84
|
|
|
@@ -98,7 +99,8 @@ def test_metadata(
|
|
|
98
99
|
|
|
99
100
|
|
|
100
101
|
def test_metadata_dict():
|
|
101
|
-
object_name = unique_object()
|
|
102
|
+
object_name = unique_object("test_metadata_dict")
|
|
103
|
+
|
|
102
104
|
key = random()
|
|
103
105
|
value = {random(): random() for _ in range(10)}
|
|
104
106
|
|
|
@@ -138,7 +140,8 @@ def test_metadata_dict():
|
|
|
138
140
|
|
|
139
141
|
|
|
140
142
|
def test_metadata_file():
|
|
141
|
-
object_name = unique_object()
|
|
143
|
+
object_name = unique_object("test_metadata_file")
|
|
144
|
+
|
|
142
145
|
key = random()
|
|
143
146
|
value = random()
|
|
144
147
|
|
|
@@ -153,7 +156,8 @@ def test_metadata_file():
|
|
|
153
156
|
|
|
154
157
|
|
|
155
158
|
def test_metadata_object():
|
|
156
|
-
object_name = unique_object()
|
|
159
|
+
object_name = unique_object("test_metadata_object")
|
|
160
|
+
|
|
157
161
|
key = random()
|
|
158
162
|
value = random()
|
|
159
163
|
|
|
@@ -163,7 +167,8 @@ def test_metadata_object():
|
|
|
163
167
|
|
|
164
168
|
|
|
165
169
|
def test_metadata_path():
|
|
166
|
-
object_name = unique_object()
|
|
170
|
+
object_name = unique_object("test_metadata_path")
|
|
171
|
+
|
|
167
172
|
key = random()
|
|
168
173
|
value = random()
|
|
169
174
|
|
|
@@ -175,7 +180,8 @@ def test_metadata_path():
|
|
|
175
180
|
|
|
176
181
|
|
|
177
182
|
def test_metadata_upload():
|
|
178
|
-
object_name = unique_object()
|
|
183
|
+
object_name = unique_object("test_metadata_upload")
|
|
184
|
+
|
|
179
185
|
key = random()
|
|
180
186
|
value = random()
|
|
181
187
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
from bluer_objects.metadata import flatten
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
test_objects = [
|
|
8
|
+
np.zeros((4, 5)),
|
|
9
|
+
[np.zeros((4, 5)) for _ in range(5)],
|
|
10
|
+
tuple(np.zeros((4, 5)) for _ in range(5)),
|
|
11
|
+
{"this": np.zeros((4, 5))},
|
|
12
|
+
{"this": 1, "that": 2},
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
test_flatten_objects = [
|
|
16
|
+
[
|
|
17
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
18
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
19
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
20
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
[
|
|
24
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
25
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
26
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
27
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
31
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
32
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
33
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
37
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
38
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
39
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
43
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
44
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
45
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
49
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
50
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
51
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
52
|
+
],
|
|
53
|
+
],
|
|
54
|
+
(
|
|
55
|
+
[
|
|
56
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
57
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
58
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
59
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
63
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
64
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
65
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
69
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
70
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
71
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
75
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
76
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
77
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
81
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
82
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
83
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
84
|
+
],
|
|
85
|
+
),
|
|
86
|
+
{
|
|
87
|
+
"this": [
|
|
88
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
89
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
90
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
91
|
+
[0.0, 0.0, 0.0, 0.0, 0.0],
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{"this": 1, "that": 2},
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@pytest.mark.parametrize(
|
|
99
|
+
["obj", "flatten_obj"],
|
|
100
|
+
[
|
|
101
|
+
[obj, flatten_obj]
|
|
102
|
+
for obj, flatten_obj in zip(
|
|
103
|
+
test_objects,
|
|
104
|
+
test_flatten_objects,
|
|
105
|
+
)
|
|
106
|
+
],
|
|
107
|
+
)
|
|
108
|
+
def test_metadata_flatten(obj, flatten_obj):
|
|
109
|
+
assert flatten(obj) == flatten_obj
|