blue-sandbox 5.348.1__py3-none-any.whl → 5.362.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.
blue_sandbox/README.py CHANGED
@@ -7,6 +7,12 @@ from blue_sandbox import NAME, VERSION, ICON, REPO_NAME
7
7
 
8
8
  items = README.Items(
9
9
  [
10
+ {
11
+ "name": "WebDAV",
12
+ "url": "./blue_sandbox/WebDAV",
13
+ "marquee": "https://github.com/kamangir/assets/raw/main/blue-sandbox/WebDAV.png?raw=true",
14
+ "description": "An interface to [WebDAV](http://www.webdav.org/) 🔥",
15
+ },
10
16
  {
11
17
  "name": "virtualcam",
12
18
  "url": "./blue_sandbox/virtualcam",
@@ -14,7 +20,6 @@ items = README.Items(
14
20
  "description": "Python + [OBS Studio](https://obsproject.com/) ⏸️",
15
21
  },
16
22
  {},
17
- {},
18
23
  ]
19
24
  )
20
25
 
@@ -0,0 +1 @@
1
+ from blue_sandbox.WebDAV.interface import WebDAVInterface
@@ -0,0 +1,104 @@
1
+ from webdav3.client import Client
2
+
3
+ from blueness import module
4
+
5
+ from blue_sandbox import NAME
6
+ from blue_sandbox import env
7
+ from blue_sandbox.logger import logger
8
+
9
+ NAME = module.name(__file__, NAME)
10
+
11
+
12
+ # https://chatgpt.com/c/67e06812-4af0-8005-b2ab-5f9a1eabbbe3
13
+ class WebDAVInterface:
14
+ def __init__(self):
15
+ config = {
16
+ "webdav_hostname": env.WEBDAV_HOSTNAME,
17
+ "webdav_login": env.WEBDAV_LOGIN,
18
+ "webdav_password": env.WEBDAV_PASSWORD,
19
+ }
20
+
21
+ self.client = Client(config)
22
+
23
+ def ensure_remote_directory(
24
+ self,
25
+ path: str,
26
+ log: bool = True,
27
+ ) -> bool:
28
+ try:
29
+ if self.client.check(path):
30
+ return True
31
+
32
+ self.client.mkdir(path)
33
+ except Exception as e:
34
+ logger.error(e)
35
+ return False
36
+
37
+ if log:
38
+ logger.info(
39
+ "{}.ensure_remote_directory: created {}".format(
40
+ NAME,
41
+ path,
42
+ )
43
+ )
44
+
45
+ return True
46
+
47
+ def upload(
48
+ self,
49
+ local_path: str,
50
+ remote_path: str,
51
+ log: bool = True,
52
+ ) -> bool:
53
+ remote_dir = "/".join(remote_path.split("/")[:-1])
54
+ if not self.ensure_remote_directory(
55
+ path=remote_dir,
56
+ log=log,
57
+ ):
58
+ return False
59
+
60
+ try:
61
+ self.client.upload_sync(
62
+ remote_path=remote_path,
63
+ local_path=local_path,
64
+ )
65
+ except Exception as e:
66
+ logger.error(e)
67
+ return False
68
+
69
+ if log:
70
+ logger.info(
71
+ "{}.upload: {} -> {}".format(
72
+ NAME,
73
+ local_path,
74
+ remote_path,
75
+ )
76
+ )
77
+
78
+ return True
79
+
80
+ def download(
81
+ self,
82
+ remote_path: str,
83
+ local_path: str,
84
+ log: bool = True,
85
+ ) -> bool:
86
+ try:
87
+ self.client.download_sync(
88
+ remote_path=remote_path,
89
+ local_path=local_path,
90
+ )
91
+ except Exception as e:
92
+ logger.error(e)
93
+ return False
94
+
95
+ if log:
96
+ logger.info(
97
+ "{}.download {} -> {}".format(
98
+ NAME,
99
+ remote_path,
100
+ local_path,
101
+ )
102
+ )
103
+
104
+ return True
blue_sandbox/__init__.py CHANGED
@@ -4,7 +4,7 @@ ICON = "🌀"
4
4
 
5
5
  DESCRIPTION = f"{ICON} A sandbox for ideas and experiments."
6
6
 
7
- VERSION = "5.348.1"
7
+ VERSION = "5.362.1"
8
8
 
9
9
  REPO_NAME = "blue-sandbox"
10
10
 
blue_sandbox/env.py CHANGED
@@ -1,30 +1,25 @@
1
- import os
2
- from blue_options.env import load_config, load_env
1
+ from blue_options.env import load_config, load_env, get_env
3
2
 
4
3
  load_env(__name__)
5
4
  load_config(__name__)
6
5
 
7
6
 
8
- DAMAGES_TEST_DATASET_OBJECT_NAME = os.getenv(
9
- "DAMAGES_TEST_DATASET_OBJECT_NAME",
10
- "",
11
- )
7
+ DAMAGES_TEST_DATASET_OBJECT_NAME = get_env("DAMAGES_TEST_DATASET_OBJECT_NAME")
12
8
 
13
- ENCODED_BLOB_SAS_TOKEN = os.getenv("ENCODED_BLOB_SAS_TOKEN", "")
9
+ ENCODED_BLOB_SAS_TOKEN = get_env("ENCODED_BLOB_SAS_TOKEN")
14
10
 
15
- SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_debug_v2 = os.getenv(
16
- "SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_debug_v2",
17
- "",
11
+ SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_debug_v2 = get_env(
12
+ "SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_debug_v2"
18
13
  )
19
14
 
20
- SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_full_v2 = os.getenv(
21
- "SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_full_v2",
22
- "",
15
+ SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_full_v2 = get_env(
16
+ "SAGESEMSEG_COMPLETED_JOB_pascal_voc_v1_full_v2"
23
17
  )
24
18
 
25
- GROQ_API_KEY = os.getenv("GROQ_API_KEY", "")
19
+ GROQ_API_KEY = get_env("GROQ_API_KEY", "")
26
20
 
27
- VISUALYZE_PORT = os.getenv(
28
- "VISUALYZE_PORT",
29
- "",
30
- )
21
+ VISUALYZE_PORT = get_env("VISUALYZE_PORT")
22
+
23
+ WEBDAV_HOSTNAME = get_env("WEBDAV_HOSTNAME")
24
+ WEBDAV_LOGIN = get_env("WEBDAV_LOGIN")
25
+ WEBDAV_PASSWORD = get_env("WEBDAV_PASSWORD")
blue_sandbox/sample.env CHANGED
@@ -1,2 +1,6 @@
1
1
  ENCODED_BLOB_SAS_TOKEN=value
2
- GROQ_API_KEY=
2
+ GROQ_API_KEY=
3
+
4
+ WEBDAV_HOSTNAME=
5
+ WEBDAV_LOGIN=
6
+ WEBDAV_PASSWORD=
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: blue_sandbox
3
- Version: 5.348.1
3
+ Version: 5.362.1
4
4
  Summary: 🌀 A sandbox for ideas and experiments.
5
5
  Home-page: https://github.com/kamangir/blue-sandbox
6
6
  Author: Arash Abadpour (Kamangir)
@@ -32,6 +32,7 @@ Requires-Dist: pylint
32
32
  Requires-Dist: pytest
33
33
  Requires-Dist: python-dotenv[cli]
34
34
  Requires-Dist: tqdm
35
+ Requires-Dist: webdavclient3
35
36
  Dynamic: author
36
37
  Dynamic: author-email
37
38
  Dynamic: classifier
@@ -53,13 +54,13 @@ pip install blue-sandbox
53
54
 
54
55
  | | | |
55
56
  | --- | --- | --- |
56
- | [`virtualcam`](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/virtualcam) [![image](https://github.com/kamangir/assets/raw/main/blue-sandbox/virtualcam.png?raw=true)](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/virtualcam) Python + [OBS Studio](https://obsproject.com/) ⏸️ | | |
57
+ | [`WebDAV`](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/WebDAV) [![image](https://github.com/kamangir/assets/raw/main/blue-sandbox/WebDAV.png?raw=true)](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/WebDAV) An interface to [WebDAV](http://www.webdav.org/) 🔥 | [`virtualcam`](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/virtualcam) [![image](https://github.com/kamangir/assets/raw/main/blue-sandbox/virtualcam.png?raw=true)](https://github.com/kamangir/blue-sandbox/blob/main/blue_sandbox/virtualcam) Python + [OBS Studio](https://obsproject.com/) ⏸️ | |
57
58
 
58
59
  ---
59
60
 
60
61
 
61
62
  [![pylint](https://github.com/kamangir/blue-sandbox/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-sandbox/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-sandbox/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-sandbox.svg)](https://pypi.org/project/blue-sandbox/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-sandbox)](https://pypistats.org/packages/blue-sandbox)
62
63
 
63
- built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_sandbox-5.348.1`](https://github.com/kamangir/blue-sandbox).
64
+ built by 🌀 [`blue_options-4.240.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_sandbox-5.362.1`](https://github.com/kamangir/blue-sandbox).
64
65
 
65
66
  built by 🌀 [`blueness-3.96.1`](https://github.com/kamangir/blueness).
@@ -1,12 +1,12 @@
1
- blue_sandbox/README.py,sha256=M-jR3Q1d-yMdYbxUeNPlab1fLQgUWh_OAWcQ9qk8D7k,933
2
- blue_sandbox/__init__.py,sha256=BP1jqEwNoMDdtRu_kxx2xk1K2pAC7hWxPQjiwDtDUZc,323
1
+ blue_sandbox/README.py,sha256=up7q6GWPDTKUJwE9LVxStijKqeqPnXcfhf4EEtVzmXs,1203
2
+ blue_sandbox/__init__.py,sha256=ZVArYs_oGNOE5TN-kdfwflklvz3H1vTgpWueU4i1mCo,323
3
3
  blue_sandbox/__main__.py,sha256=aPRHSpGpk-bDbzhHpfLNsd3y1gGEHpnhoTF-RBweNwc,361
4
4
  blue_sandbox/config.env,sha256=TMUch2y2XZcLEonfpb-VXFFCuFdyD_6TTgtOrBAqqs0,329
5
- blue_sandbox/env.py,sha256=jXFVGqvLPXeapU6ziawXYfvtsT4ervHnUq2MhPtLsuU,626
5
+ blue_sandbox/env.py,sha256=_sX-L-4cVzzjyctaTy-fOdwFQ28X0i260ngO_BC_WH4,691
6
6
  blue_sandbox/functions.py,sha256=U41kQFNPpfYV6KJpMnkqgqLkozqXiG4tgV6rj8IW1BU,7
7
7
  blue_sandbox/host.py,sha256=uJpiM105rnm6ySF16zA7waWekGBdec-dlpoRRU_QqwU,210
8
8
  blue_sandbox/logger.py,sha256=ZoFrTIfJJGNtZUm2d7lkQjdB2SPl_KBKDmHJOcIivPM,107
9
- blue_sandbox/sample.env,sha256=qtSmtvFB1SITG4XaG5dT45YWvGZgOW1_DJZf-WUTUXo,42
9
+ blue_sandbox/sample.env,sha256=sps4pLlTKjjmdmijJH8DCgun7_PbIsUFvYBXHz4cbnc,91
10
10
  blue_sandbox/urls.py,sha256=tIZ36ONJEoUBM-tFhOpkVhLwb1OgLegUeEaBDqW4USM,24
11
11
  blue_sandbox/.abcli/abcli.sh,sha256=xsJ4IzuQsvLZog6U8VTBFVXsEi6ADe13L8rn47XtlbU,196
12
12
  blue_sandbox/.abcli/actions.sh,sha256=vImEUI105GRcxs2mAKGMqcvoErtmOPZZ-7dfSmUUxvE,230
@@ -20,6 +20,8 @@ blue_sandbox/.abcli/assets/publish.sh,sha256=pyP1c9R4tD17OMsNUEm21IyKtTYMdvYi0hd
20
20
  blue_sandbox/.abcli/tests/README.sh,sha256=rmJM-BPnTcmpPbJ5GXsF8vd_a84JKryeKkZyVScUing,145
21
21
  blue_sandbox/.abcli/tests/help.sh,sha256=Di6Bp4oL3le3qJ0EkL-jeBDU50GWwrcoHgEAZiT6is0,315
22
22
  blue_sandbox/.abcli/tests/version.sh,sha256=jF8zoJN1eKE3LfDeRVG9uHEosmEVJX6RtKfdioyeN-o,150
23
+ blue_sandbox/WebDAV/__init__.py,sha256=A216rvPTfnuNtSLH4-ollRM07OXxzXtpTx0ZWG8skNI,58
24
+ blue_sandbox/WebDAV/interface.py,sha256=hDPQA1eqh6a3jT6jxQCQgSIqxMkei-Qh2RbvT3IiC8Q,2409
23
25
  blue_sandbox/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
26
  blue_sandbox/assets/__main__.py,sha256=jYzzDEIEkhOZey_0WaD5Z_hGRWnyl7eXxOoLX97Hz7Y,964
25
27
  blue_sandbox/assets/functions.py,sha256=2qMOPAL_49WfdP-NZ-g7dYsfempMOIOL8gDvKQkTVt4,1774
@@ -28,8 +30,8 @@ blue_sandbox/help/__main__.py,sha256=3Cqp5oISrZCOUApmwoQoCj_0sQgtkiEkm_ob3LFKzRE
28
30
  blue_sandbox/help/functions.py,sha256=6pqjFj4iQYWuRyhmEKe-ErPCZW963n-Q1AdfNbfeQos,165
29
31
  blue_sandbox/virtualcam/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
32
  blue_sandbox/virtualcam/__main__.py,sha256=CZohAg_6NcAxK7RC3EiD0s9kr0X3LIbH2f-qgIymcQc,614
31
- blue_sandbox-5.348.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
32
- blue_sandbox-5.348.1.dist-info/METADATA,sha256=zDW74MfyWJLamhWfMY6ZVaF660cAHP6K6-xAXK5ryTg,2616
33
- blue_sandbox-5.348.1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
34
- blue_sandbox-5.348.1.dist-info/top_level.txt,sha256=4D9Cb9QUCaqdYAmBiCwvtlaYBtUYVVxv0Sxcr_pzgS8,13
35
- blue_sandbox-5.348.1.dist-info/RECORD,,
33
+ blue_sandbox-5.362.1.dist-info/licenses/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
34
+ blue_sandbox-5.362.1.dist-info/METADATA,sha256=WCbLtw6a3h44aq-PecqApIk8Hxl0S0UBDOwVCPmNodE,2942
35
+ blue_sandbox-5.362.1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
36
+ blue_sandbox-5.362.1.dist-info/top_level.txt,sha256=4D9Cb9QUCaqdYAmBiCwvtlaYBtUYVVxv0Sxcr_pzgS8,13
37
+ blue_sandbox-5.362.1.dist-info/RECORD,,