centralcli 7.3.2__tar.gz → 7.3.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 (66) hide show
  1. {centralcli-7.3.2 → centralcli-7.3.4}/PKG-INFO +2 -1
  2. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cache.py +61 -60
  3. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cliadd.py +2 -0
  4. centralcli-7.3.4/centralcli/typedefs.py +28 -0
  5. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/utils.py +4 -2
  6. {centralcli-7.3.2 → centralcli-7.3.4}/pyproject.toml +2 -1
  7. centralcli-7.3.2/centralcli/typedefs.py +0 -13
  8. {centralcli-7.3.2 → centralcli-7.3.4}/LICENSE +0 -0
  9. {centralcli-7.3.2 → centralcli-7.3.4}/README.md +0 -0
  10. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/__init__.py +0 -0
  11. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/boilerplate/README.md +0 -0
  12. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/boilerplate/_cnx_allcalls.py +0 -0
  13. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/boilerplate/allcalls.py +0 -0
  14. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/caas.py +0 -0
  15. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/central.py +0 -0
  16. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cleaner.py +0 -0
  17. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cli.py +0 -0
  18. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cliassign.py +0 -0
  19. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clibatch.py +0 -0
  20. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clicaas.py +0 -0
  21. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clicancel.py +0 -0
  22. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clicheck.py +0 -0
  23. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cliclone.py +0 -0
  24. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clicommon.py +0 -0
  25. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clidel.py +0 -0
  26. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clidelfirmware.py +0 -0
  27. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cliexport.py +0 -0
  28. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clikick.py +0 -0
  29. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clioptions.py +0 -0
  30. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clirefresh.py +0 -0
  31. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clirename.py +0 -0
  32. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cliset.py +0 -0
  33. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clisetfirmware.py +0 -0
  34. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishow.py +0 -0
  35. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowaudit.py +0 -0
  36. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowbandwidth.py +0 -0
  37. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowbranch.py +0 -0
  38. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowcloudauth.py +0 -0
  39. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowfirmware.py +0 -0
  40. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowmpsk.py +0 -0
  41. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowospf.py +0 -0
  42. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowoverlay.py +0 -0
  43. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowtshoot.py +0 -0
  44. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clishowwids.py +0 -0
  45. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clitest.py +0 -0
  46. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/clitshoot.py +0 -0
  47. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cliunassign.py +0 -0
  48. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cliupdate.py +0 -0
  49. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/cliupgrade.py +0 -0
  50. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/config.py +0 -0
  51. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/constants.py +0 -0
  52. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/exceptions.py +0 -0
  53. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/logger.py +0 -0
  54. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/models.py +0 -0
  55. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/objects.py +0 -0
  56. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/render.py +0 -0
  57. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/response.py +0 -0
  58. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/setup.py +0 -0
  59. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/static/favicon.ico +0 -0
  60. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/strings.py +0 -0
  61. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/vendored/csvlexer/__init__.py +0 -0
  62. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/vendored/csvlexer/csv.py +0 -0
  63. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/vscodeargs.py +0 -0
  64. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/wh2snow.py +0 -0
  65. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/wh_proxy.py +0 -0
  66. {centralcli-7.3.2 → centralcli-7.3.4}/centralcli/wh_proxy_service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: centralcli
3
- Version: 7.3.2
3
+ Version: 7.3.4
4
4
  Summary: A CLI for interacting with Aruba Central (Cloud Management Platform). Facilitates bulk imports, exports, reporting. A handy tool if you have devices managed by Aruba Central.
5
5
  Home-page: https://github.com/Pack3tL0ss/central-api-cli
6
6
  License: MIT
@@ -27,6 +27,7 @@ Requires-Dist: aiohttp (>=3)
27
27
  Requires-Dist: asyncio (>=3)
28
28
  Requires-Dist: brotlicffi ; (platform_python_implementation != "CPython") and (extra == "speedups")
29
29
  Requires-Dist: click (<=7.1.2)
