dcicutils 8.13.3.1b26__tar.gz → 8.13.3.1b27__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/PKG-INFO +1 -1
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/misc_utils.py +26 -9
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/pyproject.toml +1 -1
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/LICENSE.txt +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/README.rst +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/__init__.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/base.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/beanstalk_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/bundle_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/captured_output.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/cloudformation_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/codebuild_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/command_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/common.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/contribution_scripts.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/contribution_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/creds_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/data_readers.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/data_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/datetime_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/deployment_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/diff_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/docker_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/ecr_scripts.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/ecr_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/ecs_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/env_base.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/env_manager.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/env_scripts.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/env_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/env_utils_legacy.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/es_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/exceptions.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/ff_mocks.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/ff_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/file_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/function_cache_decorator.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/glacier_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/hack_for_elasticsearch_numpy_usage.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/http_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/jh_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/kibana/dashboards.json +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/kibana/readme.md +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/lang_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/c4-infrastructure.jsonc +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/c4-python-infrastructure.jsonc +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/park-lab-common-server.jsonc +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/park-lab-common.jsonc +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/park-lab-pipeline.jsonc +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/log_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/obfuscation_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/opensearch_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/portal_object_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/portal_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/progress_bar.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/project_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/qa_checkers.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/qa_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/redis_tools.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/redis_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/s3_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/schema_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/scripts/publish_to_pypi.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/scripts/run_license_checker.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/scripts/update_portal_object.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/scripts/view_portal_object.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/secrets_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/sheet_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/snapshot_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/ssl_certificate_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/structured_data.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/submitr/progress_constants.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/submitr/ref_lookup_strategy.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/task_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/tmpfile_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/trace_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/validation_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/variant_utils.py +0 -0
- {dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/zip_utils.py +0 -0
@@ -1027,24 +1027,32 @@ def to_number(value: str,
|
|
1027
1027
|
allow_multiplier_suffix: bool = False,
|
1028
1028
|
fallback: Optional[Union[int, float]] = None) -> Optional[Union[int, float]]:
|
1029
1029
|
"""
|
1030
|
-
Converts the given string value to an int, or float if as_float is True,
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1030
|
+
Converts the given string value to an int, or float if as_float is True,
|
1031
|
+
or None or the give fallback value if malformed.
|
1032
|
+
|
1033
|
+
If allow_commas is True then allows appropriately placed commas (i.e. every three digits).
|
1034
|
+
|
1035
|
+
If allow_multiplier_suffix is True allows any of the multiplier suffixes K, KB; M, MB;
|
1036
|
+
or G, GB; or T, TB; all case-insensitive; which will multiply the value by a thousand;
|
1037
|
+
a million; a billion; or a trillion; respectively.
|
1038
|
+
|
1039
|
+
If as_float is True then value is parsed and returned as a float rather than int.
|
1040
|
+
|
1041
|
+
Note that even if as_float is False, values that might LOOK like a float, can be
|
1042
|
+
an int, for example, "1.5K", returns 1500 as an int since it is; but "1.5002K"
|
1043
|
+
is malformed, since 1.5002K is equivalent to 1500.2 which is not an int.
|
1037
1044
|
"""
|
1038
1045
|
|
1039
1046
|
if not (isinstance(value, str) and (value := value.strip())):
|
1047
|
+
# Just in case the value is already the actual/desired return type.
|
1040
1048
|
if as_float is True:
|
1041
1049
|
return float(value) if isinstance(value, (float, int)) else fallback
|
1042
1050
|
else:
|
1043
1051
|
return value if isinstance(value, int) else fallback
|
1044
1052
|
|
1045
1053
|
value_multiplier = 1
|
1046
|
-
value_negative = False
|
1047
1054
|
value_fraction = None
|
1055
|
+
value_negative = False
|
1048
1056
|
|
1049
1057
|
if value.startswith("-"):
|
1050
1058
|
if not (value := value[1:].strip()):
|
@@ -1080,6 +1088,7 @@ def to_number(value: str,
|
|
1080
1088
|
value = value[:value_dot_zero_suffix.start()]
|
1081
1089
|
|
1082
1090
|
if (allow_commas is True) and ("," in value):
|
1091
|
+
# Make sure that any commas are properly placed.
|
1083
1092
|
if not re.fullmatch(r"(-?\d{1,3}(,\d{3})*)", value):
|
1084
1093
|
return fallback
|
1085
1094
|
value = value.replace(",", "")
|
@@ -1090,7 +1099,15 @@ def to_number(value: str,
|
|
1090
1099
|
value = float(value) if as_float is True else int(value)
|
1091
1100
|
|
1092
1101
|
if value_fraction:
|
1093
|
-
value_float =
|
1102
|
+
value_float = float(value) + value_fraction
|
1103
|
+
# Here we do NOT simply do: value_float *= float(value_multiplier);
|
1104
|
+
# because it introduces obvious FLOATing point precision ERRORs; for example,
|
1105
|
+
# to_integer("1.5678K", allow_multiplier_suffix=True) would yield 1567.8000000000002
|
1106
|
+
# if we simply did 1.5678 * 1000.0; but doing the multiplication 10 at a time obviates this
|
1107
|
+
# idiosyncracy yielding 1567.8; this ASSUMES that the multipliers are simple multiples of 10.
|
1108
|
+
while value_multiplier > 1:
|
1109
|
+
value_float *= 10
|
1110
|
+
value_multiplier /= 10
|
1094
1111
|
if as_float is True:
|
1095
1112
|
value = value_float
|
1096
1113
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "dcicutils"
|
3
|
-
version = "8.13.3.
|
3
|
+
version = "8.13.3.1b27" # TODO: To become 8.14.0
|
4
4
|
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
|
5
5
|
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
|
6
6
|
license = "MIT"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/hack_for_elasticsearch_numpy_usage.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/c4-infrastructure.jsonc
RENAMED
File without changes
|
File without changes
|
File without changes
|
{dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/park-lab-common.jsonc
RENAMED
File without changes
|
File without changes
|
{dcicutils-8.13.3.1b26 → dcicutils-8.13.3.1b27}/dcicutils/license_policies/park-lab-pipeline.jsonc
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|