arpakitlib 1.8.91__py3-none-any.whl → 1.8.92__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.
arpakitlib/ar_str_util.py CHANGED
@@ -139,13 +139,21 @@ def lower_and_strip_or_none(value: Any) -> str | None:
139
139
  return None
140
140
 
141
141
 
142
+ def is_float(value: str) -> bool:
143
+ try:
144
+ float(value)
145
+ except Exception:
146
+ return False
147
+ return True
148
+
149
+
142
150
  def int_or_float_or_none(value: Any) -> float | int | None:
143
151
  if isinstance(value, float) or isinstance(value, int):
144
152
  return value
145
153
  value = strip_or_none(value)
146
154
  if value is not None and value.isdigit():
147
155
  return int(value)
148
- if value is not None and value.isdecimal():
156
+ if value is not None and is_float(value):
149
157
  return float(value)
150
158
  return None
151
159
 
@@ -163,46 +171,13 @@ def float_or_none(value: Any) -> float | None:
163
171
  if isinstance(value, float):
164
172
  return value
165
173
  value = strip_or_none(value)
166
- if value is not None and value.isdecimal():
174
+ if value is not None and is_float(value):
167
175
  return float(value)
168
176
  return None
169
177
 
170
178
 
171
179
  def __example():
172
- print(int_or_none("124.124"))
173
-
174
- print("str_in:")
175
- print(str_in(string="hello", main_string="hello world"))
176
- print(str_in(string="bye", main_string="hello world"))
177
- print(str_in(string="hello", main_string="hello world", max_diff=6))
178
- print(str_in(string="hello", main_string="hello world", max_diff=1))
179
-
180
- print("\nbidirectional_str_in:")
181
- print(bidirectional_str_in(string1="hello", string2="hello world"))
182
- print(bidirectional_str_in(string1="world", string2="hello world"))
183
-
184
- print("\nstr_startswith:")
185
- print(str_startswith(string="hello", main_string="hello world"))
186
- print(str_startswith(string="world", main_string="hello world"))
187
-
188
- print("\nbidirectional_str_startswith:")
189
- print(bidirectional_str_startswith(string1="hello", string2="hello world"))
190
- print(bidirectional_str_startswith(string1="world", string2="hello world"))
191
-
192
- print("\nmake blank_if_none:")
193
- print(make_blank_if_none())
194
- print(make_blank_if_none(string="test"))
195
-
196
- print("\nremove_html:")
197
- print(remove_html(string="<div>Hello <b>World</b></div>"))
198
-
199
- print("\nremove_tags:")
200
- print(remove_tags(string="<div>Hello <b>World</b></div>"))
201
-
202
- print("\nremove_tags_and_html:")
203
- print(remove_tags_and_html("<div>Hello <b>World</b></div>"))
204
-
205
- print(remove_markdown("# Тут обычный текст с **жирным** и *курсивным* выделением."))
180
+ pass
206
181
 
207
182
 
208
183
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: arpakitlib
3
- Version: 1.8.91
3
+ Version: 1.8.92
4
4
  Summary: arpakitlib
5
5
  License: Apache-2.0
6
6
  Keywords: arpakitlib,arpakit,arpakit-company,arpakitcompany,arpakit_company
@@ -381,11 +381,11 @@ arpakitlib/ar_sleep_util.py,sha256=OaLtRaJQWMkGjfj_mW1RB2P4RaSWsAIH8LUoXqsH0zM,1
381
381
  arpakitlib/ar_sqladmin_util.py,sha256=Jd33EX_fAso4bvrcDhNEYOUlUHkudbadNGOJDg7rqhQ,301
382
382
  arpakitlib/ar_sqlalchemy_util.py,sha256=Fo7xdHu1rjyHNj2XzN7r_yXbaajGK8dxBPsOL6-DzVU,10559
383
383
  arpakitlib/ar_ssh_runner_util.py,sha256=yvAwza480MkHKvLkDEsR7JNh2bYNs6P9rCVo4NA85NE,6865
384
- arpakitlib/ar_str_util.py,sha256=CuIptQwHP0msTLNJbp-OFAdInVeTY4P58p7jFdeGm-4,5591
384
+ arpakitlib/ar_str_util.py,sha256=CAv0wH8nP5Ja59S-hEdmNhNrM_Fwy935d0zntLpJkx8,4309
385
385
  arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
386
386
  arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
387
- arpakitlib-1.8.91.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
388
- arpakitlib-1.8.91.dist-info/METADATA,sha256=YXSDqmC6BeCapMcKuRs8EPgAuuW6LSLPSjBo9YChNDU,3517
389
- arpakitlib-1.8.91.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
390
- arpakitlib-1.8.91.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
391
- arpakitlib-1.8.91.dist-info/RECORD,,
387
+ arpakitlib-1.8.92.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
388
+ arpakitlib-1.8.92.dist-info/METADATA,sha256=-eIvGJmCUuJK4_CYLjmJubc_tRydjlVSYZmHsTHrqG8,3517
389
+ arpakitlib-1.8.92.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
390
+ arpakitlib-1.8.92.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
391
+ arpakitlib-1.8.92.dist-info/RECORD,,