30
+ Requires-Dist: eval_type_backport ; python_version < "3.10"
30
31
  Requires-Dist: fastapi ; extra == "hook-proxy"
31
32
  Requires-Dist: fuzzywuzzy
32
33
  Requires-Dist: ipaddress
@@ -5,27 +5,27 @@ from __future__ import annotations
5
5
 
6
6
  import asyncio
7
7
  import time
8
+ from collections.abc import Iterator
9
+ from copy import deepcopy
8
10
  from enum import Enum
9
11
  from pathlib import Path
10
- from typing import Any, Dict, Iterable, List, Literal, Sequence, Set, Union, Generator, Tuple, Callable, Optional, TYPE_CHECKING
12
+ from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, List, Literal, Optional, Sequence, Set, Tuple, Union
11
13
 
12
14
  import typer
13
15
  from rich import print
14
16
  from rich.console import Console
15
17
  from tinydb import Query, TinyDB
16
- from copy import deepcopy
18
+ from tinydb.table import Document
19
+ from yarl import URL
17
20
 
18
21
  from centralcli import CentralApi, Response, config, constants, log, models, render, utils
19
22
  from centralcli.response import CombinedResponse
20
- from .typedefs import SiteData
21
- from tinydb.table import Document
22
- from yarl import URL
23
+
23
24
 
24
25
  if TYPE_CHECKING:
25
26
  from tinydb.table import Table
26
27
  from .config import Config
27
- from .typedefs import PortalAuthTypes
28
-
28
+ from .typedefs import PortalAuthTypes, SiteData
29
29
 
30
30
  try:
31
31
  import readline # noqa imported for backspace support during prompt.
@@ -771,7 +771,8 @@ class Cache:
771
771
  if refresh:
772
772
  self.check_fresh(refresh)
773
773
 
774
- def __iter__(self) -> Generator[Tuple[str, List[Document]], None, None]:
774
+ # def __iter__(self) -> Iterator[Tuple[str, List[Document]]]:
775
+ def __iter__(self) -> Iterator[Tuple[str, List[Document]]]:
775
776
  yield from self.all_tables
776
777
 
777
778
  def __len__(self) -> int:
@@ -816,12 +817,12 @@ class Cache:
816
817
  return human_size(db_stats.st_size)
817
818
 
818
819
  @property
819
- def all_tables(self) -> Generator[Table, None, None]:
820
+ def all_tables(self) -> Iterator[Table, None, None]:
820
821
  for table in self.DevDB.tables():
821
822
  yield self.DevDB.table(table)
822
823
 
823
824
  @property
824
- def key_tables(self) -> Generator[Table, None, None]:
825
+ def key_tables(self) -> Iterator[Table, None, None]:
825
826
  for table in self._tables:
826
827
  yield table
827
828
 
@@ -1194,7 +1195,7 @@ class Cache:
1194
1195
  self,
1195
1196
  incomplete: str,
1196
1197
  args: List[str] = [],
1197
- ) -> Generator[Tuple[str, str], None, None] | None:
1198
+ ) -> Iterator[Tuple[str, str]]:
1198
1199
  """Device completion for returning matches that are switches (AOS-SW or CX)
1199
1200
 
1200
1201
  Args:
@@ -1202,7 +1203,7 @@ class Cache:
1202
1203
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
1203
1204
 
1204
1205
  Yields:
1205
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1206
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1206
1207
  Returns None if config is invalid
1207
1208
  """
1208
1209
  # Prevents exception during completion when config missing or invalid
@@ -1227,7 +1228,7 @@ class Cache:
1227
1228
  incomplete: str,
1228
1229
  args: List[str] = [],
1229
1230
  dev_type: Literal["cx", "sw"] = "cx",
