Skip to content

Commit fee5bcc

Browse files
authored
Merge pull request #499 from multiversx/remove-pretty-table
Removed prettytable dependency
2 parents 637280e + a0a2db4 commit fee5bcc

4 files changed

Lines changed: 21 additions & 19 deletions

File tree

multiversx_sdk_cli/cli_dns.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from typing import Any
22

33
from multiversx_sdk import ProxyNetworkProvider
4-
from prettytable import PrettyTable
4+
from rich.console import Console
5+
from rich.table import Table
56

67
from multiversx_sdk_cli import cli_shared
78
from multiversx_sdk_cli.config import get_config_for_network_providers
@@ -179,27 +180,33 @@ def get_version(args: Any):
179180
config = get_config_for_network_providers()
180181
proxy = ProxyNetworkProvider(url=args.proxy, config=config)
181182
if args.all:
182-
t = PrettyTable(
183-
[
184-
"Shard ID",
185-
"Contract address (bech32)",
186-
"Contract address (hex)",
187-
"Version",
188-
]
189-
)
183+
table = Table(title="DNS Version")
184+
table.add_column("Shard ID")
185+
table.add_column("Contract address (bech32)")
186+
table.add_column("Contract address (hex)")
187+
table.add_column("Version")
188+
190189
for shard_id in range(0, 256):
191190
address = compute_dns_address_for_shard_id(shard_id)
192191
v = version(shard_id, proxy)
193-
t.add_row([shard_id, address.to_bech32(), address.to_hex(), v]) # type: ignore
194-
print(t)
192+
table.add_row(str(shard_id), address.to_bech32(), address.to_hex(), v)
193+
194+
console = Console()
195+
console.print(table)
195196
else:
196197
shard_id = int(args.shard_id)
197198
print(version(shard_id, proxy))
198199

199200

200201
def print_dns_addresses_table(args: Any):
201-
t = PrettyTable(["Shard ID", "Contract address (bech32)", "Contract address (hex)"])
202+
table = Table(title="DNS Addresses")
203+
table.add_column("Shard ID")
204+
table.add_column("Contract address (bech32)")
205+
table.add_column("Contract address (hex)")
206+
202207
for shard_id in range(0, 256):
203208
address = compute_dns_address_for_shard_id(shard_id)
204-
t.add_row([shard_id, address.to_bech32(), address.to_hex()]) # type: ignore
205-
print(t)
209+
table.add_row(str(shard_id), address.to_bech32(), address.to_hex())
210+
211+
console = Console()
212+
console.print(table)

mypy.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,5 @@ ignore_missing_imports = True
99
[mypy-ledgercomm.*]
1010
ignore_missing_imports = True
1111

12-
[mypy-prettytable.*]
13-
ignore_missing_imports = True
14-
1512
[mypy-semver.*]
1613
ignore_missing_imports = True

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ classifiers = [
2222
dependencies = [
2323
"toml>=0.10.2",
2424
"requests>=2.32.0,<3.0.0",
25-
"prettytable",
2625
"ledgercomm[hid]",
2726
"rich==13.3.4",
2827
"argcomplete==3.2.2",

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ toml>=0.10.2
22
types-toml
33
requests>=2.32.0,<3.0.0
44
types-requests
5-
prettytable
65
ledgercomm[hid]
76
rich==13.3.4
87
argcomplete==3.2.2

0 commit comments

Comments
 (0)