cchecksum 0.0.14__tar.gz → 0.0.15__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.

Files changed (43) hide show
  1. {cchecksum-0.0.14/cchecksum.egg-info → cchecksum-0.0.15}/PKG-INFO +1 -1
  2. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum/checksum.py +11 -10
  3. {cchecksum-0.0.14 → cchecksum-0.0.15/cchecksum.egg-info}/PKG-INFO +1 -1
  4. {cchecksum-0.0.14 → cchecksum-0.0.15}/.github/workflows/black.yaml +0 -0
  5. {cchecksum-0.0.14 → cchecksum-0.0.15}/.github/workflows/deploy-docs.yaml +0 -0
  6. {cchecksum-0.0.14 → cchecksum-0.0.15}/.github/workflows/pytest.yaml +0 -0
  7. {cchecksum-0.0.14 → cchecksum-0.0.15}/.github/workflows/release.yaml +0 -0
  8. {cchecksum-0.0.14 → cchecksum-0.0.15}/.gitignore +0 -0
  9. {cchecksum-0.0.14 → cchecksum-0.0.15}/LICENSE +0 -0
  10. {cchecksum-0.0.14 → cchecksum-0.0.15}/Makefile +0 -0
  11. {cchecksum-0.0.14 → cchecksum-0.0.15}/README.md +0 -0
  12. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum/__init__.py +0 -0
  13. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum/_checksum.c +0 -0
  14. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum/_checksum.pyi +0 -0
  15. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum/_checksum.pyx +0 -0
  16. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum/checksum.pyi +0 -0
  17. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum/py.typed +0 -0
  18. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum.egg-info/SOURCES.txt +0 -0
  19. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum.egg-info/dependency_links.txt +0 -0
  20. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum.egg-info/not-zip-safe +0 -0
  21. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum.egg-info/requires.txt +0 -0
  22. {cchecksum-0.0.14 → cchecksum-0.0.15}/cchecksum.egg-info/top_level.txt +0 -0
  23. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/Makefile +0 -0
  24. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/alabaster.css +0 -0
  25. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/basic.css +0 -0
  26. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/custom.css +0 -0
  27. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/doctools.js +0 -0
  28. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/documentation_options.js +0 -0
  29. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/file.png +0 -0
  30. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/language_data.js +0 -0
  31. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/minus.png +0 -0
  32. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/plus.png +0 -0
  33. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/pygments.css +0 -0
  34. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/searchtools.js +0 -0
  35. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/_build/html/_static/sphinx_highlight.js +0 -0
  36. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/conf.py +0 -0
  37. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/index.rst +0 -0
  38. {cchecksum-0.0.14 → cchecksum-0.0.15}/docs/make.bat +0 -0
  39. {cchecksum-0.0.14 → cchecksum-0.0.15}/pyproject.toml +0 -0
  40. {cchecksum-0.0.14 → cchecksum-0.0.15}/requirements.txt +0 -0
  41. {cchecksum-0.0.14 → cchecksum-0.0.15}/setup.cfg +0 -0
  42. {cchecksum-0.0.14 → cchecksum-0.0.15}/setup.py +0 -0
  43. {cchecksum-0.0.14 → cchecksum-0.0.15}/test_checksum.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cchecksum
3
- Version: 0.0.14
3
+ Version: 0.0.15
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 = to_normalized_address(value)[2:]
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 to_normalized_address(value: Union[AnyAddress, str, bytes]) -> HexAddress:
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
- hex_address = (value if value.startswith(("0x", "0X")) else f"0x{value}").lower()
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 hex_address[2:] and hex_fullmatch(hex_address) is None:
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
- hex_address = f"0x{hexlify(value).decode('ascii')}".lower()
92
+ hex_address_no_0x = hexlify(value).decode("ascii")
93
93
 
94
94
  elif isinstance(value, memoryview):
95
- hex_address = f"0x{hexlify(bytes(value)).decode('ascii')}".lower()
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 `hex_address` is not a valid address
103
- if hex_address_fullmatch(hex_address) is None:
102
+ # if `hex_address_no_0x` is not a valid address
103
+ if hex_address_fullmatch(f"0x{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 hex_address # type: ignore [return-value]
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.14
3
+ Version: 0.0.15
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