1230
- ) -> Generator[Tuple[str, str], None, None] | None:
1231
+ ) -> Iterator[Tuple[str, str]]:
1231
1232
  """Device completion for returning matches that are of specific switch type (cx by default)
1232
1233
 
1233
1234
  Args:
@@ -1235,7 +1236,7 @@ class Cache:
1235
1236
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
1236
1237
 
1237
1238
  Yields:
1238
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1239
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1239
1240
  Returns None if config is invalid
1240
1241
  """
1241
1242
  # Prevents exception during completion when config missing or invalid
@@ -1259,7 +1260,7 @@ class Cache:
1259
1260
  self,
1260
1261
  incomplete: str,
1261
1262
  args: List[str] = [],
1262
- ) -> Generator[Tuple[str, str], None, None] | None:
1263
+ ) -> Iterator[Tuple[str, str]]:
1263
1264
  for match in self.dev_switch_by_type_completion(incomplete=incomplete, args=args, dev_type="cx"):
1264
1265
  yield match
1265
1266
 
@@ -1267,7 +1268,7 @@ class Cache:
1267
1268
  self,
1268
1269
  incomplete: str,
1269
1270
  args: List[str] = [],
1270
- ) -> Generator[Tuple[str, str], None, None] | None:
1271
+ ) -> Iterator[Tuple[str, str]]:
1271
1272
  for match in self.dev_switch_by_type_completion(incomplete=incomplete, args=args, dev_type="sw"):
1272
1273
  yield match
1273
1274
 
@@ -1275,7 +1276,7 @@ class Cache:
1275
1276
  self,
1276
1277
  incomplete: str,
1277
1278
  args: List[str] = [],
1278
- ) -> Generator[Tuple[str, str], None, None] | None:
1279
+ ) -> Iterator[Tuple[str, str]]:
1279
1280
  """Device completion for returning matches that are ap, gw, or AOS-SW
1280
1281
 
1281
1282
  Args:
@@ -1283,7 +1284,7 @@ class Cache:
1283
1284
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
1284
1285
 
1285
1286
  Yields:
1286
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1287
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1287
1288
  Returns None if config is invalid
1288
1289
  """
1289
1290
  # Prevents exception during completion when config missing or invalid
@@ -1376,7 +1377,7 @@ class Cache:
1376
1377
  ctx: typer.Context,
1377
1378
  incomplete: str,
1378
1379
  args: List[str] = None,
1379
- ) -> Generator[Tuple[str, str], None, None] | None:
1380
+ ) -> Iterator[Tuple[str, str]]:
1380
1381
  """Completion for commands that allow a list of devices followed by group/site.
1381
1382
 
1382
1383
  i.e. cencli move dev1 dev2 dev3 site site_name group group_name
@@ -1387,7 +1388,7 @@ class Cache:
1387
1388
  args (List[str], optional): The prev args passed into the command.
1388
1389
 
1389
1390
  Yields:
1390
- Generator[Tuple[str, str], None, None]: Matching completion string, help text, or
1391
+ Iterator[Tuple[str, str]]: Matching completion string, help text, or
1391
1392
  Returns None if config is invalid
1392
1393
  """
1393
1394
  # Prevents exception during completion when config missing or invalid
@@ -1446,7 +1447,7 @@ class Cache:
1446
1447
  # ctx: typer.Context,
1447
1448
  incomplete: str,
1448
1449
  args: List[str] = None,
1449
- ) -> Generator[Tuple[str, str], None, None] | None:
1450
+ ) -> Iterator[Tuple[str, str]]:
1450
1451
  """Completion for argument where only APs are valid.
1451
1452
 
1452
1453
  Args:
@@ -1454,7 +1455,7 @@ class Cache:
1454
1455
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1455
1456
 
1456
1457
  Yields:
1457
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1458
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1458
1459
  Returns None if config is invalid
1459
1460
  """
1460
1461
  # Prevents exception during completion when config missing or invalid
@@ -1491,7 +1492,7 @@ class Cache:
1491
1492
  ctx: typer.Context,
1492
1493
  incomplete: str,
1493
1494
  args: List[str] = [],
