cchecksum 0.0.14__tar.gz → 0.0.16__tar.gz
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 cchecksum might be problematic. Click here for more details.
- {cchecksum-0.0.14/cchecksum.egg-info → cchecksum-0.0.16}/PKG-INFO +1 -1
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum/checksum.py +11 -10
- {cchecksum-0.0.14 → cchecksum-0.0.16/cchecksum.egg-info}/PKG-INFO +1 -1
- {cchecksum-0.0.14 → cchecksum-0.0.16}/.github/workflows/black.yaml +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/.github/workflows/deploy-docs.yaml +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/.github/workflows/pytest.yaml +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/.github/workflows/release.yaml +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/.gitignore +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/LICENSE +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/Makefile +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/README.md +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum/__init__.py +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum/_checksum.c +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum/_checksum.pyi +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum/_checksum.pyx +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum/checksum.pyi +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum/py.typed +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum.egg-info/SOURCES.txt +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum.egg-info/dependency_links.txt +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum.egg-info/not-zip-safe +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum.egg-info/requires.txt +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/cchecksum.egg-info/top_level.txt +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/Makefile +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/alabaster.css +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/basic.css +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/custom.css +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/doctools.js +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/documentation_options.js +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/file.png +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/language_data.js +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/minus.png +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/plus.png +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/pygments.css +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/searchtools.js +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/_build/html/_static/sphinx_highlight.js +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/conf.py +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/index.rst +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/docs/make.bat +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/pyproject.toml +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/requirements.txt +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/setup.cfg +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/setup.py +0 -0
- {cchecksum-0.0.14 → cchecksum-0.0.16}/test_checksum.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cchecksum
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: A ~5x faster drop-in replacement for eth_utils.to_checksum_address. Raises the exact same Exceptions. Implemented in C.
|
|
5
5
|
Home-page: https://github.com/BobTheBuidler/cchecksum
|
|
6
6
|
Author: BobTheBuidler
|
|
@@ -49,13 +49,13 @@ def to_checksum_address(value: Union[AnyAddress, str, bytes]) -> ChecksumAddress
|
|
|
49
49
|
- :func:`eth_utils.to_checksum_address` for the standard implementation.
|
|
50
50
|
- :func:`to_normalized_address` for converting to a normalized address before checksumming.
|
|
51
51
|
"""
|
|
52
|
-
norm_address_no_0x =
|
|
52
|
+
norm_address_no_0x = to_normalized_address_no_0x(value)
|
|
53
53
|
return cchecksum(norm_address_no_0x, hash_address(norm_address_no_0x))
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
def
|
|
56
|
+
def to_normalized_address_no_0x(value: Union[AnyAddress, str, bytes]) -> HexAddress:
|
|
57
57
|
"""
|
|
58
|
-
Converts an address to its normalized hexadecimal representation.
|
|
58
|
+
Converts an address to its normalized hexadecimal representation without the '0x' prefix.
|
|
59
59
|
|
|
60
60
|
This function ensures that the address is in a consistent lowercase hexadecimal
|
|
61
61
|
format, which is useful for further processing or validation. It uses
|
|
@@ -82,30 +82,31 @@ def to_normalized_address(value: Union[AnyAddress, str, bytes]) -> HexAddress:
|
|
|
82
82
|
- :func:`is_address` for checking if a string is a valid address.
|
|
83
83
|
"""
|
|
84
84
|
if isinstance(value, str):
|
|
85
|
-
|
|
85
|
+
hex_address_no_0x = value[2:] if value.startswith(("0x", "0X")) else value
|
|
86
86
|
|
|
87
87
|
# if `value` has content and is not a hexstring
|
|
88
|
-
if
|
|
88
|
+
if hex_address_no_0x and hex_fullmatch(value) is None:
|
|
89
89
|
raise ValueError("when sending a str, it must be a hex string. " f"Got: {repr(value)}")
|
|
90
90
|
|
|
91
91
|
elif isinstance(value, (bytes, bytearray)):
|
|
92
|
-
|
|
92
|
+
hex_address_no_0x = hexlify(value).decode("ascii")
|
|
93
93
|
|
|
94
94
|
elif isinstance(value, memoryview):
|
|
95
|
-
|
|
95
|
+
hex_address_no_0x = hexlify(bytes(value)).decode("ascii")
|
|
96
96
|
|
|
97
97
|
else:
|
|
98
98
|
raise TypeError(
|
|
99
99
|
f"Unsupported type: '{repr(type(value))}'. Must be one of: bytes or bytearray."
|
|
100
100
|
)
|
|
101
101
|
|
|
102
|
-
# if `
|
|
103
|
-
if hex_address_fullmatch(
|
|
102
|
+
# if `hex_address_no_0x` is not a valid address
|
|
103
|
+
if hex_address_fullmatch(hex_address_no_0x) is None:
|
|
104
|
+
hex_address = f"0x{hex_address_no_0x}".lower()
|
|
104
105
|
raise ValueError(
|
|
105
106
|
f"Unknown format {repr(value)}, attempted to normalize to {repr(hex_address)}"
|
|
106
107
|
)
|
|
107
108
|
|
|
108
|
-
return
|
|
109
|
+
return hex_address_no_0x.lower() # type: ignore [return-value]
|
|
109
110
|
|
|
110
111
|
|
|
111
112
|
del AnyStr, Optional, Union
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cchecksum
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: A ~5x faster drop-in replacement for eth_utils.to_checksum_address. Raises the exact same Exceptions. Implemented in C.
|
|
5
5
|
Home-page: https://github.com/BobTheBuidler/cchecksum
|
|
6
6
|
Author: BobTheBuidler
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|