cchecksum 0.0.12__tar.gz → 0.0.13__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.12 → cchecksum-0.0.13}/PKG-INFO +1 -1
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum/checksum.py +21 -20
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum.egg-info/PKG-INFO +1 -1
- {cchecksum-0.0.12 → cchecksum-0.0.13}/.github/workflows/black.yaml +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/.github/workflows/deploy-docs.yaml +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/.github/workflows/pytest.yaml +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/.github/workflows/release.yaml +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/.gitignore +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/LICENSE +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/Makefile +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/README.md +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum/__init__.py +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum/_checksum.c +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum/_checksum.pyi +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum/_checksum.pyx +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum/checksum.pyi +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum/py.typed +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum.egg-info/SOURCES.txt +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum.egg-info/dependency_links.txt +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum.egg-info/not-zip-safe +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum.egg-info/requires.txt +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/cchecksum.egg-info/top_level.txt +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/Makefile +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/alabaster.css +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/basic.css +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/custom.css +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/doctools.js +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/documentation_options.js +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/file.png +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/language_data.js +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/minus.png +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/plus.png +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/pygments.css +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/searchtools.js +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/_build/html/_static/sphinx_highlight.js +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/conf.py +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/index.rst +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/docs/make.bat +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/pyproject.toml +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/requirements.txt +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/setup.cfg +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/setup.py +0 -0
- {cchecksum-0.0.12 → cchecksum-0.0.13}/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.13
|
|
4
4
|
Summary: A ~4.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
|
|
@@ -2,17 +2,14 @@ from binascii import hexlify
|
|
|
2
2
|
from typing import Optional, Union
|
|
3
3
|
|
|
4
4
|
from eth_hash.auto import keccak
|
|
5
|
-
from eth_typing import AnyAddress, ChecksumAddress, HexAddress, HexStr
|
|
6
|
-
from eth_utils import encode_hex,
|
|
5
|
+
from eth_typing import AnyAddress, ChecksumAddress, HexAddress, HexStr
|
|
6
|
+
from eth_utils import encode_hex, is_hexstr, remove_0x_prefix
|
|
7
7
|
from eth_utils.address import _HEX_ADDRESS_REGEXP
|
|
8
8
|
from eth_utils.toolz import compose
|
|
9
9
|
|
|
10
10
|
from cchecksum._checksum import cchecksum
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
BytesLike = Union[Primitives, bytearray, memoryview]
|
|
14
|
-
|
|
15
|
-
|
|
16
13
|
# force _hasher_first_run and _preimage_first_run to execute so we can cache the new hasher
|
|
17
14
|
keccak(b"")
|
|
18
15
|
|
|
@@ -84,7 +81,7 @@ def to_normalized_address(value: Union[AnyAddress, str, bytes]) -> HexAddress:
|
|
|
84
81
|
- :func:`is_address` for checking if a string is a valid address.
|
|
85
82
|
"""
|
|
86
83
|
try:
|
|
87
|
-
hex_address = hexstr_if_str(
|
|
84
|
+
hex_address = hexstr_if_str(value).lower()
|
|
88
85
|
except AttributeError as e:
|
|
89
86
|
raise TypeError(
|
|
90
87
|
f"Value must be any string, instead got type {type(value)}"
|
|
@@ -102,23 +99,28 @@ def to_normalized_address(value: Union[AnyAddress, str, bytes]) -> HexAddress:
|
|
|
102
99
|
encode_memoryview = compose(encode_hex, bytes)
|
|
103
100
|
|
|
104
101
|
|
|
105
|
-
def
|
|
106
|
-
address_bytes: Optional[BytesLike] = None,
|
|
107
|
-
*,
|
|
108
|
-
hexstr: Optional[HexStr] = None,
|
|
109
|
-
) -> HexStr:
|
|
102
|
+
def hexstr_if_str(hexstr_or_primitive: Union[bytes, int, str]) -> HexStr:
|
|
110
103
|
"""
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
Convert to a type, assuming that strings can be only hexstr (not unicode text).
|
|
105
|
+
|
|
106
|
+
:param hexstr_or_primitive bytes, str, int: value to convert
|
|
114
107
|
"""
|
|
115
|
-
if
|
|
116
|
-
|
|
108
|
+
if isinstance(hexstr_or_primitive, str):
|
|
109
|
+
if remove_0x_prefix(hexstr_or_primitive) and not is_hexstr(hexstr_or_primitive):
|
|
110
|
+
raise ValueError(
|
|
111
|
+
"when sending a str, it must be a hex string. " f"Got: {repr(hexstr_or_primitive)}"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
hexstr_or_primitive
|
|
116
|
+
if hexstr_or_primitive.startswith(("0x", "0X"))
|
|
117
|
+
else f"0x{hexstr_or_primitive}"
|
|
118
|
+
)
|
|
117
119
|
|
|
118
|
-
|
|
120
|
+
elif isinstance(address_bytes, (bytes, bytearray)):
|
|
119
121
|
return encode_hex(address_bytes)
|
|
120
122
|
|
|
121
|
-
|
|
123
|
+
elif isinstance(address_bytes, memoryview):
|
|
122
124
|
return encode_memoryview(address_bytes)
|
|
123
125
|
|
|
124
126
|
raise TypeError(
|
|
@@ -128,6 +130,5 @@ def to_hex(
|
|
|
128
130
|
|
|
129
131
|
del hexlify
|
|
130
132
|
del Optional, Union
|
|
131
|
-
del AnyAddress, ChecksumAddress, HexAddress, HexStr
|
|
133
|
+
del AnyAddress, ChecksumAddress, HexAddress, HexStr
|
|
132
134
|
del _HEX_ADDRESS_REGEXP, compose, keccak
|
|
133
|
-
del BytesLike
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cchecksum
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.13
|
|
4
4
|
Summary: A ~4.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
|