dcicutils 8.13.3.1b23__py3-none-any.whl → 8.13.3.1b25__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.
- dcicutils/misc_utils.py +5 -7
- {dcicutils-8.13.3.1b23.dist-info → dcicutils-8.13.3.1b25.dist-info}/METADATA +1 -1
- {dcicutils-8.13.3.1b23.dist-info → dcicutils-8.13.3.1b25.dist-info}/RECORD +6 -6
- {dcicutils-8.13.3.1b23.dist-info → dcicutils-8.13.3.1b25.dist-info}/LICENSE.txt +0 -0
- {dcicutils-8.13.3.1b23.dist-info → dcicutils-8.13.3.1b25.dist-info}/WHEEL +0 -0
- {dcicutils-8.13.3.1b23.dist-info → dcicutils-8.13.3.1b25.dist-info}/entry_points.txt +0 -0
dcicutils/misc_utils.py
CHANGED
@@ -1005,16 +1005,12 @@ _MULTIPLIER_T = 1000 * _MULTIPLIER_G
|
|
1005
1005
|
|
1006
1006
|
_MULTIPLIER_SUFFIXES = {
|
1007
1007
|
"K": _MULTIPLIER_K,
|
1008
|
-
"Kb": _MULTIPLIER_K,
|
1009
1008
|
"KB": _MULTIPLIER_K,
|
1010
1009
|
"M": _MULTIPLIER_M,
|
1011
|
-
"Mb": _MULTIPLIER_M,
|
1012
1010
|
"MB": _MULTIPLIER_M,
|
1013
1011
|
"G": _MULTIPLIER_G,
|
1014
|
-
"Gb": _MULTIPLIER_G,
|
1015
1012
|
"GB": _MULTIPLIER_G,
|
1016
1013
|
"T": _MULTIPLIER_T,
|
1017
|
-
"Tb": _MULTIPLIER_T,
|
1018
1014
|
"TB": _MULTIPLIER_T
|
1019
1015
|
}
|
1020
1016
|
|
@@ -1051,8 +1047,9 @@ def to_number(value: str,
|
|
1051
1047
|
return fallback
|
1052
1048
|
|
1053
1049
|
if allow_multiplier_suffix is True:
|
1050
|
+
value_upper = value.upper()
|
1054
1051
|
for suffix in _MULTIPLIER_SUFFIXES:
|
1055
|
-
if
|
1052
|
+
if value_upper.endswith(suffix):
|
1056
1053
|
value_multiplier *= _MULTIPLIER_SUFFIXES[suffix]
|
1057
1054
|
if not (value := value[:-len(suffix)].strip()):
|
1058
1055
|
return fallback
|
@@ -1062,7 +1059,6 @@ def to_number(value: str,
|
|
1062
1059
|
if (dot_index := value.rfind(".")) >= 0:
|
1063
1060
|
if value_fraction := value[dot_index + 1:].strip():
|
1064
1061
|
try:
|
1065
|
-
# value_fraction = float(f"0.{value_fraction}")
|
1066
1062
|
value_fraction = float(f"0.{value_fraction}")
|
1067
1063
|
except Exception:
|
1068
1064
|
return fallback
|
@@ -1109,12 +1105,14 @@ def to_boolean(value: str, fallback: Optional[Any]) -> Optional[Any]:
|
|
1109
1105
|
return fallback
|
1110
1106
|
|
1111
1107
|
|
1112
|
-
def to_enum(value: str, enumerators: List[str]) -> Optional[str]:
|
1108
|
+
def to_enum(value: str, enumerators: List[str], fuzzy: bool = False) -> Optional[str]:
|
1113
1109
|
matches = []
|
1114
1110
|
if isinstance(value, str) and (value := value.strip()) and isinstance(enumerators, List):
|
1115
1111
|
enum_specifiers = {str(enum).lower(): enum for enum in enumerators}
|
1116
1112
|
if (enum_value := enum_specifiers.get(lower_value := value.lower())) is not None:
|
1117
1113
|
return enum_value
|
1114
|
+
if fuzzy is not True:
|
1115
|
+
return value
|
1118
1116
|
for enum_canonical, _ in enum_specifiers.items():
|
1119
1117
|
if enum_canonical.startswith(lower_value):
|
1120
1118
|
matches.append(enum_canonical)
|
@@ -45,7 +45,7 @@ dcicutils/license_policies/park-lab-gpl-pipeline.jsonc,sha256=vLZkwm3Js-kjV44nug
|
|
45
45
|
dcicutils/license_policies/park-lab-pipeline.jsonc,sha256=9qlY0ASy3iUMQlr3gorVcXrSfRHnVGbLhkS427UaRy4,283
|
46
46
|
dcicutils/license_utils.py,sha256=2Yxnh1T1iuMe6wluwbvpFO_zYSGPxB4-STAMc-vz-YM,47202
|
47
47
|
dcicutils/log_utils.py,sha256=7pWMc6vyrorUZQf-V-M3YC6zrPgNhuV_fzm9xqTPph0,10883
|
48
|
-
dcicutils/misc_utils.py,sha256=
|
48
|
+
dcicutils/misc_utils.py,sha256=4Kj_0llvUabA1O-n4cGkFdDq_shq_b8iDFDpL9AAIkQ,112934
|
49
49
|
dcicutils/obfuscation_utils.py,sha256=fo2jOmDRC6xWpYX49u80bVNisqRRoPskFNX3ymFAmjw,5963
|
50
50
|
dcicutils/opensearch_utils.py,sha256=V2exmFYW8Xl2_pGFixF4I2Cc549Opwe4PhFi5twC0M8,1017
|
51
51
|
dcicutils/portal_object_utils.py,sha256=Az3n1aL-PQkN5gOFE6ZqC2XkYsqiwKlq7-tZggs1QN4,11062
|
@@ -75,8 +75,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
|
|
75
75
|
dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
|
76
76
|
dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
|
77
77
|
dcicutils/zip_utils.py,sha256=_Y9EmL3D2dUZhxucxHvrtmmlbZmK4FpSsHEb7rGSJLU,3265
|
78
|
-
dcicutils-8.13.3.
|
79
|
-
dcicutils-8.13.3.
|
80
|
-
dcicutils-8.13.3.
|
81
|
-
dcicutils-8.13.3.
|
82
|
-
dcicutils-8.13.3.
|
78
|
+
dcicutils-8.13.3.1b25.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
|
79
|
+
dcicutils-8.13.3.1b25.dist-info/METADATA,sha256=SUAgwGUivRxlaR7vnZQEmmCaCcjBWeU7M2KySPMDmwo,3440
|
80
|
+
dcicutils-8.13.3.1b25.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
81
|
+
dcicutils-8.13.3.1b25.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
|
82
|
+
dcicutils-8.13.3.1b25.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|