dcicutils 8.13.3.1b24__py3-none-any.whl → 8.13.3.1b25__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
dcicutils/misc_utils.py CHANGED
@@ -1059,7 +1059,6 @@ def to_number(value: str,
1059
1059
  if (dot_index := value.rfind(".")) >= 0:
1060
1060
  if value_fraction := value[dot_index + 1:].strip():
1061
1061
  try:
1062
- # value_fraction = float(f"0.{value_fraction}")
1063
1062
  value_fraction = float(f"0.{value_fraction}")
1064
1063
  except Exception:
1065
1064
  return fallback
@@ -1106,12 +1105,14 @@ def to_boolean(value: str, fallback: Optional[Any]) -> Optional[Any]:
1106
1105
  return fallback
1107
1106
 
1108
1107
 
1109
- def to_enum(value: str, enumerators: List[str]) -> Optional[str]:
1108
+ def to_enum(value: str, enumerators: List[str], fuzzy: bool = False) -> Optional[str]:
1110
1109
  matches = []
1111
1110
  if isinstance(value, str) and (value := value.strip()) and isinstance(enumerators, List):
1112
1111
  enum_specifiers = {str(enum).lower(): enum for enum in enumerators}
1113
1112
  if (enum_value := enum_specifiers.get(lower_value := value.lower())) is not None:
1114
1113
  return enum_value
1114
+ if fuzzy is not True:
1115
+ return value
1115
1116
  for enum_canonical, _ in enum_specifiers.items():
1116
1117
  if enum_canonical.startswith(lower_value):
1117
1118
  matches.append(enum_canonical)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.13.3.1b24
3
+ Version: 8.13.3.1b25
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -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=IIppGKxdEZmKQKFQnUFylLZIg1YUYjAkMslnUhA4h54,112926
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.1b24.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
79
- dcicutils-8.13.3.1b24.dist-info/METADATA,sha256=Z2pf6DW_2O_gZWUcenMJmDRknNzA3BpQ6C63aybr-kk,3440
80
- dcicutils-8.13.3.1b24.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
81
- dcicutils-8.13.3.1b24.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
82
- dcicutils-8.13.3.1b24.dist-info/RECORD,,
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,,