blue-sandbox 5.318.1__py3-none-any.whl → 5.322.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.
@@ -0,0 +1,30 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_assets_publish() {
4
+ local options=$1
5
+
6
+ local do_download=$(abcli_option_int "$options" download 0)
7
+ local do_push=$(abcli_option_int "$options" push 0)
8
+ local extensions=$(abcli_option "$options" extensions png+geojson)
9
+
10
+ local object_name=$(abcli_clarify_object $2 .)
11
+
12
+ [[ "$do_download" == 1 ]] &&
13
+ abcli_download - $object_name
14
+
15
+ abcli_eval dryrun=$do_dryrun \
16
+ python3 -m blue_sandbox.assets \
17
+ publish \
18
+ --object_name $object_name \
19
+ --extensions $extensions \
20
+ "${@:3}"
21
+ [[ $? -ne 0 ]] && return 1
22
+
23
+ [[ "$do_push" == 1 ]] &&
24
+ abcli_git \
25
+ assets \
26
+ push \
27
+ "$object_name update."
28
+
29
+ return 0
30
+ }
@@ -0,0 +1,15 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function abcli_assets() {
4
+ local task=$(abcli_unpack_keyword $1 help)
5
+
6
+ local function_name=abcli_assets_$task
7
+ if [[ $(type -t $function_name) == "function" ]]; then
8
+ $function_name "${@:2}"
9
+ return
10
+ fi
11
+
12
+ python3 -m blue_sandbox.assets "$@"
13
+ }
14
+
15
+ abcli_source_caller_suffix_path /assets
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.318.1"
7
+ VERSION = "5.322.1"
8
8
 
9
9
  REPO_NAME = "blue-sandbox"
10
10
 
File without changes
@@ -0,0 +1,51 @@
1
+ import argparse
2
+
3
+ from blueness import module
4
+ from blueness.argparse.generic import sys_exit
5
+
6
+ from blue_sandbox import NAME
7
+ from blue_sandbox.assets.functions import publish
8
+ from blue_sandbox.logger import logger
9
+
10
+ NAME = module.name(__file__, NAME)
11
+
12
+ parser = argparse.ArgumentParser(NAME)
13
+ parser.add_argument(
14
+ "task",
15
+ type=str,
16
+ help="publish",
17
+ )
18
+ parser.add_argument(
19
+ "--arg",
20
+ type=bool,
21
+ default=0,
22
+ help="0|1",
23
+ )
24
+ parser.add_argument(
25
+ "--object_name",
26
+ type=str,
27
+ )
28
+ parser.add_argument(
29
+ "--extensions",
30
+ type=str,
31
+ default="png+geojson",
32
+ help="png+geojson",
33
+ )
34
+ parser.add_argument(
35
+ "--prefix",
36
+ type=str,
37
+ default="",
38
+ )
39
+ args = parser.parse_args()
40
+
41
+ success = False
42
+ if args.task == "publish":
43
+ success = publish(
44
+ object_name=args.object_name,
45
+ list_of_extensions=args.extensions.split("+"),
46
+ prefix=args.prefix,
47
+ )
48
+ else:
49
+ success = None
50
+
51
+ sys_exit(logger, NAME, args.task, success)
@@ -0,0 +1,68 @@
1
+ import os
2
+ from typing import List
3
+ import glob
4
+ from tqdm import tqdm
5
+
6
+ from blueness import module
7
+ from blue_objects import objects, file
8
+ from blue_objects.env import abcli_path_git
9
+ from blue_geo.file.load import load_geodataframe
10
+ from blue_geo.file.save import save_geojson
11
+
12
+ from blue_sandbox import NAME
13
+ from blue_sandbox.logger import logger
14
+
15
+
16
+ NAME = module.name(__file__, NAME)
17
+
18
+
19
+ def publish(
20
+ object_name: str,
21
+ list_of_extensions: List[str],
22
+ prefix: str = "",
23
+ log: bool = True,
24
+ ) -> bool:
25
+ logger.info(
26
+ "{}.publish: {}/{}.* for {}".format(
27
+ NAME,
28
+ object_name,
29
+ prefix,
30
+ ", ".join(list_of_extensions),
31
+ )
32
+ )
33
+
34
+ for extension in tqdm(list_of_extensions):
35
+ for filename in glob.glob(
36
+ objects.path_of(
37
+ filename=f"{prefix}*.{extension}",
38
+ object_name=object_name,
39
+ )
40
+ ):
41
+ published_filename = os.path.join(
42
+ abcli_path_git,
43
+ "assets",
44
+ object_name,
45
+ file.name_and_extension(filename),
46
+ )
47
+
48
+ if extension in ["png", "jpg", "jpeg", "gif"]:
49
+ if not file.copy(
50
+ filename,
51
+ published_filename,
52
+ log=log,
53
+ ):
54
+ return False
55
+
56
+ if extension == "geojson":
57
+ success, gdf = load_geodataframe(filename)
58
+ if not success:
59
+ return False
60
+
61
+ gdf = gdf.to_crs("EPSG:4326")
62
+
63
+ if not save_geojson(published_filename, gdf):
64
+ return False
65
+
66
+ logger.info(f"🔗 https://github.com/kamangir/assets/tree/main/{object_name}")
67
+
68
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_sandbox
3
- Version: 5.318.1
3
+ Version: 5.322.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)
@@ -56,4 +56,4 @@ pip install blue-sandbox
56
56
 
