faster-eth-utils 4.1.2__tar.gz → 4.1.4__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 (78) hide show
  1. {faster-eth-utils-4.1.2/faster_eth_utils.egg-info → faster-eth-utils-4.1.4}/PKG-INFO +1 -1
  2. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/address.py +11 -15
  3. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/conversions.py +3 -4
  4. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/currency.py +2 -2
  5. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/hexadecimal.py +12 -14
  6. faster-eth-utils-4.1.4/faster_eth_utils/types.py +62 -0
  7. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4/faster_eth_utils.egg-info}/PKG-INFO +1 -1
  8. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/pyproject.toml +7 -1
  9. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/setup.py +1 -1
  10. faster-eth-utils-4.1.2/faster_eth_utils/types.py +0 -54
  11. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/LICENSE +0 -0
  12. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/MANIFEST.in +0 -0
  13. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/README.md +0 -0
  14. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/__init__.py +0 -0
  15. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/__json/eth_networks.json +0 -0
  16. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/__main__.py +0 -0
  17. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/abi.py +0 -0
  18. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/applicators.py +0 -0
  19. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/crypto.py +0 -0
  20. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/curried/__init__.py +0 -0
  21. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/debug.py +0 -0
  22. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/decorators.py +0 -0
  23. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/encoding.py +0 -0
  24. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/exceptions.py +0 -0
  25. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/functional.py +0 -0
  26. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/humanize.py +0 -0
  27. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/logging.py +0 -0
  28. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/module_loading.py +0 -0
  29. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/network.py +0 -0
  30. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/numeric.py +0 -0
  31. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/py.typed +0 -0
  32. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/toolz.py +0 -0
  33. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/typing/__init__.py +0 -0
  34. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/typing/misc.py +0 -0
  35. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils/units.py +0 -0
  36. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils.egg-info/SOURCES.txt +0 -0
  37. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils.egg-info/dependency_links.txt +0 -0
  38. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils.egg-info/not-zip-safe +0 -0
  39. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils.egg-info/requires.txt +0 -0
  40. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/faster_eth_utils.egg-info/top_level.txt +0 -0
  41. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/setup.cfg +0 -0
  42. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/abi-utils/test_abi_utils.py +0 -0
  43. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/address-utils/test_address_utils.py +0 -0
  44. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/applicator-utils/test_applicators.py +0 -0
  45. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/conversion-utils/test_conversions.py +0 -0
  46. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/currency-utils/test_currency_tools.py +0 -0
  47. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/currency-utils/test_denoms_obj.py +0 -0
  48. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/curried-utils/test_curried.py +0 -0
  49. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/decorator-utils/test_combomethod.py +0 -0
  50. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/decorator-utils/test_replace_exceptions.py +0 -0
  51. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/decorator-utils/test_validate_conversion_arguments.py +0 -0
  52. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/encoding-utils/test_big_endian_integer.py +0 -0
  53. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/functional-utils/test_return_value_decorators.py +0 -0
  54. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/functional-utils/test_type_inference.py +0 -0
  55. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/hexadecimal-utils/test_0x_prefix_addition_and_removal.py +0 -0
  56. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/hexadecimal-utils/test_is_0x_prefixed.py +0 -0
  57. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/hexadecimal-utils/test_is_hex.py +0 -0
  58. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/hexadecimal-utils/test_is_hexstr.py +0 -0
  59. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/humanize-utils/test_humanize_bytes.py +0 -0
  60. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/humanize-utils/test_humanize_hash.py +0 -0
  61. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/humanize-utils/test_humanize_hexstr.py +0 -0
  62. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/humanize-utils/test_humanize_integer_sequence.py +0 -0
  63. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/humanize-utils/test_humanize_ipfs_uri.py +0 -0
  64. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/humanize-utils/test_humanize_seconds.py +0 -0
  65. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/humanize-utils/test_humanize_wei.py +0 -0
  66. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/logging-utils/test_DEBUG2_logging.py +0 -0
  67. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/logging-utils/test_compat_with_abc_ABC.py +0 -0
  68. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/logging-utils/test_get_logger.py +0 -0
  69. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/logging-utils/test_has_logger_metaclass.py +0 -0
  70. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/module-loading-utils/test_import_string.py +0 -0
  71. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/network-utils/test_network_utils.py +0 -0
  72. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/numeric-utils/test_clamp.py +0 -0
  73. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/pydantic-utils/test_camel_model.py +0 -0
  74. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/test_import_and_version.py +0 -0
  75. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/type-checks/mypy_typing_of_curried_utils.py +0 -0
  76. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/type-checks/mypy_typing_of_functional_utils.py +0 -0
  77. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/tests/core/type-checks/mypy_typing_of_has_logger.py +0 -0
  78. {faster-eth-utils-4.1.2 → faster-eth-utils-4.1.4}/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.2
