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
@@ -0,0 +1,71 @@
1
+ import pytest
2
+
3
+ from bluer_objects.env import abcli_path_git
4
+ from bluer_objects.README.consts import (
5
+ assets_path,
6
+ assets_url,
7
+ designs_repo,
8
+ designs_url,
9
+ github_kamangir,
10
+ )
11
+
12
+
13
+ @pytest.mark.parametrize(
14
+ ["suffix"],
15
+ [
16
+ ["this"],
17
+ ["that/which"],
18
+ ],
19
+ )
20
+ @pytest.mark.parametrize(
21
+ ["volume"],
22
+ [
23
+ [""],
24
+ ["2"],
25
+ [2],
26
+ ],
27
+ )
28
+ def test_README_assets(
29
+ suffix: str,
30
+ volume: str,
31
+ ):
32
+ volume_url = assets_url(volume=volume)
33
+ assert isinstance(volume_url, str)
34
+ assert volume_url.startswith(github_kamangir)
35
+
36
+ # ---
37
+
38
+ suffix_url = assets_url(
39
+ suffix=suffix,
40
+ volume=volume,
41
+ )
42
+
43
+ assert isinstance(suffix_url, str)
44
+ assert suffix_url.endswith(suffix)
45
+ assert volume_url in suffix_url
46
+
47
+ # ---
48
+
49
+ suffix_path = assets_path(
50
+ suffix=suffix,
51
+ volume=volume,
52
+ )
53
+
54
+ assert isinstance(suffix_url, str)
55
+ assert suffix_path.endswith(suffix)
56
+ assert abcli_path_git in suffix_path
57
+
58
+
59
+ @pytest.mark.parametrize(
60
+ ["suffix"],
61
+ [
62
+ ["this"],
63
+ ["that/which"],
64
+ ],
65
+ )
66
+ def test_README_designs_url(suffix):
67
+ url = designs_url(suffix=suffix)
68
+
69
+ assert isinstance(url, str)
70
+ assert url.startswith(designs_repo)
71
+ assert url.endswith(suffix)
@@ -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
@@ -1,8 +1,12 @@
1
1
  from bluer_ai.tests.test_env import test_bluer_ai_env
2
2
 
3
3
  from bluer_objects import env
4
- from bluer_objects.storage.WebDAV import WebDAVInterface
5
- from bluer_objects.storage.WebDAVzip import WebDAVzipInterface
4
+ from bluer_objects.storage import (
5
+ S3Interface,
6
+ WebDAVInterface,
7
+ WebDAVRequestInterface,
8
+ WebDAVzipInterface,
9
+ )
6
10
 
7
11
 
8
12
  def test_required_env():
@@ -12,11 +16,30 @@ def test_required_env():
12
16
  def test_bluer_objects_env():
13
17
  assert env.ABCLI_MLFLOW_EXPERIMENT_PREFIX
14
18
 
19
+ assert env.S3_STORAGE_BUCKET
20
+ assert env.S3_PUBLIC_STORAGE_BUCKET
21
+
22
+ assert env.S3_STORAGE_ENDPOINT_URL
23
+ assert env.S3_STORAGE_AWS_ACCESS_KEY_ID
24
+ assert env.S3_STORAGE_AWS_SECRET_ACCESS_KEY
25
+
15
26
  assert env.BLUER_OBJECTS_STORAGE_INTERFACE in [
27
+ S3Interface.name,
16
28
  WebDAVInterface.name,
29
+ WebDAVRequestInterface.name,
17
30
  WebDAVzipInterface.name,
18
31
  ]
19
32
 
33
+ assert env.MLFLOW_DEPLOYMENT
34
+
35
+ assert isinstance(env.MLFLOW_LOCK_WAIT_FOR_CLEARANCE, int)
36
+ assert env.MLFLOW_LOCK_WAIT_FOR_CLEARANCE > 0
37
+
38
+ assert isinstance(env.MLFLOW_LOCK_WAIT_FOR_EXCLUSIVITY, int)
39
+ assert env.MLFLOW_LOCK_WAIT_FOR_EXCLUSIVITY > 0
40
+
20
41
  assert env.WEBDAV_HOSTNAME
21
42
  assert env.WEBDAV_LOGIN
22
43
  assert env.WEBDAV_PASSWORD
44
+
45
+ assert env.BLUER_OBJECTS_TEST_OBJECT
@@ -0,0 +1,25 @@
1
+ import pytest
2
+
3
+ from bluer_objects import objects, file
4
+
5
+
6
+ @pytest.mark.parametrize(
7
+ ["url"],
8
+ [
9
+ ["https://raw.githubusercontent.com/jbrownlee/Datasets/master/shampoo.csv"],
10
+ ],
11
+ )
12
+ def test_file_download(url: str):
13
+ object_name = objects.unique_object("test_file_download")
14
+
15
+ filename = objects.path_of(
16
+ object_name=object_name,
17
+ filename=url.split("/")[-1],
18
+ )
19
+
20
+ assert file.download(
21
+ url=url,
22
+ filename=filename,
23
+ )
24
+
25
+ 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
@@ -24,4 +24,6 @@ def test_graphics_gif_generate_animated_gif(
24
24
  list_of_images,
25
25
  objects.path_of("test.gif", test_object),
26
26
  scale=scale,
27
+ frame_count=10,
28
+ frame_duration=100,
27
29
  )
@@ -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
@@ -11,7 +11,7 @@ from bluer_objects.mlflow import testing
11
11
 
12
12
 
13
13
  def test_from_and_to_experiment_name():
14
- object_name = unique_object()
14
+ object_name = unique_object("test_from_and_to_experiment_name")
15
15
 
16
16
  assert (
17
17
  objects.to_object_name(objects.to_experiment_name(object_name)) == object_name
@@ -27,7 +27,7 @@ def test_mlflow_testing():
27
27
  [["x=1,y=2,z=3"]],
28
28
  )
29
29
  def test_mlflow_tag_set_get(tags_str: str):
30
- object_name = unique_object("test_mlflow_tag_set")
30
+ object_name = unique_object("test_mlflow_tag_set_get")
31
31
 
32
32
  assert tags.set_tags(
33
33
  object_name,