1494
- ) -> Generator[Tuple[str, str], None, None] | None:
1495
+ ) -> Iterator[Tuple[str, str]]:
1495
1496
  """Completion for client output.
1496
1497
 
1497
1498
  Returns only devices that apply based on filter provided in command, defaults to clients
@@ -1503,7 +1504,7 @@ class Cache:
1503
1504
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
1504
1505
 
1505
1506
  Yields:
1506
- Generator[Tuple[str, str], None, None]: Tuple with completion and help text, or
1507
+ Iterator[Tuple[str, str]]: Tuple with completion and help text, or
1507
1508
  Returns None if config is invalid
1508
1509
  """
1509
1510
  # Prevents exception during completion when config missing or invalid
@@ -1527,7 +1528,7 @@ class Cache:
1527
1528
  self,
1528
1529
  incomplete: str,
1529
1530
  args: List[str] = [],
1530
- ) -> Generator[Tuple[str, str], None, None] | None:
1531
+ ) -> Iterator[Tuple[str, str]]:
1531
1532
  """Device completion for returning matches that are either switch or AP
1532
1533
 
1533
1534
  Args:
@@ -1535,7 +1536,7 @@ class Cache:
1535
1536
  args (List[str], optional): The previous arguments/commands on CLI.
1536
1537
 
1537
1538
  Yields:
1538
- Generator[Tuple[str, str], None, None]: Yields Tuple with completion and help text, or
1539
+ Iterator[Tuple[str, str]]: Yields Tuple with completion and help text, or
1539
1540
  Returns None if config is invalid
1540
1541
  """
1541
1542
  # Prevents exception during completion when config missing or invalid
@@ -1560,7 +1561,7 @@ class Cache:
1560
1561
  ctx: typer.Context,
1561
1562
  incomplete: str,
1562
1563
  args: List[str] = None,
1563
- ) -> Generator[Tuple[str, str], None, None] | None:
1564
+ ) -> Iterator[Tuple[str, str]]:
1564
1565
  """Device completion that returns only ap and gw.
1565
1566
 
1566
1567
  Args:
@@ -1568,7 +1569,7 @@ class Cache:
1568
1569
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1569
1570
 
1570
1571
  Yields:
1571
- Generator[Tuple[str, str], None, None]: Yields Tuple with completion and help text, or
1572
+ Iterator[Tuple[str, str]]: Yields Tuple with completion and help text, or
1572
1573
  Returns None if config is invalid
1573
1574
  """
1574
1575
  # Prevents exception during completion when config missing or invalid
@@ -1602,7 +1603,7 @@ class Cache:
1602
1603
  self,
1603
1604
  incomplete: str,
1604
1605
  args: List[str] = None,
1605
- ) -> Generator[Tuple[str, str], None, None] | None:
1606
+ ) -> Iterator[Tuple[str, str]]:
1606
1607
  """Device completion that returns only switches and gateways.
1607
1608
 
1608
1609
  Args:
@@ -1610,7 +1611,7 @@ class Cache:
1610
1611
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1611
1612
 
1612
1613
  Yields:
1613
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1614
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1614
1615
  Returns None if config is invalid
1615
1616
  """
1616
1617
  # Prevents exception during completion when config missing or invalid
@@ -1634,7 +1635,7 @@ class Cache:
1634
1635
  self,
1635
1636
  incomplete: str,
1636
1637
  args: List[str] = None,
1637
- ) -> Generator[Tuple[str, str], None, None] | None:
1638
+ ) -> Iterator[Tuple[str, str]]:
1638
1639
  """Completion for device idens where only gateways are valid.
1639
1640
 
1640
1641
  Args:
@@ -1642,7 +1643,7 @@ class Cache:
1642
1643
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1643
1644
 
1644
1645
  Yields:
1645
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1646
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1646
1647
  Returns None if config is invalid
1647
1648
  """
1648
1649
  # Prevents exception during completion when config missing or invalid