57
57
  [![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)
58
58
 
59
- built by 🌀 [`blue_options-4.202.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_sandbox-5.318.1`](https://github.com/kamangir/blue-sandbox).
59
+ built by 🌀 [`blue_options-4.223.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_sandbox-5.322.1`](https://github.com/kamangir/blue-sandbox).
@@ -1,5 +1,5 @@
1
1
  blue_sandbox/README.py,sha256=0-5yDVr9YjmE-PfwJUiwzm2vU_t6CPMg81lK-08Ti_8,298
2
- blue_sandbox/__init__.py,sha256=YAGosuIdPY-SgwCPop0IE_XfK8AuHoR1m90d9mInBWY,323
2
+ blue_sandbox/__init__.py,sha256=TUXimaNcFIXkvM-gsHSb3uzTlGosmIkPY6s4Q3GmQg0,323
3
3
  blue_sandbox/__main__.py,sha256=aPRHSpGpk-bDbzhHpfLNsd3y1gGEHpnhoTF-RBweNwc,361
4
4
  blue_sandbox/config.env,sha256=TMUch2y2XZcLEonfpb-VXFFCuFdyD_6TTgtOrBAqqs0,329
5
5
  blue_sandbox/env.py,sha256=jXFVGqvLPXeapU6ziawXYfvtsT4ervHnUq2MhPtLsuU,626
@@ -12,17 +12,22 @@ blue_sandbox/.abcli/abcli.sh,sha256=xsJ4IzuQsvLZog6U8VTBFVXsEi6ADe13L8rn47XtlbU,
12
12
  blue_sandbox/.abcli/actions.sh,sha256=vImEUI105GRcxs2mAKGMqcvoErtmOPZZ-7dfSmUUxvE,230
13
13
  blue_sandbox/.abcli/aka.sh,sha256=RHDU_JbEEL2B0vvvRJ3NVSsRSEjSu09jNY85n7DLe-k,21
14
14
  blue_sandbox/.abcli/alias.sh,sha256=iO0wZPVClb6I_zRUJijXwtpVqJFIJSJ6E-sKlDEUsdE,189
15
+ blue_sandbox/.abcli/assets.sh,sha256=wSpbb2MWqBUcLBqSyOgtXUSZ9iertL3je8W_rXIwDO4,336
15
16
  blue_sandbox/.abcli/blue_sandbox.sh,sha256=PGRJOgNGlC3XL5cw4ecZH40LDuc_6NVazTKhCWtZ-3g,233
16
17
  blue_sandbox/.abcli/browse.sh,sha256=f8qa4qDVts2Am6_ldDwNeJXzhBQTk9PUKl0-a9wW1ww,287
17
18
  blue_sandbox/.abcli/install.sh,sha256=zvl0GsHBmfw62ORmkMlhug264N_Zr8nc3rlPGFoq7Mk,125
19
+ blue_sandbox/.abcli/assets/publish.sh,sha256=Ef33Fr2on7a-stjVh1FNp1596faKZRdZfKcZkDNYzgg,749
18
20
  blue_sandbox/.abcli/tests/README.sh,sha256=rmJM-BPnTcmpPbJ5GXsF8vd_a84JKryeKkZyVScUing,145
19
21
  blue_sandbox/.abcli/tests/help.sh,sha256=Di6Bp4oL3le3qJ0EkL-jeBDU50GWwrcoHgEAZiT6is0,315
20
22
  blue_sandbox/.abcli/tests/version.sh,sha256=jF8zoJN1eKE3LfDeRVG9uHEosmEVJX6RtKfdioyeN-o,150
23
+ blue_sandbox/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
+ blue_sandbox/assets/__main__.py,sha256=jYzzDEIEkhOZey_0WaD5Z_hGRWnyl7eXxOoLX97Hz7Y,964
25
+ blue_sandbox/assets/functions.py,sha256=2qMOPAL_49WfdP-NZ-g7dYsfempMOIOL8gDvKQkTVt4,1774
21
26
  blue_sandbox/help/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
22
27
  blue_sandbox/help/__main__.py,sha256=3Cqp5oISrZCOUApmwoQoCj_0sQgtkiEkm_ob3LFKzRE,234
23
28
  blue_sandbox/help/functions.py,sha256=6pqjFj4iQYWuRyhmEKe-ErPCZW963n-Q1AdfNbfeQos,165
24
- blue_sandbox-5.318.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
25
- blue_sandbox-5.318.1.dist-info/METADATA,sha256=FxwHPggLkxGFRbNEpgwkQIaD1pt6Hv_Ny6vbs4dYTnM,2162
26
- blue_sandbox-5.318.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
27
- blue_sandbox-5.318.1.dist-info/top_level.txt,sha256=4D9Cb9QUCaqdYAmBiCwvtlaYBtUYVVxv0Sxcr_pzgS8,13
28
- blue_sandbox-5.318.1.dist-info/RECORD,,
29
+ blue_sandbox-5.322.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
30
+ blue_sandbox-5.322.1.dist-info/METADATA,sha256=WWuxKzToOjtyH9r-oeVoHPAti-qOpYScqBH87SwhMO8,2162
31
+ blue_sandbox-5.322.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
32
+ blue_sandbox-5.322.1.dist-info/top_level.txt,sha256=4D9Cb9QUCaqdYAmBiCwvtlaYBtUYVVxv0Sxcr_pzgS8,13
33
+ blue_sandbox-5.322.1.dist-info/RECORD,,