faster-eth-utils 5.3.8__cp313-cp313-win_amd64.whl → 5.3.23__cp313-cp313-win_amd64.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.
- faster_eth_utils/abi.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/abi.py +95 -70
- faster_eth_utils/address.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/address.py +7 -14
- faster_eth_utils/applicators.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/applicators.py +73 -56
- faster_eth_utils/conversions.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/conversions.py +18 -20
- faster_eth_utils/crypto.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/crypto.py +3 -8
- faster_eth_utils/currency.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/currency.py +11 -8
- faster_eth_utils/curried/__init__.py +62 -65
- faster_eth_utils/debug.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/decorators.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/decorators.py +65 -29
- faster_eth_utils/encoding.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/encoding.py +1 -1
- faster_eth_utils/exceptions.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/exceptions.py +8 -1
- faster_eth_utils/functional.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/functional.py +10 -12
- faster_eth_utils/hexadecimal.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/hexadecimal.py +8 -12
- faster_eth_utils/humanize.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/humanize.py +16 -16
- faster_eth_utils/logging.py +51 -44
- faster_eth_utils/module_loading.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/network.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/network.py +2 -3
- faster_eth_utils/numeric.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/pydantic.py +5 -7
- faster_eth_utils/toolz.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/types.cp313-win_amd64.pyd +0 -0
- faster_eth_utils/types.py +7 -10
- faster_eth_utils/units.cp313-win_amd64.pyd +0 -0
- {faster_eth_utils-5.3.8.dist-info → faster_eth_utils-5.3.23.dist-info}/METADATA +39 -19
- faster_eth_utils-5.3.23.dist-info/RECORD +53 -0
- faster_eth_utils-5.3.23.dist-info/top_level.txt +3 -0
- faster_eth_utils__mypyc.cp313-win_amd64.pyd +0 -0
- 99c07adba6ff961eaf3e__mypyc.cp313-win_amd64.pyd +0 -0
- faster_eth_utils-5.3.8.dist-info/RECORD +0 -53
- faster_eth_utils-5.3.8.dist-info/top_level.txt +0 -3
- {faster_eth_utils-5.3.8.dist-info → faster_eth_utils-5.3.23.dist-info}/WHEEL +0 -0
- {faster_eth_utils-5.3.8.dist-info → faster_eth_utils-5.3.23.dist-info}/licenses/LICENSE +0 -0
faster_eth_utils/hexadecimal.py
CHANGED
|
@@ -4,22 +4,18 @@ import binascii
|
|
|
4
4
|
import re
|
|
5
5
|
from typing import (
|
|
6
6
|
Any,
|
|
7
|
-
AnyStr,
|
|
8
7
|
Final,
|
|
9
|
-
|
|
8
|
+
TypeGuard,
|
|
10
9
|
)
|
|
11
10
|
|
|
12
11
|
from eth_typing import (
|
|
13
12
|
HexStr,
|
|
14
13
|
)
|
|
15
|
-
from typing_extensions import (
|
|
16
|
-
TypeGuard,
|
|
17
|
-
)
|
|
18
14
|
|
|
19
15
|
_HEX_REGEXP_MATCH: Final = re.compile("(0[xX])?[0-9a-fA-F]*").fullmatch
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
_hexlify: Final = binascii.hexlify
|
|
18
|
+
_unhexlify: Final = binascii.unhexlify
|
|
23
19
|
|
|
24
20
|
|
|
25
21
|
|
|
@@ -29,11 +25,11 @@ def decode_hex(value: str) -> bytes:
|
|
|
29
25
|
non_prefixed = remove_0x_prefix(HexStr(value))
|
|
30
26
|
# unhexlify will only accept bytes type someday
|
|
31
27
|
ascii_hex = non_prefixed.encode("ascii")
|
|
32
|
-
return
|
|
28
|
+
return _unhexlify(ascii_hex)
|
|
33
29
|
|
|
34
30
|
|
|
35
|
-
def encode_hex(value:
|
|
36
|
-
ascii_bytes:
|
|
31
|
+
def encode_hex(value: str | bytes | bytearray) -> HexStr:
|
|
32
|
+
ascii_bytes: bytes | bytearray
|
|
37
33
|
if isinstance(value, (bytes, bytearray)):
|
|
38
34
|
ascii_bytes = value
|
|
39
35
|
elif isinstance(value, str):
|
|
@@ -41,7 +37,7 @@ def encode_hex(value: AnyStr) -> HexStr:
|
|
|
41
37
|
else:
|
|
42
38
|
raise TypeError("Value must be an instance of str or unicode")
|
|
43
39
|
|
|
44
|
-
binary_hex =
|
|
40
|
+
binary_hex = _hexlify(ascii_bytes)
|
|
45
41
|
return add_0x_prefix(HexStr(binary_hex.decode("ascii")))
|
|
46
42
|
|
|
47
43
|
|
|
@@ -51,7 +47,7 @@ def is_0x_prefixed(value: str) -> bool:
|
|
|
51
47
|
# raise TypeError(
|
|
52
48
|
# f"is_0x_prefixed requires text typed arguments. Got: {repr(value)}"
|
|
53
49
|
# )
|
|
54
|
-
return value.startswith(
|
|
50
|
+
return value.startswith("0x") or value.startswith("0X")
|
|
55
51
|
|
|
56
52
|
|
|
57
53
|
def remove_0x_prefix(value: HexStr) -> HexStr:
|
|
Binary file
|
faster_eth_utils/humanize.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
from collections.abc import (
|
|
2
|
+
Iterable,
|
|
3
|
+
Iterator,
|
|
4
|
+
)
|
|
1
5
|
from typing import (
|
|
2
6
|
Any,
|
|
3
7
|
Final,
|
|
4
|
-
Iterable,
|
|
5
|
-
Iterator,
|
|
6
|
-
Tuple,
|
|
7
|
-
Union,
|
|
8
8
|
)
|
|
9
9
|
from urllib import (
|
|
10
10
|
parse,
|
|
@@ -23,13 +23,14 @@ from faster_eth_utils.currency import (
|
|
|
23
23
|
from . import toolz
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def humanize_seconds(seconds:
|
|
27
|
-
|
|
26
|
+
def humanize_seconds(seconds: float | int) -> str:
|
|
27
|
+
seconds_int = int(seconds)
|
|
28
|
+
if seconds_int == 0:
|
|
28
29
|
return "0s"
|
|
29
30
|
|
|
30
|
-
unit_values = _consume_leading_zero_units(_humanize_seconds(
|
|
31
|
+
unit_values = _consume_leading_zero_units(_humanize_seconds(seconds_int))
|
|
31
32
|
|
|
32
|
-
return "".join(
|
|
33
|
+
return "".join(f"{amount}{unit}" for amount, unit in toolz.take(3, unit_values))
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
SECOND: Final = 1
|
|
@@ -53,8 +54,8 @@ UNITS: Final = (
|
|
|
53
54
|
|
|
54
55
|
|
|
55
56
|
def _consume_leading_zero_units(
|
|
56
|
-
units_iter: Iterator[
|
|
57
|
-
) -> Iterator[
|
|
57
|
+
units_iter: Iterator[tuple[int, str]]
|
|
58
|
+
) -> Iterator[tuple[int, str]]:
|
|
58
59
|
for amount, unit in units_iter:
|
|
59
60
|
if amount == 0:
|
|
60
61
|
continue
|
|
@@ -65,7 +66,7 @@ def _consume_leading_zero_units(
|
|
|
65
66
|
yield from units_iter
|
|
66
67
|
|
|
67
68
|
|
|
68
|
-
def _humanize_seconds(seconds: int) -> Iterator[
|
|
69
|
+
def _humanize_seconds(seconds: int) -> Iterator[tuple[int, str]]:
|
|
69
70
|
remainder = seconds
|
|
70
71
|
|
|
71
72
|
for duration, unit in UNITS:
|
|
@@ -140,7 +141,7 @@ def _is_CIDv0_ipfs_hash(ipfs_hash: str) -> bool:
|
|
|
140
141
|
return False
|
|
141
142
|
|
|
142
143
|
|
|
143
|
-
def _find_breakpoints(values:
|
|
144
|
+
def _find_breakpoints(values: tuple[int, ...]) -> Iterator[int]:
|
|
144
145
|
yield 0
|
|
145
146
|
for index, (left, right) in enumerate(toolz.sliding_window(2, values), 1):
|
|
146
147
|
if left + 1 == right:
|
|
@@ -150,7 +151,7 @@ def _find_breakpoints(values: Tuple[int, ...]) -> Iterator[int]:
|
|
|
150
151
|
yield len(values)
|
|
151
152
|
|
|
152
153
|
|
|
153
|
-
def _extract_integer_ranges(values:
|
|
154
|
+
def _extract_integer_ranges(values: tuple[int, ...]) -> Iterator[tuple[int, int]]:
|
|
154
155
|
"""
|
|
155
156
|
Return a tuple of consecutive ranges of integers.
|
|
156
157
|
|
|
@@ -165,7 +166,7 @@ def _extract_integer_ranges(values: Tuple[int, ...]) -> Iterator[Tuple[int, int]
|
|
|
165
166
|
yield chunk[0], chunk[-1]
|
|
166
167
|
|
|
167
168
|
|
|
168
|
-
def _humanize_range(bounds:
|
|
169
|
+
def _humanize_range(bounds: tuple[int, int]) -> str:
|
|
169
170
|
left, right = bounds
|
|
170
171
|
if left == right:
|
|
171
172
|
return str(left)
|
|
@@ -197,5 +198,4 @@ def humanize_wei(number: int) -> str:
|
|
|
197
198
|
else:
|
|
198
199
|
unit = "wei"
|
|
199
200
|
amount = from_wei(number, unit)
|
|
200
|
-
|
|
201
|
-
return x
|
|
201
|
+
return f"{str(amount)} {unit}"
|
faster_eth_utils/logging.py
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import logging
|
|
2
|
+
from collections.abc import (
|
|
3
|
+
Iterator,
|
|
4
|
+
)
|
|
5
|
+
from contextlib import (
|
|
6
|
+
contextmanager,
|
|
7
|
+
)
|
|
2
8
|
from functools import (
|
|
3
9
|
cached_property,
|
|
4
10
|
)
|
|
5
|
-
import logging
|
|
6
11
|
from typing import (
|
|
7
12
|
Any,
|
|
8
|
-
|
|
9
|
-
Iterator,
|
|
10
|
-
Tuple,
|
|
11
|
-
Type,
|
|
13
|
+
Final,
|
|
12
14
|
TypeVar,
|
|
13
|
-
Union,
|
|
14
15
|
cast,
|
|
16
|
+
overload,
|
|
15
17
|
)
|
|
16
18
|
|
|
17
19
|
from .toolz import (
|
|
@@ -22,6 +24,11 @@ DEBUG2_LEVEL_NUM = 8
|
|
|
22
24
|
|
|
23
25
|
TLogger = TypeVar("TLogger", bound=logging.Logger)
|
|
24
26
|
|
|
27
|
+
Logger: Final = logging.Logger
|
|
28
|
+
getLogger: Final = logging.getLogger
|
|
29
|
+
getLoggerClass: Final = logging.getLoggerClass
|
|
30
|
+
setLoggerClass: Final = logging.setLoggerClass
|
|
31
|
+
|
|
25
32
|
|
|
26
33
|
class ExtendedDebugLogger(logging.Logger):
|
|
27
34
|
"""
|
|
@@ -41,7 +48,7 @@ class ExtendedDebugLogger(logging.Logger):
|
|
|
41
48
|
# lambda to further speed up
|
|
42
49
|
self.__dict__["debug2"] = lambda message, *args, **kwargs: None
|
|
43
50
|
|
|
44
|
-
def __reduce__(self) ->
|
|
51
|
+
def __reduce__(self) -> tuple[Any, ...]:
|
|
45
52
|
# This is needed because our parent's implementation could
|
|
46
53
|
# cause us to become a regular Logger on unpickling.
|
|
47
54
|
return get_extended_debug_logger, (self.name,)
|
|
@@ -53,37 +60,38 @@ def setup_DEBUG2_logging() -> None:
|
|
|
53
60
|
"""
|
|
54
61
|
if not hasattr(logging, "DEBUG2"):
|
|
55
62
|
logging.addLevelName(DEBUG2_LEVEL_NUM, "DEBUG2")
|
|
56
|
-
logging.DEBUG2 = DEBUG2_LEVEL_NUM # type: ignore
|
|
63
|
+
logging.DEBUG2 = DEBUG2_LEVEL_NUM # type: ignore [attr-defined]
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
logging.setLoggerClass(logger_class)
|
|
65
|
+
@contextmanager
|
|
66
|
+
def _use_logger_class(logger_class: type[logging.Logger]) -> Iterator[None]:
|
|
67
|
+
original_logger_class = getLoggerClass()
|
|
68
|
+
setLoggerClass(logger_class)
|
|
63
69
|
try:
|
|
64
70
|
yield
|
|
65
71
|
finally:
|
|
66
|
-
|
|
72
|
+
setLoggerClass(original_logger_class)
|
|
67
73
|
|
|
68
74
|
|
|
69
|
-
|
|
75
|
+
@overload
|
|
76
|
+
def get_logger(name: str, logger_class: type[TLogger]) -> TLogger: ...
|
|
77
|
+
@overload
|
|
78
|
+
def get_logger(name: str, logger_class: None = None) -> logging.Logger: ...
|
|
79
|
+
def get_logger(name: str, logger_class: type[TLogger] | None = None) -> TLogger | logging.Logger:
|
|
70
80
|
if logger_class is None:
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
del manager.loggerDict[name]
|
|
86
|
-
return cast(TLogger, logging.getLogger(name))
|
|
81
|
+
return getLogger(name)
|
|
82
|
+
|
|
83
|
+
with _use_logger_class(logger_class):
|
|
84
|
+
# The logging module caches logger instances. The following code
|
|
85
|
+
# ensures that if there is a cached instance that we don't
|
|
86
|
+
# accidentally return the incorrect logger type because the logging
|
|
87
|
+
# module does not *update* the cached instance in the event that
|
|
88
|
+
# the global logging class changes.
|
|
89
|
+
manager = Logger.manager
|
|
90
|
+
logger_dict = manager.loggerDict
|
|
91
|
+
cached_logger = logger_dict.get(name)
|
|
92
|
+
if cached_logger is not None and type(cached_logger) is not logger_class:
|
|
93
|
+
del logger_dict[name]
|
|
94
|
+
return cast(TLogger, getLogger(name))
|
|
87
95
|
|
|
88
96
|
|
|
89
97
|
def get_extended_debug_logger(name: str) -> ExtendedDebugLogger:
|
|
@@ -101,13 +109,13 @@ class HasLoggerMeta(type):
|
|
|
101
109
|
to use when creating the associated logger for a given class.
|
|
102
110
|
"""
|
|
103
111
|
|
|
104
|
-
logger_class =
|
|
112
|
+
logger_class = Logger
|
|
105
113
|
|
|
106
114
|
def __new__(
|
|
107
|
-
mcls:
|
|
115
|
+
mcls: type[THasLoggerMeta],
|
|
108
116
|
name: str,
|
|
109
|
-
bases:
|
|
110
|
-
namespace:
|
|
117
|
+
bases: tuple[type[Any]],
|
|
118
|
+
namespace: dict[str, Any],
|
|
111
119
|
) -> THasLoggerMeta:
|
|
112
120
|
if "logger" in namespace:
|
|
113
121
|
# If a logger was explicitly declared we shouldn't do anything to
|
|
@@ -115,22 +123,21 @@ class HasLoggerMeta(type):
|
|
|
115
123
|
return super().__new__(mcls, name, bases, namespace)
|
|
116
124
|
if "__qualname__" not in namespace:
|
|
117
125
|
raise AttributeError("Missing __qualname__")
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
logger = logging.getLogger(namespace["__qualname__"])
|
|
126
|
+
|
|
127
|
+
logger = get_logger(namespace["__qualname__"], mcls.logger_class)
|
|
121
128
|
|
|
122
129
|
return super().__new__(mcls, name, bases, assoc(namespace, "logger", logger))
|
|
123
130
|
|
|
124
131
|
@classmethod
|
|
125
132
|
def replace_logger_class(
|
|
126
|
-
mcls:
|
|
127
|
-
) ->
|
|
133
|
+
mcls: type[THasLoggerMeta], value: type[logging.Logger]
|
|
134
|
+
) -> type[THasLoggerMeta]:
|
|
128
135
|
return type(mcls.__name__, (mcls,), {"logger_class": value})
|
|
129
136
|
|
|
130
137
|
@classmethod
|
|
131
138
|
def meta_compat(
|
|
132
|
-
mcls:
|
|
133
|
-
) ->
|
|
139
|
+
mcls: type[THasLoggerMeta], other: type[type]
|
|
140
|
+
) -> type[THasLoggerMeta]:
|
|
134
141
|
return type(mcls.__name__, (mcls, other), {})
|
|
135
142
|
|
|
136
143
|
|
|
@@ -141,5 +148,5 @@ class HasLogger(metaclass=HasLoggerMeta):
|
|
|
141
148
|
HasExtendedDebugLoggerMeta = HasLoggerMeta.replace_logger_class(ExtendedDebugLogger)
|
|
142
149
|
|
|
143
150
|
|
|
144
|
-
class HasExtendedDebugLogger(metaclass=HasExtendedDebugLoggerMeta): # type: ignore
|
|
151
|
+
class HasExtendedDebugLogger(metaclass=HasExtendedDebugLoggerMeta): # type: ignore[metaclass]
|
|
145
152
|
logger: ExtendedDebugLogger
|
|
Binary file
|
|
Binary file
|
faster_eth_utils/network.py
CHANGED
|
@@ -9,14 +9,13 @@ from pathlib import (
|
|
|
9
9
|
)
|
|
10
10
|
from typing import (
|
|
11
11
|
Final,
|
|
12
|
-
List,
|
|
13
12
|
)
|
|
14
13
|
|
|
15
14
|
from eth_typing import (
|
|
16
15
|
ChainId,
|
|
17
16
|
)
|
|
18
17
|
|
|
19
|
-
from faster_eth_utils import (
|
|
18
|
+
from faster_eth_utils.exceptions import (
|
|
20
19
|
ValidationError,
|
|
21
20
|
)
|
|
22
21
|
|
|
@@ -32,7 +31,7 @@ class Network:
|
|
|
32
31
|
symbol: ChainId
|
|
33
32
|
|
|
34
33
|
|
|
35
|
-
def initialize_network_objects() ->
|
|
34
|
+
def initialize_network_objects() -> list[Network]:
|
|
36
35
|
networks_obj = []
|
|
37
36
|
|
|
38
37
|
networks_json_path = os.path.abspath(
|
|
Binary file
|
faster_eth_utils/pydantic.py
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
from typing import (
|
|
2
2
|
Any,
|
|
3
|
-
Dict,
|
|
4
|
-
Type,
|
|
5
3
|
)
|
|
6
4
|
|
|
7
5
|
from pydantic import (
|
|
@@ -21,7 +19,7 @@ from pydantic.json_schema import (
|
|
|
21
19
|
)
|
|
22
20
|
|
|
23
21
|
|
|
24
|
-
class OmitJsonSchema(GenerateJsonSchema):
|
|
22
|
+
class OmitJsonSchema(GenerateJsonSchema): # type: ignore[misc]
|
|
25
23
|
"""
|
|
26
24
|
Custom JSON schema generator that omits the schema generation for fields that are
|
|
27
25
|
invalid. Excluded fields (``Field(exclude=True)``) are generally useful as
|
|
@@ -35,7 +33,7 @@ class OmitJsonSchema(GenerateJsonSchema):
|
|
|
35
33
|
return super().field_is_present(field)
|
|
36
34
|
|
|
37
35
|
|
|
38
|
-
class CamelModel(BaseModel):
|
|
36
|
+
class CamelModel(BaseModel): # type: ignore[misc]
|
|
39
37
|
"""
|
|
40
38
|
Camel-case pydantic model. This model is used to ensure serialization in a
|
|
41
39
|
consistent manner, aliasing as camelCase serialization. This is useful for models
|
|
@@ -81,14 +79,14 @@ class CamelModel(BaseModel):
|
|
|
81
79
|
)
|
|
82
80
|
|
|
83
81
|
@classmethod
|
|
84
|
-
def model_json_schema(
|
|
82
|
+
def model_json_schema( # type: ignore [override]
|
|
85
83
|
cls,
|
|
86
84
|
by_alias: bool = True,
|
|
87
85
|
ref_template: str = DEFAULT_REF_TEMPLATE,
|
|
88
86
|
# default to ``OmitJsonSchema`` to prevent errors from excluded fields
|
|
89
|
-
schema_generator:
|
|
87
|
+
schema_generator: type[GenerateJsonSchema] = OmitJsonSchema,
|
|
90
88
|
mode: JsonSchemaMode = "validation",
|
|
91
|
-
) ->
|
|
89
|
+
) -> dict[str, Any]:
|
|
92
90
|
"""
|
|
93
91
|
Omits excluded fields from the JSON schema, preventing errors that would
|
|
94
92
|
otherwise be raised by the default schema generator.
|
|
Binary file
|
|
Binary file
|
faster_eth_utils/types.py
CHANGED
|
@@ -3,13 +3,10 @@ import numbers
|
|
|
3
3
|
from typing import (
|
|
4
4
|
Any,
|
|
5
5
|
Final,
|
|
6
|
-
List,
|
|
7
6
|
Literal,
|
|
8
|
-
Tuple,
|
|
9
|
-
Union,
|
|
10
7
|
)
|
|
11
8
|
|
|
12
|
-
from
|
|
9
|
+
from typing import (
|
|
13
10
|
TypeGuard,
|
|
14
11
|
)
|
|
15
12
|
|
|
@@ -28,7 +25,7 @@ def is_integer(value: Any) -> TypeGuard[int]:
|
|
|
28
25
|
return isinstance(value, int) and not isinstance(value, bool)
|
|
29
26
|
|
|
30
27
|
|
|
31
|
-
def is_bytes(value: Any) -> TypeGuard[
|
|
28
|
+
def is_bytes(value: Any) -> TypeGuard[bytes | bytearray]:
|
|
32
29
|
return isinstance(value, bytes_types)
|
|
33
30
|
|
|
34
31
|
|
|
@@ -36,7 +33,7 @@ def is_text(value: Any) -> TypeGuard[str]:
|
|
|
36
33
|
return isinstance(value, str)
|
|
37
34
|
|
|
38
35
|
|
|
39
|
-
def is_string(value: Any) -> TypeGuard[
|
|
36
|
+
def is_string(value: Any) -> TypeGuard[bytes | str | bytearray]:
|
|
40
37
|
return isinstance(value, string_types)
|
|
41
38
|
|
|
42
39
|
|
|
@@ -45,18 +42,18 @@ def is_boolean(value: Any) -> TypeGuard[bool]:
|
|
|
45
42
|
|
|
46
43
|
|
|
47
44
|
def is_dict(obj: Any) -> TypeGuard[collections.abc.Mapping[Any, Any]]:
|
|
48
|
-
return isinstance(obj, Mapping)
|
|
45
|
+
return isinstance(obj, dict) or isinstance(obj, Mapping)
|
|
49
46
|
|
|
50
47
|
|
|
51
48
|
def is_list_like(obj: Any) -> TypeGuard[collections.abc.Sequence[Any]]:
|
|
52
|
-
return not is_string(obj) and isinstance(obj, Sequence)
|
|
49
|
+
return isinstance(obj, (list, tuple)) or not is_string(obj) and isinstance(obj, Sequence)
|
|
53
50
|
|
|
54
51
|
|
|
55
|
-
def is_list(obj: Any) -> TypeGuard[
|
|
52
|
+
def is_list(obj: Any) -> TypeGuard[list[Any]]:
|
|
56
53
|
return isinstance(obj, list)
|
|
57
54
|
|
|
58
55
|
|
|
59
|
-
def is_tuple(obj: Any) -> TypeGuard[
|
|
56
|
+
def is_tuple(obj: Any) -> TypeGuard[tuple[Any, ...]]:
|
|
60
57
|
return isinstance(obj, tuple)
|
|
61
58
|
|
|
62
59
|
|
|
Binary file
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: faster-eth-utils
|
|
3
|
-
Version: 5.3.
|
|
4
|
-
Summary: A fork of eth-utils: Common utility functions for python code that interacts with Ethereum
|
|
5
|
-
Home-page: https://github.com/BobTheBuidler/eth-utils
|
|
3
|
+
Version: 5.3.23
|
|
4
|
+
Summary: A faster fork of eth-utils: Common utility functions for python code that interacts with Ethereum. Implemented in C
|
|
5
|
+
Home-page: https://github.com/BobTheBuidler/faster-eth-utils
|
|
6
6
|
Author: The Ethereum Foundation
|
|
7
7
|
Author-email: snakecharmers@ethereum.org
|
|
8
8
|
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://eth-utils.readthedocs.io/en/stable/
|
|
10
|
+
Project-URL: Release Notes, https://github.com/BobTheBuidler/faster-eth-utils/releases
|
|
11
|
+
Project-URL: Issues, https://github.com/BobTheBuidler/faster-eth-utils/issues
|
|
12
|
+
Project-URL: Source - Precompiled (.py), https://github.com/BobTheBuidler/faster-eth-utils/tree/master/faster_eth_utils
|
|
13
|
+
Project-URL: Source - Compiled (.c), https://github.com/BobTheBuidler/faster-eth-utils/tree/master/build
|
|
14
|
+
Project-URL: Benchmarks, https://github.com/BobTheBuidler/faster-eth-utils/tree/master/benchmarks
|
|
15
|
+
Project-URL: Benchmarks - Results, https://github.com/BobTheBuidler/faster-eth-utils/tree/master/benchmarks/results
|
|
16
|
+
Project-URL: Original, https://github.com/ethereum/eth-utils
|
|
9
17
|
Keywords: ethereum
|
|
10
18
|
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
19
|
Classifier: Natural Language :: English
|
|
13
20
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
21
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
24
|
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
26
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
-
Requires-Python: >=3.
|
|
27
|
+
Requires-Python: >=3.10, <4
|
|
22
28
|
Description-Content-Type: text/markdown
|
|
23
29
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: cchecksum
|
|
30
|
+
Requires-Dist: cchecksum==0.3.10
|
|
25
31
|
Requires-Dist: eth-hash>=0.3.1
|
|
26
|
-
Requires-Dist: eth-typing
|
|
32
|
+
Requires-Dist: eth-typing==5.2.1
|
|
33
|
+
Requires-Dist: eth-utils==5.3.1
|
|
27
34
|
Requires-Dist: toolz>0.8.2; implementation_name == "pypy"
|
|
28
35
|
Requires-Dist: cytoolz>=0.10.1; implementation_name == "cpython"
|
|
29
36
|
Requires-Dist: pydantic<3,>=2.0.0
|
|
@@ -32,7 +39,7 @@ Requires-Dist: build>=0.9.0; extra == "dev"
|
|
|
32
39
|
Requires-Dist: bump_my_version>=0.19.0; extra == "dev"
|
|
33
40
|
Requires-Dist: eth-hash[pycryptodome]; extra == "dev"
|
|
34
41
|
Requires-Dist: ipython; extra == "dev"
|
|
35
|
-
Requires-Dist: mypy
|
|
42
|
+
Requires-Dist: mypy[mypyc]<1.20,>=1.14.1; extra == "dev"
|
|
36
43
|
Requires-Dist: pre-commit>=3.4.0; extra == "dev"
|
|
37
44
|
Requires-Dist: tox>=4.0.0; extra == "dev"
|
|
38
45
|
Requires-Dist: twine; extra == "dev"
|
|
@@ -40,23 +47,31 @@ Requires-Dist: wheel; extra == "dev"
|
|
|
40
47
|
Requires-Dist: sphinx>=6.0.0; extra == "dev"
|
|
41
48
|
Requires-Dist: sphinx-autobuild>=2021.3.14; extra == "dev"
|
|
42
49
|
Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "dev"
|
|
43
|
-
Requires-Dist: towncrier<
|
|
50
|
+
Requires-Dist: towncrier<26,>=24; extra == "dev"
|
|
44
51
|
Requires-Dist: hypothesis>=4.43.0; extra == "dev"
|
|
45
|
-
Requires-Dist: mypy
|
|
46
|
-
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
47
|
-
Requires-Dist: pytest-codspeed>=2.0.0; extra == "dev"
|
|
52
|
+
Requires-Dist: mypy[mypyc]<1.20,>=1.14.1; extra == "dev"
|
|
48
53
|
Requires-Dist: pytest-xdist>=2.4.0; extra == "dev"
|
|
54
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
49
55
|
Provides-Extra: docs
|
|
50
56
|
Requires-Dist: sphinx>=6.0.0; extra == "docs"
|
|
51
57
|
Requires-Dist: sphinx-autobuild>=2021.3.14; extra == "docs"
|
|
52
58
|
Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "docs"
|
|
53
|
-
Requires-Dist: towncrier<
|
|
59
|
+
Requires-Dist: towncrier<26,>=24; extra == "docs"
|
|
54
60
|
Provides-Extra: test
|
|
55
61
|
Requires-Dist: hypothesis>=4.43.0; extra == "test"
|
|
56
|
-
Requires-Dist: mypy
|
|
57
|
-
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
58
|
-
Requires-Dist: pytest-codspeed>=2.0.0; extra == "test"
|
|
62
|
+
Requires-Dist: mypy[mypyc]<1.20,>=1.14.1; extra == "test"
|
|
59
63
|
Requires-Dist: pytest-xdist>=2.4.0; extra == "test"
|
|
64
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
65
|
+
Provides-Extra: codspeed
|
|
66
|
+
Requires-Dist: pytest-codspeed<4.3,>=4.2; extra == "codspeed"
|
|
67
|
+
Requires-Dist: pytest-test-groups; extra == "codspeed"
|
|
68
|
+
Requires-Dist: pytest>=7.0.0; extra == "codspeed"
|
|
69
|
+
Provides-Extra: benchmark
|
|
70
|
+
Requires-Dist: eth-utils==5.3.1; extra == "benchmark"
|
|
71
|
+
Requires-Dist: pytest-benchmark<5.3,>=5.2; extra == "benchmark"
|
|
72
|
+
Requires-Dist: pytest-codspeed<4.3,>=4.2; extra == "benchmark"
|
|
73
|
+
Requires-Dist: pytest-test-groups; extra == "benchmark"
|
|
74
|
+
Requires-Dist: pytest>=7.0.0; extra == "benchmark"
|
|
60
75
|
Dynamic: author
|
|
61
76
|
Dynamic: author-email
|
|
62
77
|
Dynamic: classifier
|
|
@@ -66,6 +81,7 @@ Dynamic: home-page
|
|
|
66
81
|
Dynamic: keywords
|
|
67
82
|
Dynamic: license
|
|
68
83
|
Dynamic: license-file
|
|
84
|
+
Dynamic: project-url
|
|
69
85
|
Dynamic: provides-extra
|
|
70
86
|
Dynamic: requires-dist
|
|
71
87
|
Dynamic: requires-python
|
|
@@ -79,10 +95,14 @@ Dynamic: summary
|
|
|
79
95
|
|
|
80
96
|
##### This fork will be kept up-to-date with [eth-utils](https://github.com/ethereum/eth-utils). I will pull updates as they are released and push new [faster-eth-utils](https://github.com/BobTheBuidler/faster-eth-utils) releases to [PyPI](https://pypi.org/project/faster-eth-utils/).
|
|
81
97
|
|
|
82
|
-
#####
|
|
98
|
+
##### Starting in [v5.3.11](https://github.com/BobTheBuidler/faster-eth-utils/releases/tag/v5.3.11), all `faster-eth-utils` Exception classes inherit from the matching Exception class in `eth-utils`, so porting to `faster-eth-utils` does not require any change to your existing exception handlers. All existing exception handling in your codebase will continue to work as it did when originaly implemented.
|
|
83
99
|
|
|
84
100
|
##### We benchmark `faster-eth-utils` against the original `eth-utils` for your convenience. [See results](https://github.com/BobTheBuidler/faster-eth-utils/tree/master/benchmarks/results).
|
|
85
101
|
|
|
102
|
+
##### You can find the compiled C code and header files in the [build](https://github.com/BobTheBuidler/eth-utils/tree/master/build) directory.
|
|
103
|
+
|
|
104
|
+
###### You may also be interested in: [faster-web3.py](https://github.com/BobTheBuidler/faster-web3.py/), [faster-eth-abi](https://github.com/BobTheBuidler/faster-eth-abi/), and [faster-hexbytes](https://github.com/BobTheBuidler/faster-hexbytes/)
|
|
105
|
+
|
|
86
106
|
##### The original eth-utils readme is below:
|
|
87
107
|
|
|
88
108
|
# Ethereum Utilities
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
faster_eth_utils__mypyc.cp313-win_amd64.pyd,sha256=lflenoBWzouH5lj15uS1C9poE-Om1mQqD5unDG2E9K8,465408
|
|
2
|
+
faster_eth_utils/__init__.py,sha256=Hk6hT3RXB-ednEtyC4QgGeRVby9xSwUsK5I38NxnqBg,2906
|
|
3
|
+
faster_eth_utils/__main__.py,sha256=_ZPSIKET0Rym_kVRE6xmvmbZVqYTMuTeyRdwduo2e48,91
|
|
4
|
+
faster_eth_utils/abi.cp313-win_amd64.pyd,sha256=Y_mAMvS-Pt_m7ofgaYywefKpcfe39wTlPcTXoOIhC98,10752
|
|
5
|
+
faster_eth_utils/abi.py,sha256=9hONYnt8Hehk2PAn5N3eOsqR91kDVeT9pH9FdkquIlk,27889
|
|
6
|
+
faster_eth_utils/address.cp313-win_amd64.pyd,sha256=kSGieFOfVDHZU-Dkxch91SGeTZ11x6q0xct-YW9UFOY,10752
|
|
7
|
+
faster_eth_utils/address.py,sha256=Yu9jE6XuKKC0nhFc4KOGHEul8G4X8t79yHfdcprWq4U,3710
|
|
8
|
+
faster_eth_utils/applicators.cp313-win_amd64.pyd,sha256=r_-L3HRdJ4bEn7YuZZZ0cxqt0f9mo362WsL5DdE3EZU,10752
|
|
9
|
+
faster_eth_utils/applicators.py,sha256=irFMuW-PdWMwVlzZQ5OL9wSx9JebUPr9dshVu_BSX3s,6040
|
|
10
|
+
faster_eth_utils/conversions.cp313-win_amd64.pyd,sha256=ZQeSNN83eqWsEMtp37XOahqEiUM-I32Y6BmCx0hPv0w,10752
|
|
11
|
+
faster_eth_utils/conversions.py,sha256=s2twjSs7eXAZYA7q-MvVx8nRh6pSwhrGWp7TWWPHMaI,5759
|
|
12
|
+
faster_eth_utils/crypto.cp313-win_amd64.pyd,sha256=dSo06bWVM7pCaQmnDQdjDMasOIgjodQkJDYqKWMZTJI,10752
|
|
13
|
+
faster_eth_utils/crypto.py,sha256=QNl-6kpKS97cjtcqq3k0LonQNVY0zccdJWTbtMzTOeA,348
|
|
14
|
+
faster_eth_utils/currency.cp313-win_amd64.pyd,sha256=3U3ZEXCFFLLwIZoTlCeXZZ4_jrD0RS1emlEnJ4Wt_XI,10752
|
|
15
|
+
faster_eth_utils/currency.py,sha256=m_PjhECWaqZHq5-1q6EphcjSotWwAkf88JzbtZGxfvo,4351
|
|
16
|
+
faster_eth_utils/debug.cp313-win_amd64.pyd,sha256=OBZ-944BOEr_3FGHs0e4ls2wCOH1CYX0wmai05ipEFE,10752
|
|
17
|
+
faster_eth_utils/debug.py,sha256=V3fN7-gz246Tcf_Zp99QK3uDzW22odPpAl_bShIZhZs,519
|
|
18
|
+
faster_eth_utils/decorators.cp313-win_amd64.pyd,sha256=M7JzGwGVeTIBQHkmUdxgAj_53jUVuVYrB2nxXk5a99w,10752
|
|
19
|
+
faster_eth_utils/decorators.py,sha256=OX-fovjdPjlSY4fkC3rV2M9YW20GlXRy1bv28ivSl4w,3309
|
|
20
|
+
faster_eth_utils/encoding.cp313-win_amd64.pyd,sha256=EA5tJIYN5TKR1vI1m2GMeDAY8FnXBiwsh0PPs1PKGAc,10752
|
|
21
|
+
faster_eth_utils/encoding.py,sha256=Be10DAYjsVq-0xMu1Kc3IYU28EDfZkOqxdE8qJuHQMc,217
|
|
22
|
+
faster_eth_utils/exceptions.cp313-win_amd64.pyd,sha256=wKr98R284Cs5LL6HXOk1zIkHFAOw4OGG6w_mbqxokjc,10752
|
|
23
|
+
faster_eth_utils/exceptions.py,sha256=IekZC213PemJO8Z1EUo65Fx7YaAUEOeIoshbXaeFvB0,402
|
|
24
|
+
faster_eth_utils/functional.cp313-win_amd64.pyd,sha256=-4sasKX5OLVRPKCse3ZJv5AMRKqvrre3nEmEnaluaNM,10752
|
|
25
|
+
faster_eth_utils/functional.py,sha256=H4BpF_SVLFpLOEQs7Y0fLVGVGstvN2emxpjBZEoy0uI,2545
|
|
26
|
+
faster_eth_utils/hexadecimal.cp313-win_amd64.pyd,sha256=osyaw_7ZI1wN5E8OeTZe-vyI5Vv5bReolRgY4LnWA2Q,10752
|
|
27
|
+
faster_eth_utils/hexadecimal.py,sha256=5ABF--j_998u_6beToLRwhb7nLQPdplNWOp1o-Q0ZuE,2134
|
|
28
|
+
faster_eth_utils/humanize.cp313-win_amd64.pyd,sha256=TUHyu_K2NP3QjTPO8UrJpBofugidPluNqWCclNRigjg,10752
|
|
29
|
+
faster_eth_utils/humanize.py,sha256=zJwr9UttVTdDALOdXYu6T1rPNLtjwYufVIILXeqev7g,4904
|
|
30
|
+
faster_eth_utils/logging.py,sha256=oYHS-6MMMfqBCXId5kPiTUFA8tkZOGbpopVtAu_8UQM,4910
|
|
31
|
+
faster_eth_utils/module_loading.cp313-win_amd64.pyd,sha256=ulKnT53K2M6pSN_Rf-681RNP0iN-hd8_AJ0XQol1g0c,10752
|
|
32
|
+
faster_eth_utils/module_loading.py,sha256=gGZ0n4zezi2zxMRuEU0cf7EYW1lXpS_a1aPvP1KFkXA,873
|
|
33
|
+
faster_eth_utils/network.cp313-win_amd64.pyd,sha256=IopWz8YE5RVklbQ4yEU14cby08IqOgOL7Ic5MC7Lu4M,10752
|
|
34
|
+
faster_eth_utils/network.py,sha256=jy6m5g54X3777Iti1G3mR_0N2B-TNU3IIZl-pb16eXs,2370
|
|
35
|
+
faster_eth_utils/numeric.cp313-win_amd64.pyd,sha256=Gg3-y2dXiRRLuJF-WZ4GTrzNQ56NPInsLY9EPhsVtU8,10752
|
|
36
|
+
faster_eth_utils/numeric.py,sha256=Mqc6dzs-aK84cBFxsZtXJhpb7_S-TDug-FuFqlR6vHg,1233
|
|
37
|
+
faster_eth_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
|
+
faster_eth_utils/pydantic.py,sha256=g5YQh2EbfwdJvxT5s7HiYId8dz94Xl7dy_hT9XBKOyo,3516
|
|
39
|
+
faster_eth_utils/toolz.cp313-win_amd64.pyd,sha256=xoXX0QgCJnpx0H7RS0XOXQmRWrYjaw3jNd8PgEW-ElQ,10752
|
|
40
|
+
faster_eth_utils/toolz.py,sha256=P3s23LOEFRY6XQ8i_ChnA9hf-PSi-Oe-pv0jzsj7DjY,4494
|
|
41
|
+
faster_eth_utils/types.cp313-win_amd64.pyd,sha256=byidmsrM7HpEPCjPWym769zzurXlk8aJwF6-E7ygFaM,10752
|
|
42
|
+
faster_eth_utils/types.py,sha256=uncVkm2E0WNhOPyubsxXN4wgc600tgE_qo2MP8Gm8Dg,1589
|
|
43
|
+
faster_eth_utils/units.cp313-win_amd64.pyd,sha256=xac1LxKLlNQaq2sim0BRWmCQlDA0F8KfgE5w6V_nwnk,10752
|
|
44
|
+
faster_eth_utils/units.py,sha256=QQyNHx2umgN5LtOmptc_2-XKf3A-5YfVcTwaEcVrev8,1788
|
|
45
|
+
faster_eth_utils/__json/eth_networks.json,sha256=Zvb92ir0B_xKfqAraQtQLSf7J1zrfl_lwbYYrtP-hms,414774
|
|
46
|
+
faster_eth_utils/curried/__init__.py,sha256=GGoJTtrx54OSlW0dS_l2hMZjwePQzBSIdHNUMVki0OA,8102
|
|
47
|
+
faster_eth_utils/typing/__init__.py,sha256=mCjbC5-GULGyLCr-LHccbW_aKPkzN2w1ejW3EBfy6mU,343
|
|
48
|
+
faster_eth_utils/typing/misc.py,sha256=rokTYylOyX_Uok6rb8L1JsH_7fAydRmDWLzL5xc6Bao,204
|
|
49
|
+
faster_eth_utils-5.3.23.dist-info/licenses/LICENSE,sha256=VSsrPEmF7tY2P84NOLM4ZsJDoEIjpf16GFwU5-py2n0,1116
|
|
50
|
+
faster_eth_utils-5.3.23.dist-info/METADATA,sha256=iB-sc2io4uoDNT6OUlgEbli7Lz2_QWkHgvA4MQdJv-o,9099
|
|
51
|
+
faster_eth_utils-5.3.23.dist-info/WHEEL,sha256=qV0EIPljj1XC_vuSatRWjn02nZIz3N1t8jsZz7HBr2U,101
|
|
52
|
+
faster_eth_utils-5.3.23.dist-info/top_level.txt,sha256=wTH6UCItCCvEEiJ9EiOrm0Kn4p4xhB7VdmmTHktoo9Y,51
|
|
53
|
+
faster_eth_utils-5.3.23.dist-info/RECORD,,
|
|
Binary file
|
|
Binary file
|