@@ -1669,7 +1670,7 @@ class Cache:
1669
1670
  dev_type: constants.LibAllDevTypes | List[constants.LibAllDevTypes] = None,
1670
1671
  conductor_only: bool = False,
1671
1672
  args: List[str] = None,
1672
- ) -> Generator[Tuple[str, str], None, None] | None:
1673
+ ) -> Iterator[Tuple[str, str]]:
1673
1674
  """Completion for argument that can be either group or device.
1674
1675
 
1675
1676
  Args:
@@ -1681,7 +1682,7 @@ class Cache:
1681
1682
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1682
1683
 
1683
1684
  Yields:
1684
- Generator[Tuple[str, str], None, None] | None: Name and help_text for the device, or
1685
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1685
1686
  Returns None if config is invalid
1686
1687
  """
1687
1688
  # Prevents exception during completion when config missing or invalid
@@ -1727,7 +1728,7 @@ class Cache:
1727
1728
  ctx: typer.Context,
1728
1729
  incomplete: str,
1729
1730
  args: List[str] = None,
1730
- ) -> Generator[Tuple[str, str], None, None] | None:
1731
+ ) -> Iterator[Tuple[str, str]]:
1731
1732
  """Completion for argument that can be either group or device.
1732
1733
 
1733
1734
  Args:
@@ -1736,7 +1737,7 @@ class Cache:
1736
1737
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1737
1738
 
1738
1739
  Yields:
1739
- Generator[Tuple[str, str], None, None] | None: Name and help_text for the device, or
1740
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1740
1741
  Returns None if config is invalid
1741
1742
  """
1742
1743
  # Prevents exception during completion when config missing or invalid
@@ -1751,7 +1752,7 @@ class Cache:
1751
1752
  ctx: typer.Context,
1752
1753
  incomplete: str,
1753
1754
  args: List[str] = None,
1754
- ) -> Generator[Tuple[str, str], None, None] | None:
1755
+ ) -> Iterator[Tuple[str, str]]:
1755
1756
  """Completion for argument that can be either group or device.
1756
1757
 
1757
1758
  Args:
@@ -1759,7 +1760,7 @@ class Cache:
1759
1760
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1760
1761
 
1761
1762
  Yields:
1762
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1763
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1763
1764
  Returns None if config is invalid
1764
1765
  """
1765
1766
  # Prevents exception during completion when config missing or invalid
@@ -1795,7 +1796,7 @@ class Cache:
1795
1796
  self,
1796
1797
  incomplete: str,
1797
1798
  args: List[str] = None,
1798
- ) -> Generator[Tuple[str, str], None, None] | None:
1799
+ ) -> Iterator[Tuple[str, str]]:
1799
1800
  """Completion for argument that can be either group or a gateway.
1800
1801
 
1801
1802
  Args:
@@ -1803,7 +1804,7 @@ class Cache:
1803
1804
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1804
1805
 
1805
1806
  Yields:
1806
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1807
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1807
1808
  Returns None if config is invalid
1808
1809
  """
1809
1810
  # Prevents exception during completion when config missing or invalid
@@ -1828,7 +1829,7 @@ class Cache:
1828
1829
  ctx: typer.Context,
1829
1830
  incomplete: str,
1830
1831
  args: List[str] = [],
1831
- ) -> Generator[Tuple[str, str], None, None] | None:
1832
+ ) -> Iterator[Tuple[str, str]]:
1832
1833
  """Completion for argument that can be either group, site, or a gateway or keyword "commands".
1833
1834
 
1834
1835
  Args:
@@ -1836,7 +1837,7 @@ class Cache:
1836
1837
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
1837
1838
 
1838
1839
  Yields:
1839
- Generator[Tuple[str, str], None, None]: Name and help_text for the device, or
1840
+ Iterator[Tuple[str, str]]: Name and help_text for the device, or
1840
1841
  Returns None if config is invalid
1841
1842
  """
1842
1843
  # Prevents exception during completion when config missing or invalid
