Bug fix: jeb_utils.utils.is_number could return True even if the base is 0 which is mathematically incorrect.

This commit is contained in:
2026-04-02 12:48:18 +02:00
parent 32ed782fef
commit 867e9a9c0c
3 changed files with 8 additions and 3 deletions
+5 -2
View File
@@ -77,11 +77,14 @@ pip install jeb-utils --index-url https://repo.jcloud-services.ddns.net/simple/
- `create_file_if_not_exists`: Creates a file if it does not exist. - `create_file_if_not_exists`: Creates a file if it does not exist.
## Changelog ## Changelog
### Version 0.2.2
- Bug fix: jeb_utils.utils.is_number could return `True` even if the base is `0` which is mathematically incorrect.
### Version 0.2.1 ### Version 0.2.1
- Added feature for validating addresses. - Add feature for validating addresses.
### Version 0.2.0 ### Version 0.2.0
- Removed all the functions and classes that are now in jeb-server-utils. - Remove all the functions and classes that are now in jeb-server-utils.
### Version 0.1.4 ### Version 0.1.4
- Bug fix: Due to a refactoring, `jeb_utils.jebp_utils.unpack_fields` did not work. - Bug fix: Due to a refactoring, `jeb_utils.jebp_utils.unpack_fields` did not work.
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project] [project]
name = "jeb-utils" name = "jeb-utils"
version = "0.2.1" version = "0.2.2"
description = "Common utils for JEB client and server." description = "Common utils for JEB client and server."
dependencies = ["cryptography"] dependencies = ["cryptography"]
license = "Apache-2.0" license = "Apache-2.0"
+2
View File
@@ -38,6 +38,8 @@ def is_number(string: str, base: int = 10) -> bool:
:return: ``True`` if the string is a number, otherwise ``False`` :return: ``True`` if the string is a number, otherwise ``False``
:rtype: bool :rtype: bool
''' '''
if base == 0:
return False
if not string: if not string:
return False return False
try: try: