viz-python-lib 1.0.2__tar.gz → 1.2.0__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 (37) hide show
  1. viz_python_lib-1.2.0/PKG-INFO +174 -0
  2. viz_python_lib-1.2.0/README.md +144 -0
  3. viz_python_lib-1.2.0/pyproject.toml +106 -0
  4. viz_python_lib-1.2.0/viz/__init__.py +3 -0
  5. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/account.py +40 -25
  6. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/block.py +0 -1
  7. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/blockchain.py +6 -8
  8. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/blockchainobject.py +0 -1
  9. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/converter.py +1 -1
  10. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/exceptions.py +0 -1
  11. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/instance.py +0 -1
  12. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/memo.py +4 -5
  13. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/storage.py +0 -6
  14. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/transactionbuilder.py +10 -11
  15. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/utils.py +6 -5
  16. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/viz.py +71 -74
  17. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/wallet.py +0 -10
  18. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/witness.py +0 -1
  19. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizapi/consts.py +9 -0
  20. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizapi/noderpc.py +2 -2
  21. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/account.py +0 -3
  22. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/chains.py +0 -1
  23. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/memo.py +2 -3
  24. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/objects.py +13 -15
  25. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/operationids.py +2 -2
  26. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/operations.py +38 -29
  27. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/signedtransactions.py +1 -2
  28. viz_python_lib-1.0.2/PKG-INFO +0 -99
  29. viz_python_lib-1.0.2/README.md +0 -69
  30. viz_python_lib-1.0.2/pyproject.toml +0 -64
  31. viz_python_lib-1.0.2/viz/__init__.py +0 -13
  32. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/LICENSE.txt +0 -0
  33. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/viz/amount.py +0 -0
  34. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizapi/__init__.py +0 -0
  35. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizapi/exceptions.py +0 -0
  36. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/__init__.py +0 -0
  37. {viz_python_lib-1.0.2 → viz_python_lib-1.2.0}/vizbase/exceptions.py +0 -0
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.4
2
+ Name: viz-python-lib
3
+ Version: 1.2.0
4
+ Summary: Python library for VIZ blockchain
5
+ License: MIT
6
+ License-File: LICENSE.txt
7
+ Keywords: viz,python,library,blockchain
8
+ Author: Vladimir Kamarzin
9
+ Author-email: vvk@vvk.pp.ru
10
+ Requires-Python: >=3.10,<4.0
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Dist: aiohttp (>=3.8,<4)
23
+ Requires-Dist: docker (>=7.1.0,<8.0.0)
24
+ Requires-Dist: funcy (>=2.0,<3.0)
25
+ Requires-Dist: graphenelib (>=1.6.0,<2.0.0)
26
+ Requires-Dist: toolz (>=0.12.0,<0.13.0)
27
+ Project-URL: Repository, https://github.com/VIZ-Blockchain/viz-python-lib
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Python Library for [VIZ](https://github.com/VIZ-Blockchain)
31
+
32
+ ![Tests Status](https://github.com/VIZ-Blockchain/viz-python-lib/actions/workflows/tests.yml/badge.svg)
33
+ [![Documentation Status](https://readthedocs.org/projects/viz-python/badge/?version=latest)](https://viz-python.readthedocs.io/en/latest/?badge=latest)
34
+
35
+ ## Usage examples
36
+
37
+ ### Award someone
38
+
39
+ ```python
40
+ from viz import Client
41
+
42
+ node = "wss://node.viz.cx/ws"
43
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
44
+
45
+ initiator = "your_account"
46
+ receiver = "id"
47
+ percent = 10.5 # 10.5%
48
+ viz.award(receiver, percent, "with love", None, initiator)
49
+ ```
50
+
51
+ ### Award someone with fixed reward
52
+
53
+ ```python
54
+ from viz import Client
55
+
56
+ node = "wss://node.viz.cx/ws"
57
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
58
+
59
+ initiator = "your_account"
60
+ receiver = "id"
61
+ reward_amount = 3.5 # "3.50 VIZ"
62
+ max_energy = 30 # 30%
63
+ viz.fixed_award(receiver, reward_amount, max_energy, "with fixed reward", None, initiator)
64
+ ```
65
+
66
+ ### Send a custom operation
67
+
68
+ ```python
69
+ from viz import Client
70
+
71
+ node = "wss://node.viz.cx/ws"
72
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
73
+
74
+ account = "your_account"
75
+ required_regular_auths = [account]
76
+ protocol = "color.place"
77
+ custom_json = {"x": 35, "y": 70, "color": "#e50000"}
78
+ viz.custom(protocol, custom_json, None, required_regular_auths)
79
+ ```
80
+
81
+ ### Get data from custom protocol
82
+
83
+ ```python
84
+ from viz import Client
85
+ from viz.account import Account
86
+ from viz.block import Block
87
+ from viz.instance import set_shared_blockchain_instance
88
+ import json
89
+
90
+ viz = Client("wss://node.viz.cx/ws")
91
+ set_shared_blockchain_instance(viz)
92
+
93
+ account_name = "id"
94
+ protocol = "V"
95
+ account = Account(account_name, protocol=protocol)
96
+
97
+ counter_inside_protocol = account["custom_sequence"]
98
+ last_used_in_block = account["custom_sequence_block_num"]
99
+
100
+ block = Block(last_used_in_block)
101
+
102
+ for tx in block["transactions"]:
103
+ for op_type, op_data in tx["operations"]:
104
+ if op_type != "custom":
105
+ continue
106
+ if op_data.get("id") != protocol:
107
+ continue
108
+ if account_name not in op_data.get("required_regular_auths", []):
109
+ continue
110
+
111
+ raw_json = op_data.get("json")
112
+ try:
113
+ json_from_protocol = json.loads(raw_json) if raw_json else None
114
+ except json.JSONDecodeError:
115
+ json_from_protocol = None
116
+
117
+ print(json_from_protocol)
118
+ ```
119
+
120
+ ### Any direct RPC call
121
+
122
+ ```python
123
+ from viz import Client
124
+
125
+ viz = Client("wss://node.viz.cx/ws")
126
+ viz.rpc.get_dynamic_global_properties()
127
+ ```
128
+
129
+ ## Installation
130
+
131
+ Current published version could be installed via
132
+
133
+ ```sh
134
+ pip install viz-python-lib
135
+ ```
136
+
137
+ Manual installation:
138
+
139
+ Install [poetry](https://python-poetry.org/docs/)
140
+
141
+ ```sh
142
+ cd viz-python-lib/
143
+ poetry install
144
+ ```
145
+
146
+ ## Development
147
+
148
+ ### Dependencies
149
+
150
+ #### Linux dependencies
151
+
152
+ ```sh
153
+ sudo apt-get install libffi-dev libssl-dev python3-dev
154
+ ```
155
+
156
+ #### Windows dependencies
157
+
158
+ Install regular version of [OpenSSL](https://slproweb.com/products/Win32OpenSSL.html) (not Light) suitable for your core processor.
159
+
160
+ #### MacOS dependencies
161
+
162
+ Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. This means that you will need to install and export some OpenSSL settings yourself, before you can install viz-python-lib:
163
+
164
+ ```sh
165
+ brew install openssl
166
+ ```
167
+
168
+ and then use the following commands:
169
+
170
+ ```sh
171
+ export CFLAGS="-I$(brew --prefix openssl)/include"
172
+ export LDFLAGS="-L$(brew --prefix openssl)/lib"
173
+ ```
174
+
@@ -0,0 +1,144 @@
1
+ # Python Library for [VIZ](https://github.com/VIZ-Blockchain)
2
+
3
+ ![Tests Status](https://github.com/VIZ-Blockchain/viz-python-lib/actions/workflows/tests.yml/badge.svg)
4
+ [![Documentation Status](https://readthedocs.org/projects/viz-python/badge/?version=latest)](https://viz-python.readthedocs.io/en/latest/?badge=latest)
5
+
6
+ ## Usage examples
7
+
8
+ ### Award someone
9
+
10
+ ```python
11
+ from viz import Client
12
+
13
+ node = "wss://node.viz.cx/ws"
14
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
15
+
16
+ initiator = "your_account"
17
+ receiver = "id"
18
+ percent = 10.5 # 10.5%
19
+ viz.award(receiver, percent, "with love", None, initiator)
20
+ ```
21
+
22
+ ### Award someone with fixed reward
23
+
24
+ ```python
25
+ from viz import Client
26
+
27
+ node = "wss://node.viz.cx/ws"
28
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
29
+
30
+ initiator = "your_account"
31
+ receiver = "id"
32
+ reward_amount = 3.5 # "3.50 VIZ"
33
+ max_energy = 30 # 30%
34
+ viz.fixed_award(receiver, reward_amount, max_energy, "with fixed reward", None, initiator)
35
+ ```
36
+
37
+ ### Send a custom operation
38
+
39
+ ```python
40
+ from viz import Client
41
+
42
+ node = "wss://node.viz.cx/ws"
43
+ viz = Client(node=node, keys=["5...your_private_regular_key..."])
44
+
45
+ account = "your_account"
46
+ required_regular_auths = [account]
47
+ protocol = "color.place"
48
+ custom_json = {"x": 35, "y": 70, "color": "#e50000"}
49
+ viz.custom(protocol, custom_json, None, required_regular_auths)
50
+ ```
51
+
52
+ ### Get data from custom protocol
53
+
54
+ ```python
55
+ from viz import Client
56
+ from viz.account import Account
57
+ from viz.block import Block
58
+ from viz.instance import set_shared_blockchain_instance
59
+ import json
60
+
61
+ viz = Client("wss://node.viz.cx/ws")
62
+ set_shared_blockchain_instance(viz)
63
+
64
+ account_name = "id"
65
+ protocol = "V"
66
+ account = Account(account_name, protocol=protocol)
67
+
68
+ counter_inside_protocol = account["custom_sequence"]
69
+ last_used_in_block = account["custom_sequence_block_num"]
70
+
71
+ block = Block(last_used_in_block)
72
+
73
+ for tx in block["transactions"]:
74
+ for op_type, op_data in tx["operations"]:
75
+ if op_type != "custom":
76
+ continue
77
+ if op_data.get("id") != protocol:
78
+ continue
79
+ if account_name not in op_data.get("required_regular_auths", []):
80
+ continue
81
+
82
+ raw_json = op_data.get("json")
83
+ try:
84
+ json_from_protocol = json.loads(raw_json) if raw_json else None
85
+ except json.JSONDecodeError:
86
+ json_from_protocol = None
87
+
88
+ print(json_from_protocol)
89
+ ```
90
+
91
+ ### Any direct RPC call
92
+
93
+ ```python
94
+ from viz import Client
95
+
96
+ viz = Client("wss://node.viz.cx/ws")
97
+ viz.rpc.get_dynamic_global_properties()
98
+ ```
99
+
100
+ ## Installation
101
+
102
+ Current published version could be installed via
103
+
104
+ ```sh
105
+ pip install viz-python-lib
106
+ ```
107
+
108
+ Manual installation:
109
+
110
+ Install [poetry](https://python-poetry.org/docs/)
111
+
112
+ ```sh
113
+ cd viz-python-lib/
114
+ poetry install
115
+ ```
116
+
117
+ ## Development
118
+
119
+ ### Dependencies
120
+
121
+ #### Linux dependencies
122
+
123
+ ```sh
124
+ sudo apt-get install libffi-dev libssl-dev python3-dev
125
+ ```
126
+
127
+ #### Windows dependencies
128
+
129
+ Install regular version of [OpenSSL](https://slproweb.com/products/Win32OpenSSL.html) (not Light) suitable for your core processor.
130
+
131
+ #### MacOS dependencies
132
+
133
+ Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. This means that you will need to install and export some OpenSSL settings yourself, before you can install viz-python-lib:
134
+
135
+ ```sh
136
+ brew install openssl
137
+ ```
138
+
139
+ and then use the following commands:
140
+
141
+ ```sh
142
+ export CFLAGS="-I$(brew --prefix openssl)/include"
143
+ export LDFLAGS="-L$(brew --prefix openssl)/lib"
144
+ ```
@@ -0,0 +1,106 @@
1
+ [build-system]
2
+ requires = ["poetry-core>=1.9.0"]
3
+ build-backend = "poetry.core.masonry.api"
4
+
5
+ [tool.poetry]
6
+ name = "viz-python-lib"
7
+ version = "1.2.0"
8
+ description = "Python library for VIZ blockchain"
9
+ authors = ["Vladimir Kamarzin <vvk@vvk.pp.ru>", "Vladimir Babin <vovababin@gmail.com>"]
10
+ license = "MIT"
11
+ readme = "README.md"
12
+ repository = "https://github.com/VIZ-Blockchain/viz-python-lib"
13
+ packages = [
14
+ { include = "viz" },
15
+ { include = "vizapi" },
16
+ { include = "vizbase" },
17
+ ]
18
+
19
+ keywords = ['viz', 'python', 'library', 'blockchain']
20
+
21
+ classifiers = [
22
+ "Development Status :: 4 - Beta",
23
+ "Intended Audience :: Developers",
24
+ "Operating System :: OS Independent",
25
+ "Topic :: Software Development :: Libraries :: Python Modules",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3.10",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
30
+ "Programming Language :: Python :: 3.13",
31
+ "Programming Language :: Python :: 3.14",
32
+ ]
33
+
34
+
35
+ [tool.poetry.dependencies]
36
+ python = "^3.10"
37
+ graphenelib = "^1.6.0"
38
+ toolz = "^0.12.0"
39
+ funcy = "^2.0"
40
+ aiohttp = ">=3.8,<4"
41
+ docker = "^7.1.0"
42
+
43
+
44
+ [tool.poetry.group.dev.dependencies]
45
+ pre-commit = "^3.6"
46
+ ruff = "^0.1"
47
+ mypy = "^1.8"
48
+ pytest = "^9.0"
49
+ pytest-cov = "^5.0"
50
+
51
+ sphinx = ">=4.0,<7.0"
52
+ sphinx-autoapi = "^1.8.0"
53
+ # used in docs to include markdown files
54
+ m2r2 = "^0.3.2"
55
+ # used in docs to parse pyproject.toml
56
+ tomlkit = "^0.11.8"
57
+
58
+
59
+ [tool.pytest.ini_options]
60
+ norecursedirs = ["*.egg", ".eggs", "dist", "build", "docs", ".tox", ".git", "__pycache__"]
61
+ addopts = [
62
+ "--strict-markers",
63
+ "--doctest-modules",
64
+ "--cov=viz",
65
+ "--cov=vizbase",
66
+ "--cov=vizapi",
67
+ "--cov-report=term:skip-covered",
68
+ "--cov-report=xml",
69
+ "--cov-branch",
70
+ ]
71
+
72
+
73
+ [tool.mypy]
74
+ ignore_missing_imports = true
75
+
76
+
77
+ [tool.ruff]
78
+ line-length = 120
79
+ target-version = "py310"
80
+
81
+
82
+ [tool.ruff.lint]
83
+ select = [
84
+ "E", "F", "W", # pycodestyle, pyflakes
85
+ "I", # isort
86
+ "B", # bugbear
87
+ "C4", # comprehensions
88
+ "UP", # pyupgrade
89
+ ]
90
+ ignore = [
91
+ "E501", # line-length handled by formatter
92
+ ]
93
+
94
+
95
+ [tool.ruff.lint.isort]
96
+ known-third-party = [
97
+ "Crypto",
98
+ "docker",
99
+ "grapheneapi",
100
+ "graphenebase",
101
+ "graphenecommon",
102
+ "graphenestorage",
103
+ "pytest",
104
+ "tomlkit",
105
+ "toolz",
106
+ ]
@@ -0,0 +1,3 @@
1
+ from .viz import Client
2
+
3
+ __all__ = ["Client"]
@@ -1,5 +1,7 @@
1
- from typing import TYPE_CHECKING, Generator, List, Optional, Union
1
+ from collections.abc import Generator
2
+ from typing import TYPE_CHECKING, Optional
2
3
  from warnings import warn
4
+
3
5
  from graphenecommon.exceptions import AccountDoesNotExistsException
4
6
  from toolz import dissoc
5
7
 
@@ -11,7 +13,7 @@ from .utils import json_expand, parse_time, time_elapsed
11
13
  if TYPE_CHECKING:
12
14
  from .viz import Client # noqa: F401
13
15
 
14
- HistoryGenerator = Generator[Union[dict, list], None, int]
16
+ HistoryGenerator = Generator[dict | list, None, int]
15
17
 
16
18
 
17
19
  class Account(dict):
@@ -23,11 +25,16 @@ class Account(dict):
23
25
  instance
24
26
  """
25
27
 
26
- def __init__(self, account_name: str, blockchain_instance: Optional['Client'] = None) -> None:
28
+ def __init__(
29
+ self,
30
+ account_name: str,
31
+ blockchain_instance: Optional["Client"] = None,
32
+ protocol: str = "",
33
+ ) -> None:
27
34
  self.blockchain_instance = blockchain_instance or shared_blockchain_instance()
28
35
  self.name = account_name
29
36
 
30
- self.refresh()
37
+ self.refresh(protocol)
31
38
 
32
39
  @property
33
40
  def balances(self):
@@ -38,18 +45,18 @@ class Account(dict):
38
45
  def energy(self):
39
46
  """Account energy at the moment of last use (stale)"""
40
47
  cfg = self.blockchain_instance.rpc.config
41
- return self['energy'] / cfg['CHAIN_1_PERCENT']
48
+ return self["energy"] / cfg["CHAIN_1_PERCENT"]
42
49
 
43
- def refresh(self):
50
+ def refresh(self, protocol: str = "") -> None:
44
51
  """Loads account object from blockchain."""
45
52
  try:
46
- account = self.blockchain_instance.rpc.get_accounts([self.name])[0]
47
- except IndexError:
48
- raise AccountDoesNotExistsException
53
+ account = self.blockchain_instance.rpc.get_account(self.name, protocol)
54
+ except Exception as err:
55
+ raise AccountDoesNotExistsException from err
49
56
 
50
57
  # load json_metadata
51
58
  account = json_expand(account, "json_metadata")
52
- super(Account, self).__init__(account)
59
+ super().__init__(account)
53
60
 
54
61
  def get_balances(self) -> dict:
55
62
  """
@@ -65,14 +72,14 @@ class Account(dict):
65
72
  def current_energy(self) -> float:
66
73
  """Returns current account energy (actual data, counts regenerated energy)"""
67
74
  self.refresh()
68
- last_vote_time = parse_time(self['last_vote_time'])
75
+ last_vote_time = parse_time(self["last_vote_time"])
69
76
  elapsed_time = time_elapsed(last_vote_time)
70
77
  cfg = self.blockchain_instance.rpc.config
71
78
  regenerated_energy = (
72
- cfg['CHAIN_100_PERCENT'] * elapsed_time.total_seconds() / cfg['CHAIN_ENERGY_REGENERATION_SECONDS']
79
+ cfg["CHAIN_100_PERCENT"] * elapsed_time.total_seconds() / cfg["CHAIN_ENERGY_REGENERATION_SECONDS"]
73
80
  )
74
- current_energy = self['energy'] + regenerated_energy
75
- energy = min(current_energy, cfg['CHAIN_100_PERCENT']) / cfg['CHAIN_1_PERCENT']
81
+ current_energy = self["energy"] + regenerated_energy
82
+ energy = min(current_energy, cfg["CHAIN_100_PERCENT"]) / cfg["CHAIN_1_PERCENT"]
76
83
 
77
84
  return energy
78
85
 
@@ -85,7 +92,7 @@ class Account(dict):
85
92
  else:
86
93
  return last_item
87
94
 
88
- def get_withdraw_routes(self, type_: str = 'all') -> dict:
95
+ def get_withdraw_routes(self, type_: str = "all") -> dict:
89
96
  """
90
97
  Get vesting withdraw routes.
91
98
 
@@ -111,10 +118,10 @@ class Account(dict):
111
118
  self,
112
119
  index: int,
113
120
  limit: int,
114
- start: Optional[int] = None,
115
- stop: Optional[int] = None,
121
+ start: int | None = None,
122
+ stop: int | None = None,
116
123
  order: int = -1,
117
- filter_by: Optional[Union[str, List[str]]] = None,
124
+ filter_by: str | list[str] | None = None,
118
125
  raw_output: bool = False,
119
126
  ) -> HistoryGenerator:
120
127
  """
@@ -155,7 +162,7 @@ class Account(dict):
155
162
  # removes specified key from dict
156
163
  block_props = dissoc(event, "op")
157
164
 
158
- def construct_op(account_name):
165
+ def construct_op(account_name, index, op_type, block_props, op, item):
159
166
  # verbatim output from steemd
160
167
  if raw_output:
161
168
  return item
@@ -170,14 +177,14 @@ class Account(dict):
170
177
  return immutable
171
178
 
172
179
  if filter_by is None or op_type in filter_by:
173
- yield construct_op(self.name)
180
+ yield construct_op(self.name, index, op_type, block_props, op, item)
174
181
  op_count += 1
175
182
 
176
183
  return op_count
177
184
 
178
185
  def history(
179
186
  self,
180
- filter_by: Optional[Union[str, List[str]]] = None,
187
+ filter_by: str | list[str] | None = None,
181
188
  start: int = 0,
182
189
  batch_size: int = 1000,
183
190
  raw_output: bool = False,
@@ -186,7 +193,7 @@ class Account(dict):
186
193
  """
187
194
  THIS FUNCTION IS DEPRECATED. PLEASE USE :py:func:`history_reverse` INSTEAD.
188
195
 
189
- Stream account history in chronological order.
196
+ Stream account history in chronological order.
190
197
 
191
198
  This generator yields history items which may be in list or dict form depending on ``raw_output``.
192
199
  Output is similar to :py:func:`history_reverse`.
@@ -200,7 +207,11 @@ class Account(dict):
200
207
  This is a rough limit, actual results could be a bit longer
201
208
  :return: number of ops
202
209
  """
203
- warn("Function `history` is not recommened. Use `history_reverse` instead.", DeprecationWarning, stacklevel=2)
210
+ warn(
211
+ "Function `history` is not recommened. Use `history_reverse` instead.",
212
+ DeprecationWarning,
213
+ stacklevel=2,
214
+ )
204
215
 
205
216
  op_count = 0
206
217
 
@@ -230,7 +241,7 @@ class Account(dict):
230
241
 
231
242
  def history_reverse(
232
243
  self,
233
- filter_by: Optional[Union[str, List[str]]] = None,
244
+ filter_by: str | list[str] | None = None,
234
245
  batch_size: int = 1000,
235
246
  raw_output: bool = False,
236
247
  limit: int = -1,
@@ -297,7 +308,11 @@ class Account(dict):
297
308
  if i - batch_size < 0:
298
309
  batch_size = i
299
310
  count = yield from self.get_account_history(
300
- index=i, limit=batch_size, order=-1, filter_by=filter_by, raw_output=raw_output,
311
+ index=i,
312
+ limit=batch_size,
313
+ order=-1,
314
+ filter_by=filter_by,
315
+ raw_output=raw_output,
301
316
  )
302
317
  i -= batch_size + 1
303
318
  op_count += count
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenecommon.block import Block as GrapheneBlock
3
2
  from graphenecommon.block import BlockHeader as GrapheneBlockHeader
4
3
 
@@ -1,8 +1,7 @@
1
- # -*- coding: utf-8 -*-
2
1
  import hashlib
3
2
  import json
4
3
  import time
5
- from typing import Iterator, List, Optional, Union
4
+ from collections.abc import Iterator
6
5
 
7
6
  from graphenecommon.blockchain import Blockchain as GrapheneBlockchain
8
7
 
@@ -43,8 +42,8 @@ class Blockchain(GrapheneBlockchain):
43
42
 
44
43
  def stream_from(
45
44
  self,
46
- start_block: Optional[int] = None,
47
- end_block: Optional[int] = None,
45
+ start_block: int | None = None,
46
+ end_block: int | None = None,
48
47
  batch_operations: bool = False,
49
48
  full_blocks: bool = False,
50
49
  only_virtual_ops: bool = False,
@@ -109,9 +108,9 @@ class Blockchain(GrapheneBlockchain):
109
108
 
110
109
  def stream(
111
110
  self,
112
- filter_by: Optional[Union[str, List[str]]] = None,
113
- start_block: Optional[int] = None,
114
- end_block: Optional[int] = None,
111
+ filter_by: str | list[str] | None = None,
112
+ start_block: int | None = None,
113
+ end_block: int | None = None,
115
114
  raw_output: bool = False,
116
115
  ) -> Iterator[dict]:
117
116
  """
@@ -201,7 +200,6 @@ class Blockchain(GrapheneBlockchain):
201
200
  for op in self.stream_from(
202
201
  full_blocks=False, only_virtual_ops=only_virtual_ops, start_block=start_block, end_block=end_block
203
202
  ):
204
-
205
203
  if not filter_by or op["op"][0] in filter_by:
206
204
  if raw_output:
207
205
  yield op
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenecommon.blockchainobject import BlockchainObject as GrapheneBlockchainObject
3
2
  from graphenecommon.blockchainobject import Object as GrapheneChainObject
4
3
 
@@ -2,7 +2,7 @@ from .amount import Amount
2
2
  from .instance import shared_blockchain_instance
3
3
 
4
4
 
5
- class Converter(object):
5
+ class Converter:
6
6
  """
7
7
  Converter simplifies the handling of different metrics of the blockchain.
8
8
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  class BaseException(Exception):
3
2
  """Base excepsion class."""
4
3
 
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  from graphenecommon.instance import AbstractBlockchainInstanceProvider
3
2
 
4
3