@@ -1874,7 +1875,7 @@ class Cache:
1874
1875
  self,
1875
1876
  incomplete: str,
1876
1877
  args: List[str] = [],
1877
- ) -> Generator[Tuple[str, str], None, None] | None:
1878
+ ) -> Iterator[Tuple[str, str]]:
1878
1879
  """Completion for groups (by name).
1879
1880
 
1880
1881
  Args:
@@ -1882,7 +1883,7 @@ class Cache:
1882
1883
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
1883
1884
 
1884
1885
  Yields:
1885
- Generator[Tuple[str, str], None, None]: Name and help_text for the group, or
1886
+ Iterator[Tuple[str, str]]: Name and help_text for the group, or
1886
1887
  Returns None if config is invalid
1887
1888
  """
1888
1889
  # Prevents exception during completion when config missing or invalid
@@ -1910,7 +1911,7 @@ class Cache:
1910
1911
  ctx: typer.Context,
1911
1912
  incomplete: str,
1912
1913
  args: List[str] = [],
1913
- ) -> Generator[Tuple[str, str], None, None] | None:
1914
+ ) -> Iterator[Tuple[str, str]]:
1914
1915
  """Completion for labels.
1915
1916
 
1916
1917
  Args:
@@ -1918,7 +1919,7 @@ class Cache:
1918
1919
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
1919
1920
 
1920
1921
  Yields:
1921
- Generator[Tuple[str, str], None, None]: Name and help_text for the label, or
1922
+ Iterator[Tuple[str, str]]: Name and help_text for the label, or
1922
1923
  Returns None if config is invalid
1923
1924
  """
1924
1925
  # Prevents exception during completion when config missing or invalid
@@ -1945,7 +1946,7 @@ class Cache:
1945
1946
  self,
1946
1947
  incomplete: str,
1947
1948
  args: List[str] = None,
1948
- ) -> Generator[Tuple[str, str], None, None] | None:
1949
+ ) -> Iterator[Tuple[str, str]]:
1949
1950
  """Completion for clients.
1950
1951
 
1951
1952
  Args:
@@ -1953,7 +1954,7 @@ class Cache:
1953
1954
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
1954
1955
 
1955
1956
  Yields:
1956
- Generator[Tuple[str, str], None, None]: Name and help_text for the client, or
1957
+ Iterator[Tuple[str, str]]: Name and help_text for the client, or
1957
1958
  Returns None if config is invalid
1958
1959
  """
1959
1960
  # Prevents exception during completion when config missing or invalid
@@ -1988,7 +1989,7 @@ class Cache:
1988
1989
  self,
1989
1990
  incomplete: str,
1990
1991
  args: List[str] = None,
1991
- ) -> Generator[Tuple[str, str], None, None] | None:
1992
+ ) -> Iterator[Tuple[str, str]]:
1992
1993
  """Completion for events.
1993
1994
 
1994
1995
  Args:
@@ -1996,7 +1997,7 @@ class Cache:
1996
1997
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
1997
1998
 
1998
1999
  Yields:
1999
- Generator[Tuple[str, str], None, None]: Value and help_text for the event, or
2000
+ Iterator[Tuple[str, str]]: Value and help_text for the event, or
2000
2001
  Returns None if config is invalid
2001
2002
  """
2002
2003
  # Prevents exception during completion when config missing or invalid
@@ -2020,7 +2021,7 @@ class Cache:
2020
2021
  self,
2021
2022
  incomplete: str,
2022
2023
  args: List[str] = None,
2023
- ) -> Generator[Tuple[str, str], None, None] | None:
2024
+ ) -> Iterator[Tuple[str, str]]:
2024
2025
  """Completion for audit event logs.
2025
2026
 
2026
2027
  Args:
@@ -2028,7 +2029,7 @@ class Cache:
2028
2029
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to [].
2029
2030
 
2030
2031
  Yields:
2031
- Generator[Tuple[str, str], None, None]: Value and help_text for the event, or
2032
+ Iterator[Tuple[str, str]]: Value and help_text for the event, or
2032
2033
  Returns None if config is invalid
2033
2034
  """