3
+ Version: 4.1.4
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
@@ -13,6 +13,9 @@ from eth_typing import (
13
13
  HexAddress,
14
14
  HexStr,
15
15
  )
16
+ from typing_extensions import (
17
+ TypeGuard,
18
+ )
16
19
 
17
20
  from .conversions import (
18
21
  hexstr_if_str,
@@ -35,7 +38,7 @@ from .types import (
35
38
  _HEX_ADDRESS_REGEXP: Final = re.compile("(0x)?[0-9a-f]{40}", re.IGNORECASE | re.ASCII)
36
39
 
37
40
 
38
- def is_hex_address(value: Any) -> bool:
41
+ def is_hex_address(value: Any) -> TypeGuard[HexAddress]:
39
42
  """
40
43
  Checks if the given string of text type is an address in hexadecimal encoded form.
41
44
  """
@@ -44,7 +47,7 @@ def is_hex_address(value: Any) -> bool:
44
47
  return _HEX_ADDRESS_REGEXP.fullmatch(value) is not None
45
48
 
46
49
 
47
- def is_binary_address(value: Any) -> bool:
50
+ def is_binary_address(value: Any) -> TypeGuard[bytes]:
48
51
  """
49
52
  Checks if the given string is an address in raw bytes form.
50
53
  """
@@ -83,7 +86,7 @@ def to_normalized_address(value: Union[AnyAddress, str, bytes]) -> HexAddress:
83
86
  )
84
87
 
85
88
 
86
- def is_normalized_address(value: Any) -> bool:
89
+ def is_normalized_address(value: Any) -> TypeGuard[HexAddress]:
87
90
  """
88
91
  Returns whether the provided value is an address in its normalized form.
89
92
  """
@@ -101,15 +104,12 @@ def to_canonical_address(address: Union[AnyAddress, str, bytes]) -> Address:
101
104
  return Address(decode_hex(to_normalized_address(address)))
102
105
 
103
106
 
104
- def is_canonical_address(address: Any) -> bool:
107
+ def is_canonical_address(address: Any) -> TypeGuard[Address]:
105
108
  """
106
109
  Returns `True` if the `value` is an address in its canonical form.
107
110
  """
108
- if not is_bytes(address) or len(address) != 20:
109
- return False
110
- is_equal = address == to_canonical_address(address)
111
- return cast(bool, is_equal)
112
-
111
+ return is_binary_address(address) and address == to_canonical_address(address)
112
+ 8
113
113
 
114
114
  def is_same_address(left: AnyAddress, right: AnyAddress) -> bool:
115
115
  """
@@ -143,14 +143,10 @@ def to_checksum_address(value: Union[AnyAddress, str, bytes]) -> ChecksumAddress
143
143
  return ChecksumAddress(HexAddress(checksum_address))
144
144
 
145
145
 
146
- def is_checksum_address(value: Any) -> bool:
147
- if not is_text(value):
148
- return False
149
-
146
+ def is_checksum_address(value: Any) -> TypeGuard[ChecksumAddress]:
150
147
  if not is_hex_address(value):
151
148
  return False
152
- is_equal = value == to_checksum_address(value)
153
- return cast(bool, is_equal)
149
+ return bool(value == to_checksum_address(value))
154
150
 
155
151
 
156
152
  def _is_checksum_formatted(value: Any) -> bool:
@@ -3,7 +3,6 @@ from typing import (
3
3
  Optional,
4
4
  TypeVar,
5
5
  Union,
6
- cast,
7
6
  )
8
7
 
9
8
  from eth_typing import (
@@ -59,7 +58,7 @@ def to_hex(
59
58
  )
60
59
 
61
60
  if is_integer(primitive):
62
- return HexStr(hex(cast(int, primitive)))
61
+ return HexStr(hex(primitive))
63
62
 
64
63
  raise TypeError(
65
64
  f"Unsupported type: '{repr(type(primitive))}'. Must be one of: bool, str, "
@@ -115,7 +114,7 @@ def to_bytes(
115
114
  return to_bytes(hexstr=to_hex(primitive))
116
115
  elif hexstr is not None:
117
116
  if len(hexstr) % 2:
118
- hexstr = cast(HexStr, "0x0" + remove_0x_prefix(hexstr))
117
+ hexstr = "0x0" + remove_0x_prefix(hexstr) # type: ignore [assignment]
119
118
  return decode_hex(hexstr)
120
119
  elif text is not None:
121
120
  return text.encode("utf-8")
@@ -139,7 +138,7 @@ def to_text(
139
138
  elif isinstance(primitive, (bytes, bytearray)):
140
139
  return primitive.decode("utf-8")
141
140
  elif is_integer(primitive):
142
- byte_encoding = int_to_big_endian(cast(int, primitive))
141
+ byte_encoding = int_to_big_endian(primitive)
143
142
  return to_text(byte_encoding)
144
143
  raise TypeError("Expected an int, bytes, bytearray or hexstr.")
145
144
 
@@ -79,7 +79,7 @@ def to_wei(number: Union[int, float, str, decimal.Decimal], unit: str) -> int:
79
79
  raise ValueError(f"Unknown unit. Must be one of {'/'.join(units.keys())}")
80
80
 
81
81
  if is_integer(number) or is_string(number):
82
- d_number = decimal.Decimal(value=number)
82
+ d_number = decimal.Decimal(value=number) # type: ignore [arg-type]
83
83
  elif isinstance(number, float):
84
84
  d_number = decimal.Decimal(value=str(number))
85
85
  elif isinstance(number, decimal.Decimal):
@@ -97,7 +97,7 @@ def to_wei(number: Union[int, float, str, decimal.Decimal], unit: str) -> int:
97
97
  with localcontext() as ctx:
98
98
  multiplier = len(s_number) - s_number.index(".") - 1
99
99
  ctx.prec = multiplier
100
- d_number = decimal.Decimal(value=number, context=ctx) * 10**multiplier
100
+ d_number = decimal.Decimal(value=number, context=ctx) * 10**multiplier # type: ignore [arg-type]
101
101
  unit_value /= 10**multiplier
102
102
 
103
103
  with localcontext() as ctx:
@@ -11,17 +11,15 @@ from typing import (
11
11
  from eth_typing import (
12
12
  HexStr,
13
13
  )
14
-
15
- from .types import (
16
- is_string,
17
- is_text,
14
+ from typing_extensions import (
15
+ TypeGuard,
18
16
  )
19
17
 
20
18
  _HEX_REGEXP: Final = re.compile("(0[xX])?[0-9a-fA-F]*")
21
19
 
22
20
 
23
21
  def decode_hex(value: str) -> bytes:
24
- if not is_text(value):
22
+ if not isinstance(value, str):
25
23
  raise TypeError("Value must be an instance of str")
26
24
  non_prefixed = remove_0x_prefix(HexStr(value))
27
25
  # unhexlify will only accept bytes type someday
@@ -30,19 +28,19 @@ def decode_hex(value: str) -> bytes:
30
28
 
31
29
 
32
30
  def encode_hex(value: AnyStr) -> HexStr:
33
- if not is_string(value):
34
- raise TypeError("Value must be an instance of str or unicode")
35
- elif isinstance(value, (bytes, bytearray)):
31
+ if isinstance(value, (bytes, bytearray)):
36
32
  ascii_bytes = value
33
+ elif isinstance(value, str):
34
+ ascii_bytes = value.encode("ascii") # type: ignore [assignment]
37
35
  else:
38
- ascii_bytes = value.encode("ascii")
36
+ raise TypeError("Value must be an instance of str or unicode")
39
37
 
40
38
  binary_hex = binascii.hexlify(ascii_bytes)
41
39
  return add_0x_prefix(HexStr(binary_hex.decode("ascii")))
42
40
 
43
41
 
44
42
  def is_0x_prefixed(value: str) -> bool:
45
- if not is_text(value):
43
+ if not isinstance(value, str):
46
44
  raise TypeError(
47
45
  f"is_0x_prefixed requires text typed arguments. Got: {repr(value)}"
48
46
  )
@@ -61,14 +59,14 @@ def add_0x_prefix(value: HexStr) -> HexStr:
61
59
  return HexStr("0x" + value)
62
60
 
63
61
 
64
- def is_hexstr(value: Any) -> bool:
65
- if not is_text(value) or not value:
62
+ def is_hexstr(value: Any) -> TypeGuard[HexStr]:
63
+ if not isinstance(value, str) or not value:
66
64
  return False
67
65
  return _HEX_REGEXP.fullmatch(value) is not None
68
66
 
69
67
 
70
- def is_hex(value: Any) -> bool:
71
- if not is_text(value):
68
+ def is_hex(value: Any) -> TypeGuard[HexStr]:
69
+ if not isinstance(value, str):
72
70
  raise TypeError(f"is_hex requires text typed arguments. Got: {repr(value)}")
73
71
  if not value:
74
72
  return False
@@ -0,0 +1,62 @@
1
+ import collections.abc
2
+ import numbers
3
+ from typing import (
4
+ Any,
5
+ List,
6
+ Literal,
7
+ Tuple,
8
+ Union,
9
+ )
10
+
11
+ from typing_extensions import (
12
+ TypeGuard,
13
+ )
14
+
15
+ bytes_types = (bytes, bytearray)
16
+ integer_types = (int,)
17
+ text_types = (str,)
18
+ string_types = (bytes, str, bytearray)
19
+
20
+
21
+ def is_integer(value: Any) -> TypeGuard[int]:
22
+ return isinstance(value, integer_types) and not isinstance(value, bool)
23
+
24
+
25
+ def is_bytes(value: Any) -> TypeGuard[Union[bytes, bytearray]]:
26
+ return isinstance(value, bytes_types)
27
+
28
+
29
+ def is_text(value: Any) -> TypeGuard[str]:
30
+ return isinstance(value, text_types)
31
+
32
+
33
+ def is_string(value: Any) -> TypeGuard[Union[bytes, str, bytearray]]:
34
+ return isinstance(value, string_types)
35
+
36
+
37
+ def is_boolean(value: Any) -> TypeGuard[bool]:
38
+ return isinstance(value, bool)
39
+
40
+
41
+ def is_dict(obj: Any) -> TypeGuard[collections.abc.Mapping[Any, Any]]:
42
+ return isinstance(obj, collections.abc.Mapping)
43
+
44
+
45
+ def is_list_like(obj: Any) -> TypeGuard[collections.abc.Sequence[Any]]:
46
+ return not is_string(obj) and isinstance(obj, collections.abc.Sequence)
47
+
48
+
49
+ def is_list(obj: Any) -> TypeGuard[List[Any]]:
50
+ return isinstance(obj, list)
51
+
52
+
53
+ def is_tuple(obj: Any) -> TypeGuard[Tuple[Any, ...]]:
54
+ return isinstance(obj, tuple)
55
+
56
+
57
+ def is_null(obj: Any) -> TypeGuard[Literal[None]]:
58
+ return obj is None
59
+
60
+
61
+ def is_number(obj: Any) -> TypeGuard[numbers.Number]:
62
+ return isinstance(obj, numbers.Number)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: faster-eth-utils
3
- Version: 4.1.2
3
+ Version: 4.1.4
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
@@ -1,5 +1,11 @@
1
1
  [build-system]
2
- requires = ["setuptools", "wheel", "mypy[mypyc]>=1.14.1,<1.16.1"]
2
+ requires = [
3
+ "setuptools",
4
+ "wheel",
5
+ "mypy[mypyc]>=1.14.1,<1.17.1",
6
+ "eth-hash>=0.3.1",
7
+ "eth-typing>=3.0.0",
8
+ ]
3
9
 
4
10
  [tool.autoflake]
5
11
  exclude = "__init__.py"
@@ -71,7 +71,7 @@ with open("./README.md") as readme:
71
71
  setup(
72
72
  name="faster-eth-utils",
73
73
  # *IMPORTANT*: Don't manually change the version here. Use `make bump`, as described in readme
74
- version="4.1.2",
74
+ version="4.1.4",
75
75
  description=(
76
76
  """A fork of eth-utils: Common utility functions for python code that interacts with Ethereum, implemented in C"""
77
77
  ),
@@ -1,54 +0,0 @@
1
- import collections.abc
2
- import numbers
3
- from typing import (
4
- Any,
5
- )
6
-
7
- bytes_types = (bytes, bytearray)
8
- integer_types = (int,)
9
- text_types = (str,)
10
- string_types = (bytes, str, bytearray)
11
-
12
-
13
- def is_integer(value: Any) -> bool:
14
- return isinstance(value, integer_types) and not isinstance(value, bool)
15
-
16
-
17
- def is_bytes(value: Any) -> bool:
18
- return isinstance(value, bytes_types)
19
-
20
-
21
- def is_text(value: Any) -> bool:
22
- return isinstance(value, text_types)
23
-
24
-
25
- def is_string(value: Any) -> bool:
26
- return isinstance(value, string_types)
27
-
28
-
29
- def is_boolean(value: Any) -> bool:
30
- return isinstance(value, bool)
31
-
32
-
33
- def is_dict(obj: Any) -> bool:
34
- return isinstance(obj, collections.abc.Mapping)
35
-
36
-
37
- def is_list_like(obj: Any) -> bool:
38
- return not is_string(obj) and isinstance(obj, collections.abc.Sequence)
39
-
40
-
41
- def is_list(obj: Any) -> bool:
42
- return isinstance(obj, list)
43
-
44
-
45
- def is_tuple(obj: Any) -> bool:
46
- return isinstance(obj, tuple)
47
-
48
-
49
- def is_null(obj: Any) -> bool:
50
- return obj is None
51
-
52
-
53
- def is_number(obj: Any) -> bool:
54
- return isinstance(obj, numbers.Number)