bluer-objects 6.100.1__py3-none-any.whl → 6.103.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.

@@ -2,8 +2,17 @@
2
2
 
3
3
  function bluer_ai_storage_clear() {
4
4
  local options=$1
5
+ local do_cloud=$(bluer_ai_option_int "$options" cloud 0)
5
6
  local do_dryrun=$(bluer_ai_option_int "$options" dryrun 1)
6
7
 
8
+ if [[ "$do_cloud" == 1 ]]; then
9
+ python3 -m bluer_objects.storage \
10
+ clear \
11
+ --do_dryrun $do_dryrun \
12
+ "${@:2}"
13
+ return
14
+ fi
15
+
7
16
  if [[ "$abcli_is_rpi" == true ]]; then
8
17
  bluer_ai_eval dryrun=$do_dryrun \
9
18
  rm -rfv $ABCLI_OBJECT_ROOT
bluer_objects/__init__.py CHANGED
@@ -4,7 +4,7 @@ ICON = "🌀"
4
4
 
5
5
  DESCRIPTION = f"{ICON} Object management in Bash."
6
6
 
7
- VERSION = "6.100.1"
7
+ VERSION = "6.103.1"
8
8
 
9
9
  REPO_NAME = "bluer-objects"
10
10
 
@@ -2,6 +2,7 @@ import glob
2
2
  import os
3
3
  from typing import Tuple, List
4
4
  from webdav3.client import Client
5
+ from tqdm import tqdm
5
6
 
6
7
  from bluer_objects.storage.base import StorageInterface
7
8
  from bluer_objects import env, file, path
@@ -25,6 +26,40 @@ class WebDAVzipInterface(StorageInterface):
25
26
 
26
27
  self.client = Client(config)
27
28
 
29
+ def clear(
30
+ self,
31
+ do_dryrun: bool = True,
32
+ ) -> bool:
33
+ logger.info(
34
+ "{}.clear({})".format(
35
+ self.__class__.__name__,
36
+ "dryrun" if do_dryrun else "",
37
+ )
38
+ )
39
+
40
+ count: int = 0
41
+ for thing in tqdm(self.client.list()):
42
+ if not thing.endswith(".zip"):
43
+ continue
44
+ if not thing.startswith("test"):
45
+ continue
46
+
47
+ logger.info(thing)
48
+ if do_dryrun:
49
+ continue
50
+
51
+ try:
52
+ self.client.clean(remote_path=thing)
53
+ except Exception as e:
54
+ logger.error(e)
55
+ return False
56
+
57
+ count += 1
58
+
59
+ logger.info(f"deleted {count} object(s).")
60
+
61
+ return True
62
+
28
63
  def download(
29
64
  self,
30
65
  object_name: str,
@@ -17,6 +17,14 @@ else:
17
17
  assert False
18
18
 
19
19
 
20
+ def clear(
21
+ do_dryrun: bool = True,
22
+ ) -> bool:
23
+ return interface.clear(
24
+ do_dryrun=do_dryrun,
25
+ )
26
+
27
+
20
28
  def download(
21
29
  object_name: str,
22
30
  filename: str = "",
@@ -13,7 +13,7 @@ parser = argparse.ArgumentParser(NAME)
13
13
  parser.add_argument(
14
14
  "task",
15
15
  type=str,
16
- help="download | ls | upload",
16
+ help="clear | download | ls | upload",
17
17
  )
18
18
  parser.add_argument(
19
19
  "--object_name",
@@ -41,12 +41,22 @@ parser.add_argument(
41
41
  type=str,
42
42
  default=",",
43
43
  )
44
+ parser.add_argument(
45
+ "--do_dryrun",
46
+ type=int,
47
+ default=1,
48
+ help="0 | 1",
49
+ )
44
50
  args = parser.parse_args()
45
51
 
46
52
  delim = " " if args.delim == "space" else args.delim
47
53
 
48
54
  success = False
49
- if args.task == "download":
55
+ if args.task == "clear":
56
+ success = storage.clear(
57
+ do_dryrun=args.do_dryrun == 1,
58
+ )
59
+ elif args.task == "download":
50
60
  success = storage.download(
51
61
  object_name=args.object_name,
52
62
  filename=args.filename,
@@ -4,6 +4,12 @@ from bluer_objects.logger import logger
4
4
 
5
5
 
6
6
  class StorageInterface:
7
+ def clear(
8
+ self,
9
+ do_dryrun: bool = True,
10
+ ) -> bool:
11
+ return False
12
+
7
13
  def download(
8
14
  self,
9
15
  object_name: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bluer_objects
3
- Version: 6.100.1
3
+ Version: 6.103.1
4
4
  Summary: 🌀 Object management in Bash.
5
5
  Home-page: https://github.com/kamangir/bluer-objects
6
6
  Author: Arash Abadpour (Kamangir)
@@ -63,6 +63,6 @@ pip install bluer-objects
63
63
 
64
64
  [![pylint](https://github.com/kamangir/bluer-objects/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/bluer-objects/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/bluer-objects/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/bluer-objects/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/bluer-objects/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/bluer-objects/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/bluer-objects.svg)](https://pypi.org/project/bluer-objects/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/bluer-objects)](https://pypistats.org/packages/bluer-objects)
65
65
 
66
- built by 🌀 [`bluer README`](https://github.com/kamangir/bluer-objects/tree/main/bluer_objects/README), based on 🌀 [`bluer_objects-6.100.1`](https://github.com/kamangir/bluer-objects).
66
+ built by 🌀 [`bluer README`](https://github.com/kamangir/bluer-objects/tree/main/bluer_objects/README), based on 🌀 [`bluer_objects-6.103.1`](https://github.com/kamangir/bluer-objects).
67
67
 
68
68
  built by 🌀 [`blueness-3.118.1`](https://github.com/kamangir/blueness).
@@ -1,4 +1,4 @@
1
- bluer_objects/__init__.py,sha256=-8VfEi6LEkIcmFSCOrTjri0_BATuBHoahnb9TJ0AVHY,315
1
+ bluer_objects/__init__.py,sha256=l5ZTPs6AveML8TYHvGI4_JJmsBGTpj05VyBncLTC1L8,315
2
2
  bluer_objects/__main__.py,sha256=Yqfov833_hJuRne19WrGhT5DWAPtdffpoMxeSXS7EGw,359
3
3
  bluer_objects/config.env,sha256=cMVT0kVQ00xGUoQyUqC8jpqkhR13Kpkl1-0sKQlxQAI,85
4
4
  bluer_objects/env.py,sha256=J5LklWyWT-Yvvoe8MVCZQ3iqRqyDutq6IbNYNj9A1VM,1183
@@ -40,7 +40,7 @@ bluer_objects/.abcli/mlflow/tags/clone.sh,sha256=HY2tigFx9fG4BVDjcoQAUCKil01yESv
40
40
  bluer_objects/.abcli/mlflow/tags/get.sh,sha256=hsI_zzwJkRmnxvAKlCPdkGlEbn5Ol3eVp8sOi_iA2o8,233
41
41
  bluer_objects/.abcli/mlflow/tags/search.sh,sha256=kJBLkd7_ACeMUXdRk-zXkBfOoiyDWwO8sUit2NkIhNY,299
42
42
  bluer_objects/.abcli/mlflow/tags/set.sh,sha256=-8hYtWAChlGbKIiI502IyaEaTikuACFFwUTdUnGkW7Q,277
43
- bluer_objects/.abcli/storage/clear.sh,sha256=GDI2YZPPA1wY5Spt05cbBRz4AIjUly3hzK11FkyKK7k,1263
43
+ bluer_objects/.abcli/storage/clear.sh,sha256=QgotGPskzCwtTjKobokduCfjfy6vFHqzFZ6t-H9qwN0,1504
44
44
  bluer_objects/.abcli/storage/download_file.sh,sha256=2ZQgsxzSYw5Zwcj5XQn-NcHI_MkmzmmZWLM4D1ev1N4,203
45
45
  bluer_objects/.abcli/storage/exists.sh,sha256=0b8wgjts1z8GZbE_KeulbrG471hACKORPPcwwqRvYNE,163
46
46
  bluer_objects/.abcli/storage/list.sh,sha256=ySUDS31yq9qQ_2q7oXR302hConAzs0LYQ739TWJgQsI,165
@@ -108,10 +108,10 @@ bluer_objects/mlflow/runs.py,sha256=v1IKRvxbuKkengESnG-xdUXxxNSkALMeBmfMQwrUKSs,
108
108
  bluer_objects/mlflow/tags.py,sha256=8uBYRrE4weTLrwPqo-c4M21FEVRANf7SGCcxpoCPhuM,2475
109
109
  bluer_objects/mlflow/testing.py,sha256=cJH5Ki02fJN_Xos1j9yvwQChXvMkOa9i12vtDKmkbNc,842
110
110
  bluer_objects/storage/WebDAV.py,sha256=bTq06MjTO9RffP3Uc4oEKwFaGx18DFb29VxD3jrPTz4,3078
111
- bluer_objects/storage/WebDAVzip.py,sha256=GlVt9umKQOFzI9PUepdYXCVLw1Gidu6IW_dBR2Hd3Go,3553
112
- bluer_objects/storage/__init__.py,sha256=PDHaF4J4d6bxlpf_7_25sHE1hEbtwjNqMAZk75QpiSk,1205
113
- bluer_objects/storage/__main__.py,sha256=fmdj5AXHnp8sdizD1grUqjRPiutWgTjgv09fH5Xvm68,1578
114
- bluer_objects/storage/base.py,sha256=2A5Dy4q134z4aA4gAp5_K3Kw08pVNbElE5eN0NM6Uks,1031
111
+ bluer_objects/storage/WebDAVzip.py,sha256=7N1m4VZy1UIQZj7z5nkiuP_LxkW9GeKA_n6oLb_ikDw,4376
112
+ bluer_objects/storage/__init__.py,sha256=8KFhOPVw-5m1CiFUh8Ppz4zRA5kBo4nOBVbpznk6998,1320
113
+ bluer_objects/storage/__main__.py,sha256=vZI6rUkrekf1eYUgWOOUnFhl4qPfpByzwb-tihTOiIo,1776
114
+ bluer_objects/storage/base.py,sha256=bxccHx78H_2Ux7dlwl1qrPMeEs72SHFAO_quhmJ31Sw,1129
115
115
  bluer_objects/testing/__init__.py,sha256=DWY5ZtvCnHG_t9BDiqy_ArLOZi-nlyAtPVMLA1PPAMU,62
116
116
  bluer_objects/testing/__main__.py,sha256=EfuNfx1TXLriW6HHf86L7qp1FXoEV5F4sxej1r_i95k,656
117
117
  bluer_objects/testing/functions.py,sha256=AXAfzWLcEPkbSYTehdahshjKJ45C4IJkRs_TgrHOntc,1355
@@ -136,8 +136,8 @@ bluer_objects/tests/test_path.py,sha256=JjONWyhZyMM_u1SzD1RI_iZ5vYJDUe-B51fbbHcz
136
136
  bluer_objects/tests/test_storage.py,sha256=2tJ6Hev9ShId9Qn-0FXDw41HWjcl3wymcB_Bv1FJWi4,1127
137
137
  bluer_objects/tests/test_testing.py,sha256=d2NH435yqJBl9wmfMqGGd-f0Y0jsL2QhHUXkty9AwPA,235
138
138
  bluer_objects/tests/test_version.py,sha256=Lyf3PMcA22e17BNRk_2VgPrtao6dWEgVoXo68Uds8SE,75
139
- bluer_objects-6.100.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
140
- bluer_objects-6.100.1.dist-info/METADATA,sha256=1kFw-knAHfsoGbxE2PEk5Hg1f_o2hkzUSPScspJK6oA,3554
141
- bluer_objects-6.100.1.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
142
- bluer_objects-6.100.1.dist-info/top_level.txt,sha256=RX2TpddbnRkurda3G_pAdyeTztP2IhhRPx949GlEvQo,14
143
- bluer_objects-6.100.1.dist-info/RECORD,,
139
+ bluer_objects-6.103.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
140
+ bluer_objects-6.103.1.dist-info/METADATA,sha256=jtcIhVIzQCwRR3Rxj-us7_yS8-ccb5ZBkvZhnn5W3N8,3554
141
+ bluer_objects-6.103.1.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
142
+ bluer_objects-6.103.1.dist-info/top_level.txt,sha256=RX2TpddbnRkurda3G_pAdyeTztP2IhhRPx949GlEvQo,14
143
+ bluer_objects-6.103.1.dist-info/RECORD,,