2034
2035
  # Prevents exception during completion when config missing or invalid
@@ -2050,7 +2051,7 @@ class Cache:
2050
2051
  ctx: typer.Context,
2051
2052
  incomplete: str,
2052
2053
  args: List[str] = None,
2053
- ) -> Generator[Tuple[str, str], None, None] | None:
2054
+ ) -> Iterator[Tuple[str, str]]:
2054
2055
  """Completion for sites.
2055
2056
 
2056
2057
  Args:
@@ -2058,7 +2059,7 @@ class Cache:
2058
2059
  args (List[str], optional): The previous arguments/commands on CLI. Defaults to None.
2059
2060
 
2060
2061
  Yields:
2061
- Generator[Tuple[str, str], None, None]: Name and help_text for the site, or
2062
+ Iterator[Tuple[str, str]]: Name and help_text for the site, or
2062
2063
  Returns None if config is invalid
2063
2064
  """
2064
2065
  # Prevents exception during completion when config missing or invalid
@@ -2090,7 +2091,7 @@ class Cache:
2090
2091
  self,
2091
2092
  incomplete: str,
2092
2093
  args: List[str] = None,
2093
- ) -> Generator[Tuple[str, str], None, None] | None:
2094
+ ) -> Iterator[Tuple[str, str]]:
2094
2095
  # Prevents exception during completion when config missing or invalid
2095
2096
  if not config.valid:
2096
2097
  econsole.print(":warning: Invalid config")
@@ -2113,7 +2114,7 @@ class Cache:
2113
2114
  self,
2114
2115
  incomplete: str,
2115
2116
  args: List[str] = None,
2116
- ) -> Generator[Tuple[str, str], None, None] | None:
2117
+ ) -> Iterator[Tuple[str, str]]:
2117
2118
  # Prevents exception during completion when config missing or invalid
2118
2119
  if not config.valid:
2119
2120
  econsole.print(":warning: Invalid config")
@@ -2153,7 +2154,7 @@ class Cache:
2153
2154
  self,
2154
2155
  incomplete: str,
2155
2156
  args: List[str] = None,
2156
- ) -> Generator[Tuple[str, str], None, None] | None:
2157
+ ) -> Iterator[Tuple[str, str]]:
2157
2158
  # Prevents exception during completion when config missing or invalid
2158
2159
  if not config.valid:
2159
2160
  econsole.print(":warning: Invalid config")
@@ -2184,7 +2185,7 @@ class Cache:
2184
2185
  ctx: typer.Context,
2185
2186
  incomplete: str,
2186
2187
  args: List[str] = None,
2187
- ) -> Generator[Tuple[str, str], None, None] | None:
2188
+ ) -> Iterator[Tuple[str, str]]:
2188
2189
  # Prevents exception during completion when config missing or invalid
2189
2190
  if not config.valid:
2190
2191
  econsole.print(":warning: Invalid config")
@@ -2214,7 +2215,7 @@ class Cache:
2214
2215
  self,
2215
2216
  incomplete: str,
2216
2217
  args: List[str] = None,
2217
- ) -> Generator[Tuple[str, str], None, None] | None:
2218
+ ) -> Iterator[Tuple[str, str]]:
2218
2219
  # Prevents exception during completion when config missing or invalid
2219
2220
  if not config.valid:
2220
2221
  econsole.print(":warning: Invalid config")
@@ -2243,7 +2244,7 @@ class Cache:
2243
2244
  self,
2244
2245
  incomplete: str,
2245
2246
  args: List[str],
2246
- ) -> Generator[Tuple[str, str], None, None] | None:
2247
+ ) -> Iterator[Tuple[str, str]]:
2247
2248
  # Prevents exception during completion when config missing or invalid
2248
2249
  if not config.valid:
