faster-eth-utils 4.1.4__tar.gz → 4.1.6__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.
Files changed (79) hide show
  1. {faster-eth-utils-4.1.4/faster_eth_utils.egg-info → faster-eth-utils-4.1.6}/PKG-INFO +1 -1
  2. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/applicators.py +1 -1
  3. faster-eth-utils-4.1.6/faster_eth_utils/functional.py +89 -0
  4. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/network.py +9 -1
  5. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6/faster_eth_utils.egg-info}/PKG-INFO +1 -1
  6. faster-eth-utils-4.1.6/faster_eth_utils.egg-info/top_level.txt +3 -0
  7. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/setup.py +7 -3
  8. faster-eth-utils-4.1.4/faster_eth_utils/functional.py +0 -75
  9. faster-eth-utils-4.1.4/faster_eth_utils.egg-info/top_level.txt +0 -3
  10. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/LICENSE +0 -0
  11. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/MANIFEST.in +0 -0
  12. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/README.md +0 -0
  13. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/__init__.py +0 -0
  14. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/__json/eth_networks.json +0 -0
  15. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/__main__.py +0 -0
  16. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/abi.py +0 -0
  17. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/address.py +0 -0
  18. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/conversions.py +0 -0
  19. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/crypto.py +0 -0
  20. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/currency.py +0 -0
  21. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/curried/__init__.py +0 -0
  22. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/debug.py +0 -0
  23. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/decorators.py +0 -0
  24. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/encoding.py +0 -0
  25. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/exceptions.py +0 -0
  26. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/hexadecimal.py +0 -0
  27. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/humanize.py +0 -0
  28. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/logging.py +0 -0
  29. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/module_loading.py +0 -0
  30. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/numeric.py +0 -0
  31. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/py.typed +0 -0
  32. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/toolz.py +0 -0
  33. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/types.py +0 -0
  34. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/typing/__init__.py +0 -0
  35. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/typing/misc.py +0 -0
  36. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils/units.py +0 -0
  37. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils.egg-info/SOURCES.txt +0 -0
  38. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils.egg-info/dependency_links.txt +0 -0
  39. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils.egg-info/not-zip-safe +0 -0
  40. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/faster_eth_utils.egg-info/requires.txt +0 -0
  41. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/pyproject.toml +0 -0
  42. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/setup.cfg +0 -0
  43. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/abi-utils/test_abi_utils.py +0 -0
  44. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/address-utils/test_address_utils.py +0 -0
  45. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/applicator-utils/test_applicators.py +0 -0
  46. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/conversion-utils/test_conversions.py +0 -0
  47. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/currency-utils/test_currency_tools.py +0 -0
  48. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/currency-utils/test_denoms_obj.py +0 -0
  49. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/curried-utils/test_curried.py +0 -0
  50. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/decorator-utils/test_combomethod.py +0 -0
  51. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/decorator-utils/test_replace_exceptions.py +0 -0
  52. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/decorator-utils/test_validate_conversion_arguments.py +0 -0
  53. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/encoding-utils/test_big_endian_integer.py +0 -0
  54. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/functional-utils/test_return_value_decorators.py +0 -0
  55. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/functional-utils/test_type_inference.py +0 -0
  56. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/hexadecimal-utils/test_0x_prefix_addition_and_removal.py +0 -0
  57. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/hexadecimal-utils/test_is_0x_prefixed.py +0 -0
  58. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/hexadecimal-utils/test_is_hex.py +0 -0
  59. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/hexadecimal-utils/test_is_hexstr.py +0 -0
  60. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/humanize-utils/test_humanize_bytes.py +0 -0
  61. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/humanize-utils/test_humanize_hash.py +0 -0
  62. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/humanize-utils/test_humanize_hexstr.py +0 -0
  63. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/humanize-utils/test_humanize_integer_sequence.py +0 -0
  64. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/humanize-utils/test_humanize_ipfs_uri.py +0 -0
  65. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/humanize-utils/test_humanize_seconds.py +0 -0
  66. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/humanize-utils/test_humanize_wei.py +0 -0
  67. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/logging-utils/test_DEBUG2_logging.py +0 -0
  68. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/logging-utils/test_compat_with_abc_ABC.py +0 -0
  69. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/logging-utils/test_get_logger.py +0 -0
  70. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/logging-utils/test_has_logger_metaclass.py +0 -0
  71. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/module-loading-utils/test_import_string.py +0 -0
  72. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/network-utils/test_network_utils.py +0 -0
  73. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/numeric-utils/test_clamp.py +0 -0
  74. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/pydantic-utils/test_camel_model.py +0 -0
  75. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/test_import_and_version.py +0 -0
  76. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/type-checks/mypy_typing_of_curried_utils.py +0 -0
  77. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/type-checks/mypy_typing_of_functional_utils.py +0 -0
  78. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/type-checks/mypy_typing_of_has_logger.py +0 -0
  79. {faster-eth-utils-4.1.4 → faster-eth-utils-4.1.6}/tests/core/types-utils/test_types_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: faster-eth-utils
