xloft 0.6.6__py3-none-any.whl → 0.6.7__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.

Potentially problematic release.


This version of xloft might be problematic. Click here for more details.

xloft/__init__.py CHANGED
@@ -9,12 +9,7 @@ Modules exported by this package:
9
9
 
10
10
  from __future__ import annotations
11
11
 
12
- __all__ = (
13
- "to_human_size",
14
- "is_number",
15
- "NamedTuple",
16
- )
12
+ __all__ = ("NamedTuple",)
13
+
17
14
 
18
- from xloft.converters.human_size import to_human_size
19
- from xloft.itis import is_number
20
15
  from xloft.namedtuple import NamedTuple
xloft/itis.py CHANGED
@@ -4,11 +4,6 @@ from __future__ import annotations
4
4
 
5
5
  __all__ = ("is_number",)
6
6
 
7
- import re
8
-
9
- # Caching
10
- _REGEX_IS_NUMBER = re.compile(r"^[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?$")
11
-
12
7
 
13
8
  def is_number(value: str) -> bool:
14
9
  """Check if a string is a number.
@@ -21,4 +16,8 @@ def is_number(value: str) -> bool:
21
16
  Returns:
22
17
  True, if the string is a number.
23
18
  """
24
- return _REGEX_IS_NUMBER.match(value) is not None
19
+ try:
20
+ float(value)
21
+ return True
22
+ except ValueError:
23
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xloft
3
- Version: 0.6.6
3
+ Version: 0.6.7
4
4
  Summary: (XLOFT) X-Library of tools
5
5
  Project-URL: Homepage, https://github.com/kebasyaty/xloft
6
6
  Project-URL: Repository, https://github.com/kebasyaty/xloft
@@ -160,12 +160,12 @@ del nt.y # => raise: AttributeCannotBeDelete
160
160
  del nt._id # => raise: AttributeCannotBeDelete
161
161
  ```
162
162
 
163
- - **Converter**
163
+ - **Converters**
164
164
 
165
165
  ```python
166
166
  """Convert the number of bytes into a human-readable format."""
167
167
 
168
- from xloft import to_human_size
168
+ from xloft.converters import to_human_size
169
169
 
170
170
 
171
171
  to_human_size(200) # => 200 bytes
@@ -178,23 +178,28 @@ to_human_size(1048575) # => 1023.999 KB
178
178
  ```python
179
179
  """Check if a string is a number."""
180
180
 
181
- from xloft import is_number
181
+ from xloft.itis import is_number
182
182
 
183
183
 
184
- is_number("-1230.0123") # => True
185
- is_number("+1230.0123") # => True
186
- is_number("1230.0123") # => True
187
- is_number("1230.0") # => True
188
- is_number("1230") # => True
189
- is_number("1.23e-5") # => True
190
- is_number("1.23E-5") # => True
191
- is_number(".5") # => True
192
-
193
184
  is_number("") # => False
194
185
  is_number(" ") # => False
195
186
  is_number("1230.") # => False
196
187
  is_number("0x5") # => False
197
188
  is_number("0o5") # => False
189
+
190
+ is_number("-5.0") # => True
191
+ is_number("+5.0") # => True
192
+ is_number("5.0") # => True
193
+ is_number(".5") # => True
194
+ is_number("5.") # => True
195
+ is_number("3.4E+38") # => True
196
+ is_number("3.4E-38") # => True
197
+ is_number("1.7E+308") # => True
198
+ is_number("1.7E-308") # => True
199
+ is_number("-1.7976931348623157e+308") # => True
200
+ is_number("1.7976931348623157e+308") # => True
201
+ is_number("72028601076372765770200707816364342373431783018070841859646251155447849538676") # => True
202
+ is_number("-72028601076372765770200707816364342373431783018070841859646251155447849538676") # => True
198
203
  ```
199
204
 
200
205
  ## Changelog
@@ -1,11 +1,11 @@
1
- xloft/__init__.py,sha256=oLi6SfT894qR_qmWupAhtKUpfeeMlYek2mcdQB9nZNI,494
1
+ xloft/__init__.py,sha256=DoAO9PDwoOfrE0RNKysMfHE2i7XarwVMjTPtwtDhJ_w,359
2
2
  xloft/errors.py,sha256=hZcmF0QVVdvE5oM1jsXymRk_pPGgDSnUDM9wx9zJAYQ,895
3
- xloft/itis.py,sha256=Uac1du1Z_rUf3e8uThLWcSYU0F27zThBDW6UMUEHz88,480
3
+ xloft/itis.py,sha256=CRtnOhrw1IY8pPxXy4dCv7wVXUhXmo0OgLLlSSVnmxI,430
4
4
  xloft/namedtuple.py,sha256=egEULlfATXM8gMhAMjQSHocwTudqqzXDGTYGZVSUGZs,5725
5
5
  xloft/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  xloft/converters/__init__.py,sha256=17_p8AQ-_UcKKioJolP_738LHCNOwohJIkCqeyaVO_M,316
7
7
  xloft/converters/human_size.py,sha256=NcZRWF64LkQJ8-R00X7MCkNvXwlFDTcp5M3MylQzRTM,1149
8
- xloft-0.6.6.dist-info/METADATA,sha256=A1jQ0KdswrWd_-q86S_Jkcm6PaTlIfe6zikhPBzzeY4,7432
9
- xloft-0.6.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- xloft-0.6.6.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
11
- xloft-0.6.6.dist-info/RECORD,,
8
+ xloft-0.6.7.dist-info/METADATA,sha256=bBIRqomAqnJAby9ze0NUZHifL4HcyRJOdsh_1yNI7Q8,7766
9
+ xloft-0.6.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ xloft-0.6.7.dist-info/licenses/LICENSE,sha256=2zZINd6m_jNYlowdQImlEizyhSui5cBAJZRhWQURcEc,1095
11
+ xloft-0.6.7.dist-info/RECORD,,
File without changes