2249
2250
  econsole.print(":warning: Invalid config")
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env python3
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
+ from __future__ import annotations
5
+
4
6
  from enum import Enum
5
7
  from pathlib import Path
6
8
  import sys
@@ -0,0 +1,28 @@
1
+ from yarl import URL
2
+ from typing import Union, Literal, List, Dict # future annotations does not work here, need to use Union to support py < 3.10
3
+
4
+
5
+
6
+ StrOrURL = Union[str, URL]
7
+ Method = Literal['GET', 'POST', 'PUT', 'DELETE']
8
+ SiteData = Union[
9
+ List[
10
+ Dict[
11
+ str,
12
+ Union[
13
+ str, int, float
14
+ ]
15
+ ]
16
+ ],
17
+ Dict[
18
+ str,
19
+ Union[
20
+ str,
21
+ int,
22
+ float
23
+ ]
24
+ ]
25
+ ]
26
+ PortalAuthType = Literal["user/pass", "anon", "self-reg"]
27
+ PortalAuthTypes = List[PortalAuthType]
28
+ CacheTableName = Literal["devices", "sites", "groups", "labels", "macs", "mpsk"]
@@ -675,10 +675,12 @@ class Utils:
675
675
 
676
676
  if isinstance(text, str):
677
677
  color = get_color_str(color_str)
678
- return f"{' ' if pad_len else '':{pad_len}}[{color}]{text}[/{color}]"
678
+ text = f"{' ' if pad_len else '':{pad_len or 1}}[{color}]{text}[/{color}]"
679
+ return text if not pad_len else text.lstrip() # workaround for py < 3.10 ... '=' alignment not allowed in string format specifier (pad_len or 1 above to avoid, then lstrip here to strip)
679
680
  elif isinstance(text, list) and all([isinstance(x, str) for x in text]):
680
681
  colors = [get_color_str(color_str) for _ in range(len(text))]
681
- text = [f"{' ' if pad_len else '':{pad_len}}[{c}]{t}[/{c}]" for t, c in zip(text, colors)]
682
+ text = [f"{' ' if pad_len else '':{pad_len or 1}}[{c}]{t}[/{c}]" for t, c in zip(text, colors)]
683
+ text = text if pad_len else [t.lstrip() for t in text] # workaround for py < 3.10 ... '=' alignment not allowed in string format specifier (pad_len or 1 above to avoid, then lstrip here to strip)
682
684
  return sep.join(text)
683
685
  else:
684
686
  raise TypeError(f"{type(text)}: text attribute should be str, bool, or list of str.")
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "centralcli"
3
- version = "7.3.2"
3
+ version = "7.3.4"
4
4
  description = "A CLI for interacting with Aruba Central (Cloud Management Platform). Facilitates bulk imports, exports, reporting. A handy tool if you have devices managed by Aruba Central."
5
5
  license = "MIT"
6
6
  authors = ["Wade Wells (Pack3tL0ss) <wade@consolepi.org>"]
@@ -52,6 +52,7 @@ fuzzywuzzy = "*"
52
52
  levenshtein = "*"
53
53
  click = "<=7.1.2"
54
54
  uniplot = ">=0.13.0"
55
+ eval_type_backport = { version = "*", python = "<3.10" }
55
56
 
56
57
 
57
58
  # Optional dependencies see tool.poetry.extras
@@ -1,13 +0,0 @@
1
- from __future__ import annotations
2
- from yarl import URL
3
-
4
- from typing import Literal, List, Dict
5
-
6
-
7
-
8
- StrOrURL = str | URL
9
- Method = Literal['GET', 'POST', 'PUT', 'DELETE']
10
- SiteData = List[Dict[str, str | int | float]] | Dict[str, str | int | float]
11
- PortalAuthType = Literal["user/pass", "anon", "self-reg"]
12
- PortalAuthTypes = List[PortalAuthType]
13
- CacheTableName = Literal["devices", "sites", "groups", "labels", "macs", "mpsk"]
File without changes
File without changes
File without changes