3
- Version: 4.1.4
3
+ Version: 4.1.6
4
4
  Summary: A fork of eth-utils: Common utility functions for python code that interacts with Ethereum, implemented in C
5
5
  Home-page: https://github.com/BobTheBuidler/eth-utils
6
6
  Author: The Ethereum Foundation
@@ -38,7 +38,7 @@ def apply_formatter_at_index(
38
38
  yield item
39
39
 
40
40
 
41
- def combine_argument_formatters(*formatters: List[Callable[..., Any]]) -> Formatters:
41
+ def combine_argument_formatters(*formatters: Callable[..., Any]) -> Formatters:
42
42
  warnings.warn(
43
43
  DeprecationWarning(
44
44
  "combine_argument_formatters(formatter1, formatter2)([item1, item2])"
@@ -0,0 +1,89 @@
1
+ import collections
2
+ import functools
3
+ import itertools
4
+ from typing import ( # noqa: F401
5
+ Callable,
6
+ Dict,
7
+ Iterable,
8
+ List,
9
+ Mapping,
10
+ Set,
11
+ Tuple,
12
+ TypeVar,
13
+ Union,
14
+ )
15
+
16
+ from typing_extensions import ParamSpec
17
+
18
+ from .toolz import (
19
+ compose as _compose,
20
+ )
21
+
22
+ P = ParamSpec("P")
23
+ T = TypeVar("T")
24
+
25
+
26
+ def identity(value: T) -> T:
27
+ return value
28
+
29
+
30
+ TGIn = TypeVar("TGIn")
31
+ TGOut = TypeVar("TGOut")
32
+ TFOut = TypeVar("TFOut")
33
+
34
+
35
+ def combine(
36
+ f: Callable[[TGOut], TFOut], g: Callable[[TGIn], TGOut]
37
+ ) -> Callable[[TGIn], TFOut]:
38
+ def combined(x: TGIn) -> TFOut:
39
+ return f(g(x))
40
+ return combined
41
+
42
+
43
+ TCb = TypeVar("TCb")
44
+
45
+
46
+ def apply_to_return_value(
47
+ callback: Callable[[T], TCb]
48
+ ) -> Callable[[Callable[P, T]], Callable[P, TCb]]:
49
+ def outer(fn: Callable[P, T]) -> Callable[P, TCb]:
50
+ @functools.wraps(fn)
51
+ def inner(*args: P.args, **kwargs: P.kwargs) -> TCb:
52
+ return callback(fn(*args, **kwargs))
53
+ return inner
54
+ return outer
55
+
56
+
57
+ TVal = TypeVar("TVal")
58
+ TKey = TypeVar("TKey")
59
+
60
+ def to_tuple(fn: Callable[P, Iterable[TVal]]) -> Callable[P, Tuple[TVal, ...]]:
61
+ def to_tuple_wrap(*args: P.args, **kwargs: P.kwargs) -> Tuple[TVal, ...]:
62
+ return tuple(fn(*args, **kwargs))
63
+ return to_tuple_wrap
64
+
65
+ def to_list(fn: Callable[P, Iterable[TVal]]) -> Callable[P, List[TVal]]:
66
+ def to_list_wrap(*args: P.args, **kwargs: P.kwargs) -> List[TVal]:
67
+ return list(fn(*args, **kwargs))
68
+ return to_list_wrap
69
+
70
+ def to_set(fn: Callable[P, Iterable[TVal]]) -> Callable[P, Set[TVal]]:
71
+ def to_set_wrap(*args: P.args, **kwargs: P.kwargs) -> Set[TVal]:
72
+ return set(fn(*args, **kwargs))
73
+ return to_set_wrap
74
+
75
+ def to_dict(
76
+ fn: Callable[P, Union[Mapping[TKey, TVal], Iterable[Tuple[TKey, TVal]]]]
77
+ ) -> Callable[P, Dict[TKey, TVal]]:
78
+ def to_dict_wrap(*args: P.args, **kwargs: P.kwargs) -> Dict[TKey, TVal]:
79
+ return dict(fn(*args, **kwargs))
80
+ return to_dict_wrap
81
+
82
+ to_ordered_dict = apply_to_return_value( # type: ignore [assignment]
83
+ collections.OrderedDict
84
+ ) # type: Callable[[Callable[P, Union[Mapping[TKey, TVal], Iterable[Tuple[TKey, TVal]]]]], Callable[P, collections.OrderedDict[TKey, TVal]]] # noqa: E501
85
+ sort_return = _compose(to_tuple, apply_to_return_value(sorted))
86
+ flatten_return = _compose(
87
+ to_tuple, apply_to_return_value(itertools.chain.from_iterable)
88
+ )
89
+ reversed_return = _compose(to_tuple, apply_to_return_value(reversed), to_tuple)
@@ -3,7 +3,12 @@ from dataclasses import (
3
3
  )
4
4
  import json
5
5
  import os
6
+ import sys
7
+ from pathlib import (
8
+ Path,
9
+ )
6
10
  from typing import (
11
+ Final,
7
12
  List,
8
13
  )
9
14
 
@@ -16,6 +21,9 @@ from faster_eth_utils import (
16
21
  )
17
22
 
18
23
 
24
+ FASTER_ETH_UTILS_FOLDER: Final = Path(sys.modules["faster_eth_utils"].__file__).parent # type: ignore [arg-type]
25
+
26
+
19
27
  @dataclass
20
28
  class Network:
21
29
  chain_id: int
@@ -28,7 +36,7 @@ def initialize_network_objects() -> List[Network]:
28
36
  networks_obj = []
29
37
 
30
38
  networks_json_path = os.path.abspath(
31
- os.path.join(os.path.dirname(__file__), "__json")
39
+ os.path.join(str(FASTER_ETH_UTILS_FOLDER), "__json")
32
40
  )
33
41
  with open(
34
42
  os.path.join(networks_json_path, "eth_networks.json"),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: faster-eth-utils
3
- Version: 4.1.4
3
+ Version: 4.1.6
4
4
  Summary: A fork of eth-utils: Common utility functions for python code that interacts with Ethereum, implemented in C
5
5
  Home-page: https://github.com/BobTheBuidler/eth-utils
6
6
  Author: The Ethereum Foundation
@@ -0,0 +1,3 @@
1
+ 99c07adba6ff961eaf3e__mypyc
2
+ eth_utils
3
+ faster_eth_utils
@@ -12,17 +12,21 @@ else:
12
12
  [
13
13
  "faster_eth_utils/abi.py",
14
14
  "faster_eth_utils/address.py",
15
- #"faster_eth_utils/applicators.py",
15
+ "faster_eth_utils/applicators.py",
16
16
  "faster_eth_utils/conversions.py",
17
+ "faster_eth_utils/crypto.py",
17
18
  "faster_eth_utils/currency.py",
18
19
  "faster_eth_utils/debug.py",
19
20
  "faster_eth_utils/decorators.py",
20
21
  "faster_eth_utils/encoding.py",
21
22
  "faster_eth_utils/exceptions.py",
23
+ "faster_eth_utils/functional.py",
22
24
  "faster_eth_utils/hexadecimal.py",
23
25
  "faster_eth_utils/humanize.py",
24
26
  "faster_eth_utils/module_loading.py",
25
- # "faster_eth_utils/network.py", compiled module has no __file__
27
+ "faster_eth_utils/network.py",
28
+ "faster_eth_utils/numeric.py",
29
+ "faster_eth_utils/toolz.py",
26
30
  "faster_eth_utils/types.py",
27
31
  "faster_eth_utils/units.py",
28
32
  "--pretty",
@@ -71,7 +75,7 @@ with open("./README.md") as readme:
71
75
  setup(
72
76
  name="faster-eth-utils",
73
77
  # *IMPORTANT*: Don't manually change the version here. Use `make bump`, as described in readme
74
- version="4.1.4",
78
+ version="4.1.6",
75
79
  description=(
76
80
  """A fork of eth-utils: Common utility functions for python code that interacts with Ethereum, implemented in C"""
77
81
  ),
@@ -1,75 +0,0 @@
1
- import collections
2
- import functools
3
- import itertools
4
- from typing import ( # noqa: F401
5
- Any,
6
- Callable,
7
- Dict,
8
- Iterable,
9
- List,
10
- Mapping,
11
- Set,
12
- Tuple,
13
- TypeVar,
14
- Union,
15
- )
16
-
17
- from .toolz import (
18
- compose as _compose,
19
- )
20
-
21
- T = TypeVar("T")
22
-
23
-
24
- def identity(value: T) -> T:
25
- return value
26
-
27
-
28
- TGIn = TypeVar("TGIn")
29
- TGOut = TypeVar("TGOut")
30
- TFOut = TypeVar("TFOut")
31
-
32
-
33
- def combine(
34
- f: Callable[[TGOut], TFOut], g: Callable[[TGIn], TGOut]
35
- ) -> Callable[[TGIn], TFOut]:
36
- return lambda x: f(g(x))
37
-
38
-
39
- def apply_to_return_value(
40
- callback: Callable[..., T]
41
- ) -> Callable[..., Callable[..., T]]:
42
- def outer(fn: Callable[..., T]) -> Callable[..., T]:
43
- # We would need to type annotate *args and **kwargs but doing so segfaults
44
- # the PyPy builds. We ignore instead.
45
- @functools.wraps(fn)
46
- def inner(*args, **kwargs) -> T: # type: ignore
47
- return callback(fn(*args, **kwargs))
48
-
49
- return inner
50
-
51
- return outer
52
-
53
-
54
- TVal = TypeVar("TVal")
55
- TKey = TypeVar("TKey")
56
- to_tuple = apply_to_return_value(
57
- tuple
58
- ) # type: Callable[[Callable[..., Iterable[TVal]]], Callable[..., Tuple[TVal, ...]]] # noqa: E501
59
- to_list = apply_to_return_value(
60
- list
61
- ) # type: Callable[[Callable[..., Iterable[TVal]]], Callable[..., List[TVal]]] # noqa: E501
62
- to_set = apply_to_return_value(
63
- set
64
- ) # type: Callable[[Callable[..., Iterable[TVal]]], Callable[..., Set[TVal]]] # noqa: E501
65
- to_dict = apply_to_return_value(
66
- dict
67
- ) # type: Callable[[Callable[..., Iterable[Union[Mapping[TKey, TVal], Tuple[TKey, TVal]]]]], Callable[..., Dict[TKey, TVal]]] # noqa: E501
68
- to_ordered_dict = apply_to_return_value(
69
- collections.OrderedDict
70
- ) # type: Callable[[Callable[..., Iterable[Union[Mapping[TKey, TVal], Tuple[TKey, TVal]]]]], Callable[..., collections.OrderedDict[TKey, TVal]]] # noqa: E501
71
- sort_return = _compose(to_tuple, apply_to_return_value(sorted))
72
- flatten_return = _compose(
73
- to_tuple, apply_to_return_value(itertools.chain.from_iterable)
74
- )
75
- reversed_return = _compose(to_tuple, apply_to_return_value(reversed), to_tuple)
@@ -1,3 +0,0 @@
1
- bce0bfc64ce5e845ec4a__mypyc
2
- eth_utils
3
- faster_eth_utils