osc-lib 4.0.0__tar.gz → 4.0.1__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.
- {osc_lib-4.0.0 → osc_lib-4.0.1}/ChangeLog +9 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/PKG-INFO +3 -3
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/api/api.py +5 -6
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/api/auth.py +3 -3
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/api/utils.py +1 -1
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/cli/client_config.py +15 -13
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/cli/format_columns.py +9 -9
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/cli/parseractions.py +5 -6
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/clientmanager.py +2 -2
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/command/command.py +3 -3
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/command/timing.py +1 -1
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/logs.py +2 -3
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/shell.py +8 -8
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/utils/__init__.py +44 -45
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/utils/columns.py +5 -5
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/utils/tags.py +5 -6
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib.egg-info/PKG-INFO +3 -3
- osc_lib-4.0.1/osc_lib.egg-info/pbr.json +1 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib.egg-info/requires.txt +2 -2
- {osc_lib-4.0.0 → osc_lib-4.0.1}/pyproject.toml +2 -1
- {osc_lib-4.0.0 → osc_lib-4.0.1}/requirements.txt +2 -2
- {osc_lib-4.0.0 → osc_lib-4.0.1}/tox.ini +3 -3
- osc_lib-4.0.0/osc_lib.egg-info/pbr.json +0 -1
- {osc_lib-4.0.0 → osc_lib-4.0.1}/.coveragerc +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/.git-ignore-blame-revs +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/.mailmap +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/.pre-commit-config.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/.stestr.conf +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/.zuul.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/AUTHORS +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/HACKING.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/LICENSE +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/README.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/ext/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/ext/apidoc.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/requirements.txt +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/source/conf.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/source/contributor/index.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/source/index.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/source/reference/index.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/source/user/change_log.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/source/user/index.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/doc/source/user/transition.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/api/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/cli/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/cli/identity.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/cli/pagination.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/command/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/command/commandmanager.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/exceptions.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/i18n.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/py.typed +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/api/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/api/fakes.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/api/test_api.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/api/test_utils.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/cli/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/cli/test_client_config.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/cli/test_format_columns.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/cli/test_identity.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/cli/test_parseractions.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/command/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/command/test_command.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/command/test_timing.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/fakes.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/test_clientmanager.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/test_logs.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/test_shell.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/utils/__init__.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/utils/test_columns.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/utils/test_tags.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/tests/utils/test_utils.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib/version.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib.egg-info/SOURCES.txt +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib.egg-info/dependency_links.txt +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib.egg-info/not-zip-safe +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/osc_lib.egg-info/top_level.txt +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/.placeholder +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/1.0-summary-47dcce446d6a512b.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/add-KeyValueAppendAction-class-f830e71152d6b91e.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/add-MultiKeyValueCommaAction-class-01dd254a287d70d2.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/add-size-column-5424c40af74688df.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/add_sdk_utils-d0c338eba682f2c8.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/arg-precedence-1ba9fd6929650830.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/auth-type-none-d96760912605f822.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/bug-1558690-1528b637f2c0a449.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/bug-1630822-mask-password-on-debug-20dcdf1c54e84fa1.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/bug-2004898-686577a07e791051.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/bug-2006480-436489d39643e76c.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/deprecate-BaseAPI-09abd3cb955c2bb6.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/deprecate-clientcache-38c8c9fd4ca6dcdf.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/deprecated-legacy-client-helpers-53dde79bd6769d2d.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/direct-openstacksdk-535a179f3c645cc0.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/drop-py2-support-60c93244107d5778.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/env-default-e8f2c60f1295d15f.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/find-project-203bf867619c557e.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/keystone-to-keystone-9b2e55b051775322.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/none-auth-cli-48ab0e48d4852941.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/os-profile-as-environment-variable-a5e232e9ca7c5171.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/remove-babel-50abc5b548455bb2.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/remove-group-subclass-82134e6915c7c782.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/remove-support-for-legacy-formatters-1240317d801b4336.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/save-results-4473cb5731c0c763.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/notes/shell-argv-decode-cdc13dc0c4ec07af.yaml +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/2023.1.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/2023.2.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/2024.1.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/2024.2.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/2025.1.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/_static/.placeholder +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/_templates/.placeholder +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/conf.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/index.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/newton.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/ocata.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/pike.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/queens.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/rocky.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/stein.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/train.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/unreleased.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/ussuri.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/victoria.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/wallaby.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/xena.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/yoga.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/releasenotes/source/zed.rst +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/setup.cfg +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/setup.py +0 -0
- {osc_lib-4.0.0 → osc_lib-4.0.1}/test-requirements.txt +0 -0
@@ -1,6 +1,15 @@
|
|
1
1
|
CHANGES
|
2
2
|
=======
|
3
3
|
|
4
|
+
4.0.1
|
5
|
+
-----
|
6
|
+
|
7
|
+
* Temporarily revert dependency bumps
|
8
|
+
* Use Python 3.8-style type hints
|
9
|
+
* Temporarily undrop support for Python 3.8, 3.9
|
10
|
+
* Drop support for Python 3.8, 3.9
|
11
|
+
* Replace UPPER\_CONSTRAINTS\_FILE
|
12
|
+
|
4
13
|
4.0.0
|
5
14
|
-----
|
6
15
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: osc-lib
|
3
|
-
Version: 4.0.
|
3
|
+
Version: 4.0.1
|
4
4
|
Summary: OpenStackClient Library
|
5
5
|
Home-page: https://docs.openstack.org/osc-lib/latest/
|
6
6
|
Author: OpenStack
|
@@ -19,8 +19,8 @@ Classifier: Programming Language :: Python :: 3
|
|
19
19
|
Classifier: Programming Language :: Python :: 3 :: Only
|
20
20
|
Requires-Python: >=3.8
|
21
21
|
License-File: LICENSE
|
22
|
-
Requires-Dist: cliff>=
|
23
|
-
Requires-Dist: keystoneauth1>=
|
22
|
+
Requires-Dist: cliff>=3.2.0
|
23
|
+
Requires-Dist: keystoneauth1>=3.14.0
|
24
24
|
Requires-Dist: openstacksdk>=0.15.0
|
25
25
|
Requires-Dist: oslo.i18n>=3.15.3
|
26
26
|
Requires-Dist: oslo.utils>=3.33.0
|
@@ -13,7 +13,6 @@
|
|
13
13
|
|
14
14
|
"""Base API Library"""
|
15
15
|
|
16
|
-
import builtins
|
17
16
|
import typing as ty
|
18
17
|
import warnings
|
19
18
|
|
@@ -204,7 +203,7 @@ class BaseAPI:
|
|
204
203
|
session: ty.Optional[ksa_session.Session] = None,
|
205
204
|
body: ty.Any = None,
|
206
205
|
detailed: bool = False,
|
207
|
-
headers: ty.Optional[
|
206
|
+
headers: ty.Optional[ty.Dict[str, str]] = None,
|
208
207
|
**params: ty.Any,
|
209
208
|
) -> ty.Union[requests.Response, ty.Any]:
|
210
209
|
"""Return a list of resources
|
@@ -291,7 +290,7 @@ class BaseAPI:
|
|
291
290
|
if resource is None:
|
292
291
|
resource = path
|
293
292
|
|
294
|
-
def getlist(kw:
|
293
|
+
def getlist(kw: ty.Dict[str, ty.Any]) -> ty.Any:
|
295
294
|
"""Do list call, unwrap resource dict if present"""
|
296
295
|
ret = self.list(path, **kw)
|
297
296
|
if isinstance(ret, dict) and resource in ret:
|
@@ -324,9 +323,9 @@ class BaseAPI:
|
|
324
323
|
def find_bulk(
|
325
324
|
self,
|
326
325
|
path: str,
|
327
|
-
headers: ty.Optional[
|
326
|
+
headers: ty.Optional[ty.Dict[str, str]] = None,
|
328
327
|
**kwargs: ty.Any,
|
329
|
-
) ->
|
328
|
+
) -> ty.List[ty.Any]:
|
330
329
|
"""Bulk load and filter locally
|
331
330
|
|
332
331
|
:param string path:
|
@@ -378,7 +377,7 @@ class BaseAPI:
|
|
378
377
|
path: str,
|
379
378
|
value: ty.Optional[str] = None,
|
380
379
|
attr: ty.Optional[str] = None,
|
381
|
-
headers: ty.Optional[
|
380
|
+
headers: ty.Optional[ty.Dict[str, str]] = None,
|
382
381
|
) -> ty.Any:
|
383
382
|
"""Find a single resource by name or ID
|
384
383
|
|
@@ -39,10 +39,10 @@ class _OptionDict(ty.TypedDict):
|
|
39
39
|
|
40
40
|
|
41
41
|
# List of plugin command line options
|
42
|
-
OPTIONS_LIST:
|
42
|
+
OPTIONS_LIST: ty.Dict[str, _OptionDict] = {}
|
43
43
|
|
44
44
|
|
45
|
-
def get_plugin_list() ->
|
45
|
+
def get_plugin_list() -> ty.FrozenSet[str]:
|
46
46
|
"""Gather plugin list and cache it"""
|
47
47
|
|
48
48
|
global PLUGIN_LIST
|
@@ -52,7 +52,7 @@ def get_plugin_list() -> frozenset[str]:
|
|
52
52
|
return PLUGIN_LIST
|
53
53
|
|
54
54
|
|
55
|
-
def get_options_list() ->
|
55
|
+
def get_options_list() -> ty.Dict[str, _OptionDict]:
|
56
56
|
"""Gather plugin options so the help action has them available"""
|
57
57
|
|
58
58
|
global OPTIONS_LIST
|
@@ -29,8 +29,8 @@ LOG = logging.getLogger(__name__)
|
|
29
29
|
# before auth plugins are loaded
|
30
30
|
class OSC_Config(config.OpenStackConfig): # type: ignore
|
31
31
|
def _auth_select_default_plugin(
|
32
|
-
self, config:
|
33
|
-
) ->
|
32
|
+
self, config: ty.Dict[str, ty.Any]
|
33
|
+
) -> ty.Dict[str, ty.Any]:
|
34
34
|
"""Select a default plugin based on supplied arguments
|
35
35
|
|
36
36
|
Migrated from auth.select_auth_plugin()
|
@@ -64,8 +64,8 @@ class OSC_Config(config.OpenStackConfig): # type: ignore
|
|
64
64
|
return config
|
65
65
|
|
66
66
|
def _auth_v2_arguments(
|
67
|
-
self, config:
|
68
|
-
) ->
|
67
|
+
self, config: ty.Dict[str, ty.Any]
|
68
|
+
) -> ty.Dict[str, ty.Any]:
|
69
69
|
"""Set up v2-required arguments from v3 info
|
70
70
|
|
71
71
|
Migrated from auth.build_auth_params()
|
@@ -79,8 +79,8 @@ class OSC_Config(config.OpenStackConfig): # type: ignore
|
|
79
79
|
return config
|
80
80
|
|
81
81
|
def _auth_v2_ignore_v3(
|
82
|
-
self, config:
|
83
|
-
) ->
|
82
|
+
self, config: ty.Dict[str, ty.Any]
|
83
|
+
) -> ty.Dict[str, ty.Any]:
|
84
84
|
"""Remove v3 arguments if present for v2 plugin
|
85
85
|
|
86
86
|
Migrated from clientmanager.setup_auth()
|
@@ -119,8 +119,8 @@ class OSC_Config(config.OpenStackConfig): # type: ignore
|
|
119
119
|
return config
|
120
120
|
|
121
121
|
def _auth_default_domain(
|
122
|
-
self, config:
|
123
|
-
) ->
|
122
|
+
self, config: ty.Dict[str, ty.Any]
|
123
|
+
) -> ty.Dict[str, ty.Any]:
|
124
124
|
"""Set a default domain from available arguments
|
125
125
|
|
126
126
|
Migrated from clientmanager.setup_auth()
|
@@ -161,7 +161,9 @@ class OSC_Config(config.OpenStackConfig): # type: ignore
|
|
161
161
|
config['auth']['user_domain_id'] = default_domain
|
162
162
|
return config
|
163
163
|
|
164
|
-
def auth_config_hook(
|
164
|
+
def auth_config_hook(
|
165
|
+
self, config: ty.Dict[str, ty.Any]
|
166
|
+
) -> ty.Dict[str, ty.Any]:
|
165
167
|
"""Allow examination of config values before loading auth plugin
|
166
168
|
|
167
169
|
OpenStackClient will override this to perform additional checks
|
@@ -181,9 +183,9 @@ class OSC_Config(config.OpenStackConfig): # type: ignore
|
|
181
183
|
|
182
184
|
def _validate_auth(
|
183
185
|
self,
|
184
|
-
config:
|
185
|
-
loader: ksa_loading.BaseIdentityLoader
|
186
|
-
) ->
|
186
|
+
config: ty.Dict[str, ty.Any],
|
187
|
+
loader: ksa_loading.BaseIdentityLoader, # type: ignore
|
188
|
+
) -> ty.Dict[str, ty.Any]:
|
187
189
|
"""Validate auth plugin arguments"""
|
188
190
|
# May throw a keystoneauth1.exceptions.NoMatchingPlugin
|
189
191
|
|
@@ -248,7 +250,7 @@ class OSC_Config(config.OpenStackConfig): # type: ignore
|
|
248
250
|
return config
|
249
251
|
|
250
252
|
# TODO(stephenfin): Add type once we have typing for SDK
|
251
|
-
def load_auth_plugin(self, config:
|
253
|
+
def load_auth_plugin(self, config: ty.Dict[str, ty.Any]) -> ty.Any:
|
252
254
|
"""Get auth plugin and validate args"""
|
253
255
|
|
254
256
|
loader = self._get_auth_loader(config)
|
@@ -22,47 +22,47 @@ from cliff import columns
|
|
22
22
|
from osc_lib import utils
|
23
23
|
|
24
24
|
|
25
|
-
class DictColumn(columns.FormattableColumn
|
25
|
+
class DictColumn(columns.FormattableColumn): # type: ignore
|
26
26
|
"""Format column for dict content"""
|
27
27
|
|
28
28
|
def human_readable(self) -> str:
|
29
29
|
return utils.format_dict(self._value)
|
30
30
|
|
31
|
-
def machine_readable(self) ->
|
31
|
+
def machine_readable(self) -> ty.Dict[str, ty.Any]:
|
32
32
|
return dict(self._value or {})
|
33
33
|
|
34
34
|
|
35
|
-
class DictListColumn(columns.FormattableColumn
|
35
|
+
class DictListColumn(columns.FormattableColumn): # type: ignore
|
36
36
|
"""Format column for dict, key is string, value is list"""
|
37
37
|
|
38
38
|
def human_readable(self) -> str:
|
39
39
|
return utils.format_dict_of_list(self._value) or ''
|
40
40
|
|
41
|
-
def machine_readable(self) ->
|
41
|
+
def machine_readable(self) -> ty.Dict[str, ty.List[ty.Any]]:
|
42
42
|
return dict(self._value or {})
|
43
43
|
|
44
44
|
|
45
|
-
class ListColumn(columns.FormattableColumn
|
45
|
+
class ListColumn(columns.FormattableColumn): # type: ignore
|
46
46
|
"""Format column for list content"""
|
47
47
|
|
48
48
|
def human_readable(self) -> str:
|
49
49
|
return utils.format_list(self._value) or ''
|
50
50
|
|
51
|
-
def machine_readable(self) ->
|
51
|
+
def machine_readable(self) -> ty.List[ty.Any]:
|
52
52
|
return [x for x in self._value or []]
|
53
53
|
|
54
54
|
|
55
|
-
class ListDictColumn(columns.FormattableColumn
|
55
|
+
class ListDictColumn(columns.FormattableColumn): # type: ignore
|
56
56
|
"""Format column for list of dict content"""
|
57
57
|
|
58
58
|
def human_readable(self) -> str:
|
59
59
|
return utils.format_list_of_dicts(self._value) or ''
|
60
60
|
|
61
|
-
def machine_readable(self) ->
|
61
|
+
def machine_readable(self) -> ty.List[ty.Dict[str, ty.Any]]:
|
62
62
|
return [dict(x) for x in self._value or []]
|
63
63
|
|
64
64
|
|
65
|
-
class SizeColumn(columns.FormattableColumn
|
65
|
+
class SizeColumn(columns.FormattableColumn): # type: ignore
|
66
66
|
"""Format column for file size content"""
|
67
67
|
|
68
68
|
def human_readable(self) -> str:
|
@@ -16,7 +16,6 @@
|
|
16
16
|
"""argparse Custom Actions"""
|
17
17
|
|
18
18
|
import argparse
|
19
|
-
import collections.abc
|
20
19
|
import typing as ty
|
21
20
|
|
22
21
|
from osc_lib.i18n import _
|
@@ -115,11 +114,11 @@ class MultiKeyValueAction(argparse.Action):
|
|
115
114
|
optional_keys: ty.Optional[ty.Sequence[str]] = None,
|
116
115
|
const: ty.Optional[_T] = None,
|
117
116
|
default: ty.Union[_T, str, None] = None,
|
118
|
-
type: ty.Optional[
|
119
|
-
choices: ty.Optional[
|
117
|
+
type: ty.Optional[ty.Callable[[str], _T]] = None,
|
118
|
+
choices: ty.Optional[ty.Iterable[_T]] = None,
|
120
119
|
required: bool = False,
|
121
120
|
help: ty.Optional[str] = None,
|
122
|
-
metavar: ty.Union[str,
|
121
|
+
metavar: ty.Union[str, ty.Tuple[str, ...], None] = None,
|
123
122
|
) -> None:
|
124
123
|
"""Initialize the action object, and parse customized options
|
125
124
|
|
@@ -213,7 +212,7 @@ class MultiKeyValueAction(argparse.Action):
|
|
213
212
|
if getattr(namespace, self.dest, None) is None:
|
214
213
|
setattr(namespace, self.dest, [])
|
215
214
|
|
216
|
-
params:
|
215
|
+
params: ty.Dict[str, str] = {}
|
217
216
|
for kv in values.split(','):
|
218
217
|
# Add value if an assignment else raise ArgumentError
|
219
218
|
if '=' in kv:
|
@@ -265,7 +264,7 @@ class MultiKeyValueCommaAction(MultiKeyValueAction):
|
|
265
264
|
if getattr(namespace, self.dest, None) is None:
|
266
265
|
setattr(namespace, self.dest, [])
|
267
266
|
|
268
|
-
params:
|
267
|
+
params: ty.Dict[str, str] = {}
|
269
268
|
key = ''
|
270
269
|
for kv in values.split(','):
|
271
270
|
# Add value if an assignment else raise ArgumentError
|
@@ -75,7 +75,7 @@ class ClientManager:
|
|
75
75
|
def __init__(
|
76
76
|
self,
|
77
77
|
cli_options: cloud_region.CloudRegion,
|
78
|
-
api_version: ty.Optional[
|
78
|
+
api_version: ty.Optional[ty.Dict[str, str]],
|
79
79
|
pw_func: ty.Optional[_PasswordHelper] = None,
|
80
80
|
app_name: ty.Optional[str] = None,
|
81
81
|
app_version: ty.Optional[str] = None,
|
@@ -283,5 +283,5 @@ class ClientManager:
|
|
283
283
|
)
|
284
284
|
return endpoint
|
285
285
|
|
286
|
-
def get_configuration(self) ->
|
286
|
+
def get_configuration(self) -> ty.Dict[str, ty.Any]:
|
287
287
|
return copy.deepcopy(self._cli_options.config)
|
@@ -27,10 +27,10 @@ from osc_lib.i18n import _
|
|
27
27
|
|
28
28
|
class CommandMeta(abc.ABCMeta):
|
29
29
|
def __new__(
|
30
|
-
mcs:
|
30
|
+
mcs: ty.Type['CommandMeta'],
|
31
31
|
name: str,
|
32
|
-
bases:
|
33
|
-
namespace:
|
32
|
+
bases: ty.Tuple[ty.Type[ty.Any], ...],
|
33
|
+
namespace: ty.Dict[str, ty.Any],
|
34
34
|
) -> 'CommandMeta':
|
35
35
|
if 'log' not in namespace:
|
36
36
|
namespace['log'] = logging.getLogger(
|
@@ -14,7 +14,6 @@
|
|
14
14
|
"""Application logging"""
|
15
15
|
|
16
16
|
import argparse
|
17
|
-
import collections.abc
|
18
17
|
import logging
|
19
18
|
import sys
|
20
19
|
import typing as ty
|
@@ -23,7 +22,7 @@ import warnings
|
|
23
22
|
from openstack.config import cloud_config
|
24
23
|
|
25
24
|
|
26
|
-
def get_loggers() ->
|
25
|
+
def get_loggers() -> ty.Dict[str, str]:
|
27
26
|
loggers = {}
|
28
27
|
for logkey in logging.Logger.manager.loggerDict.keys():
|
29
28
|
loggers[logkey] = logging.getLevelName(logging.getLogger(logkey).level)
|
@@ -57,7 +56,7 @@ def log_level_from_string(level_string: str) -> int:
|
|
57
56
|
return log_level
|
58
57
|
|
59
58
|
|
60
|
-
def log_level_from_config(config:
|
59
|
+
def log_level_from_config(config: ty.Mapping[str, ty.Any]) -> int:
|
61
60
|
# Check the command line option
|
62
61
|
verbose_level = config.get('verbose_level')
|
63
62
|
if config.get('debug', False):
|
@@ -82,7 +82,7 @@ class OpenStackShell(app.App):
|
|
82
82
|
client_manager: clientmanager.ClientManager
|
83
83
|
|
84
84
|
log = logging.getLogger(__name__)
|
85
|
-
timing_data:
|
85
|
+
timing_data: ty.List[ty.Any] = []
|
86
86
|
|
87
87
|
def __init__(
|
88
88
|
self,
|
@@ -93,7 +93,7 @@ class OpenStackShell(app.App):
|
|
93
93
|
stdout: ty.Optional[ty.TextIO] = None,
|
94
94
|
stderr: ty.Optional[ty.TextIO] = None,
|
95
95
|
interactive_app_factory: ty.Optional[
|
96
|
-
|
96
|
+
ty.Type['interactive.InteractiveApp']
|
97
97
|
] = None,
|
98
98
|
deferred_help: bool = False,
|
99
99
|
) -> None:
|
@@ -127,7 +127,7 @@ class OpenStackShell(app.App):
|
|
127
127
|
# Set in subclasses
|
128
128
|
self.api_version = None
|
129
129
|
|
130
|
-
self.command_options:
|
130
|
+
self.command_options: ty.List[str] = []
|
131
131
|
|
132
132
|
self.do_profile = False
|
133
133
|
|
@@ -136,7 +136,7 @@ class OpenStackShell(app.App):
|
|
136
136
|
self.log_configurator = logs.LogConfigurator(self.options)
|
137
137
|
self.dump_stack_trace = self.log_configurator.dump_trace
|
138
138
|
|
139
|
-
def run(self, argv:
|
139
|
+
def run(self, argv: ty.List[str]) -> int:
|
140
140
|
ret_val = 1
|
141
141
|
self.command_options = argv
|
142
142
|
try:
|
@@ -180,7 +180,7 @@ class OpenStackShell(app.App):
|
|
180
180
|
f"osprofiler trace show --html {trace_id} "
|
181
181
|
)
|
182
182
|
|
183
|
-
def run_subcommand(self, argv:
|
183
|
+
def run_subcommand(self, argv: ty.List[str]) -> int:
|
184
184
|
self.init_profile()
|
185
185
|
try:
|
186
186
|
ret_value = super().run_subcommand(argv)
|
@@ -200,7 +200,7 @@ class OpenStackShell(app.App):
|
|
200
200
|
self,
|
201
201
|
description: ty.Optional[str],
|
202
202
|
version: ty.Optional[str],
|
203
|
-
argparse_kwargs: ty.Optional[
|
203
|
+
argparse_kwargs: ty.Optional[ty.Dict[str, ty.Any]] = None,
|
204
204
|
) -> _argparse.ArgumentParser:
|
205
205
|
parser = super().build_option_parser(
|
206
206
|
description,
|
@@ -416,7 +416,7 @@ class OpenStackShell(app.App):
|
|
416
416
|
"""
|
417
417
|
pass
|
418
418
|
|
419
|
-
def initialize_app(self, argv:
|
419
|
+
def initialize_app(self, argv: ty.List[str]) -> None:
|
420
420
|
"""Global app init bits:
|
421
421
|
|
422
422
|
* set up API versions
|
@@ -570,7 +570,7 @@ class OpenStackShell(app.App):
|
|
570
570
|
tcmd.run(targs)
|
571
571
|
|
572
572
|
|
573
|
-
def main(argv: ty.Optional[
|
573
|
+
def main(argv: ty.Optional[ty.List[str]] = None) -> int:
|
574
574
|
if argv is None:
|
575
575
|
argv = sys.argv[1:]
|
576
576
|
return OpenStackShell().run(argv)
|
@@ -16,7 +16,6 @@
|
|
16
16
|
"""Common client utilities"""
|
17
17
|
|
18
18
|
import argparse
|
19
|
-
import collections.abc
|
20
19
|
import copy
|
21
20
|
import functools
|
22
21
|
import getpass
|
@@ -39,10 +38,10 @@ _T = ty.TypeVar('_T')
|
|
39
38
|
|
40
39
|
|
41
40
|
def backward_compat_col_lister(
|
42
|
-
column_headers:
|
43
|
-
columns:
|
44
|
-
column_map:
|
45
|
-
) ->
|
41
|
+
column_headers: ty.List[str],
|
42
|
+
columns: ty.List[str],
|
43
|
+
column_map: ty.Dict[str, str],
|
44
|
+
) -> ty.List[str]:
|
46
45
|
"""Convert the column headers to keep column backward compatibility.
|
47
46
|
|
48
47
|
Replace the new column name of column headers by old name, so that
|
@@ -75,10 +74,10 @@ def backward_compat_col_lister(
|
|
75
74
|
|
76
75
|
|
77
76
|
def backward_compat_col_showone(
|
78
|
-
show_object:
|
79
|
-
columns:
|
80
|
-
column_map:
|
81
|
-
) ->
|
77
|
+
show_object: ty.MutableMapping[str, _T],
|
78
|
+
columns: ty.List[str],
|
79
|
+
column_map: ty.Dict[str, str],
|
80
|
+
) -> ty.MutableMapping[str, _T]:
|
82
81
|
"""Convert the output object to keep column backward compatibility.
|
83
82
|
|
84
83
|
Replace the new column name of output object by old name, so that
|
@@ -108,7 +107,7 @@ def backward_compat_col_showone(
|
|
108
107
|
return show_object
|
109
108
|
|
110
109
|
|
111
|
-
def build_kwargs_dict(arg_name: str, value: _T) ->
|
110
|
+
def build_kwargs_dict(arg_name: str, value: _T) -> ty.Dict[str, _T]:
|
112
111
|
"""Return a dictionary containing `arg_name` if `value` is set."""
|
113
112
|
kwargs = {}
|
114
113
|
if value:
|
@@ -117,10 +116,10 @@ def build_kwargs_dict(arg_name: str, value: _T) -> dict[str, _T]:
|
|
117
116
|
|
118
117
|
|
119
118
|
def calculate_header_and_attrs(
|
120
|
-
column_headers:
|
121
|
-
attrs:
|
119
|
+
column_headers: ty.Sequence[str],
|
120
|
+
attrs: ty.Sequence[str],
|
122
121
|
parsed_args: argparse.Namespace,
|
123
|
-
) ->
|
122
|
+
) -> ty.Tuple[ty.Sequence[str], ty.Sequence[str]]:
|
124
123
|
"""Calculate headers and attribute names based on parsed_args.column.
|
125
124
|
|
126
125
|
When --column (-c) option is specified, this function calculates
|
@@ -173,10 +172,10 @@ def env(*vars: str, **kwargs: ty.Any) -> ty.Optional[str]:
|
|
173
172
|
|
174
173
|
|
175
174
|
def find_min_match(
|
176
|
-
items:
|
175
|
+
items: ty.Sequence[_T],
|
177
176
|
sort_attr: str,
|
178
177
|
**kwargs: ty.Any,
|
179
|
-
) ->
|
178
|
+
) -> ty.Sequence[_T]:
|
180
179
|
"""Find all resources meeting the given minimum constraints
|
181
180
|
|
182
181
|
:param items: A List of objects to consider
|
@@ -328,7 +327,7 @@ def find_resource(
|
|
328
327
|
|
329
328
|
|
330
329
|
def format_dict(
|
331
|
-
data:
|
330
|
+
data: ty.Dict[str, ty.Any], prefix: ty.Optional[str] = None
|
332
331
|
) -> str:
|
333
332
|
"""Return a formatted string of key value pairs
|
334
333
|
|
@@ -358,7 +357,7 @@ def format_dict(
|
|
358
357
|
|
359
358
|
|
360
359
|
def format_dict_of_list(
|
361
|
-
data: ty.Optional[
|
360
|
+
data: ty.Optional[ty.Dict[str, ty.List[ty.Any]]], separator: str = '; '
|
362
361
|
) -> ty.Optional[str]:
|
363
362
|
"""Return a formatted string of key value pair
|
364
363
|
|
@@ -385,7 +384,7 @@ def format_dict_of_list(
|
|
385
384
|
|
386
385
|
|
387
386
|
def format_list(
|
388
|
-
data: ty.Optional[
|
387
|
+
data: ty.Optional[ty.List[ty.Any]], separator: str = ', '
|
389
388
|
) -> ty.Optional[str]:
|
390
389
|
"""Return a formatted strings
|
391
390
|
|
@@ -400,7 +399,7 @@ def format_list(
|
|
400
399
|
|
401
400
|
|
402
401
|
def format_list_of_dicts(
|
403
|
-
data: ty.Optional[
|
402
|
+
data: ty.Optional[ty.List[ty.Dict[str, ty.Any]]],
|
404
403
|
) -> ty.Optional[str]:
|
405
404
|
"""Return a formatted string of key value pairs for each dict
|
406
405
|
|
@@ -445,7 +444,7 @@ def format_size(size: ty.Union[int, float, None]) -> str:
|
|
445
444
|
def get_client_class(
|
446
445
|
api_name: str,
|
447
446
|
version: ty.Union[str, int, float],
|
448
|
-
version_map:
|
447
|
+
version_map: ty.Dict[str, ty.Type[_T]],
|
449
448
|
) -> ty.Any:
|
450
449
|
"""Returns the client class for the requested API version
|
451
450
|
|
@@ -483,13 +482,13 @@ def get_client_class(
|
|
483
482
|
|
484
483
|
|
485
484
|
def get_dict_properties(
|
486
|
-
item:
|
487
|
-
fields:
|
488
|
-
mixed_case_fields: ty.Optional[
|
489
|
-
formatters: ty.Optional[
|
490
|
-
|
485
|
+
item: ty.Dict[str, _T],
|
486
|
+
fields: ty.Sequence[str],
|
487
|
+
mixed_case_fields: ty.Optional[ty.Sequence[str]] = None,
|
488
|
+
formatters: ty.Optional[ # type: ignore
|
489
|
+
ty.Dict[str, ty.Type[cliff_columns.FormattableColumn]]
|
491
490
|
] = None,
|
492
|
-
) ->
|
491
|
+
) -> ty.Tuple[ty.Any, ...]:
|
493
492
|
"""Return a tuple containing the item properties.
|
494
493
|
|
495
494
|
:param item: a single dict resource
|
@@ -535,13 +534,13 @@ def get_dict_properties(
|
|
535
534
|
|
536
535
|
|
537
536
|
def get_item_properties(
|
538
|
-
item:
|
539
|
-
fields:
|
540
|
-
mixed_case_fields: ty.Optional[
|
541
|
-
formatters: ty.Optional[
|
542
|
-
|
537
|
+
item: ty.Dict[str, _T],
|
538
|
+
fields: ty.Sequence[str],
|
539
|
+
mixed_case_fields: ty.Optional[ty.Sequence[str]] = None,
|
540
|
+
formatters: ty.Optional[ # type: ignore
|
541
|
+
ty.Dict[str, ty.Type[cliff_columns.FormattableColumn]]
|
543
542
|
] = None,
|
544
|
-
) ->
|
543
|
+
) -> ty.Tuple[ty.Any, ...]:
|
545
544
|
"""Return a tuple containing the item properties.
|
546
545
|
|
547
546
|
:param item: a single item resource (e.g. Server, Project, etc)
|
@@ -656,10 +655,10 @@ def read_blob_file_contents(blob_file: str) -> str:
|
|
656
655
|
|
657
656
|
|
658
657
|
def sort_items(
|
659
|
-
items:
|
658
|
+
items: ty.Sequence[_T],
|
660
659
|
sort_str: str,
|
661
|
-
sort_type: ty.Optional[
|
662
|
-
) ->
|
660
|
+
sort_type: ty.Optional[ty.Type[ty.Any]] = None,
|
661
|
+
) -> ty.Sequence[_T]:
|
663
662
|
"""Sort items based on sort keys and sort directions given by sort_str.
|
664
663
|
|
665
664
|
:param items: a list or generator object of items
|
@@ -720,11 +719,11 @@ def wait_for_delete(
|
|
720
719
|
manager: ty.Any,
|
721
720
|
res_id: str,
|
722
721
|
status_field: str = 'status',
|
723
|
-
error_status:
|
724
|
-
exception_name:
|
722
|
+
error_status: ty.Sequence[str] = ['error'],
|
723
|
+
exception_name: ty.Sequence[str] = ['NotFound'],
|
725
724
|
sleep_time: int = 5,
|
726
725
|
timeout: int = 300,
|
727
|
-
callback: ty.Optional[
|
726
|
+
callback: ty.Optional[ty.Callable[[int], None]] = None,
|
728
727
|
) -> bool:
|
729
728
|
"""Wait for resource deletion
|
730
729
|
|
@@ -776,13 +775,13 @@ def wait_for_delete(
|
|
776
775
|
|
777
776
|
|
778
777
|
def wait_for_status(
|
779
|
-
status_f:
|
778
|
+
status_f: ty.Callable[[str], object],
|
780
779
|
res_id: str,
|
781
780
|
status_field: str = 'status',
|
782
|
-
success_status:
|
783
|
-
error_status:
|
781
|
+
success_status: ty.Sequence[str] = ['active'],
|
782
|
+
error_status: ty.Sequence[str] = ['error'],
|
784
783
|
sleep_time: int = 5,
|
785
|
-
callback: ty.Optional[
|
784
|
+
callback: ty.Optional[ty.Callable[[int], None]] = None,
|
786
785
|
) -> bool:
|
787
786
|
"""Wait for status change on a resource during a long-running operation
|
788
787
|
|
@@ -819,9 +818,9 @@ def wait_for_status(
|
|
819
818
|
|
820
819
|
def get_osc_show_columns_for_sdk_resource(
|
821
820
|
sdk_resource: resource.Resource,
|
822
|
-
osc_column_map:
|
823
|
-
invisible_columns: ty.Optional[
|
824
|
-
) ->
|
821
|
+
osc_column_map: ty.Dict[str, str],
|
822
|
+
invisible_columns: ty.Optional[ty.Sequence[str]] = None,
|
823
|
+
) -> ty.Tuple[ty.Tuple[str, ...], ty.Tuple[str, ...]]:
|
825
824
|
"""Get and filter the display and attribute columns for an SDK resource.
|
826
825
|
|
827
826
|
Common utility function for preparing the output of an OSC show command.
|
@@ -19,8 +19,8 @@ LIST_LONG_ONLY = 'long_only'
|
|
19
19
|
|
20
20
|
|
21
21
|
def get_column_definitions(
|
22
|
-
attr_map:
|
23
|
-
) ->
|
22
|
+
attr_map: ty.List[ty.Tuple[str, str, str]], long_listing: bool
|
23
|
+
) -> ty.Tuple[ty.List[str], ty.List[str]]:
|
24
24
|
"""Return table headers and column names for a listing table.
|
25
25
|
|
26
26
|
An attribute map (attr_map) is a list of table entry definitions
|
@@ -77,9 +77,9 @@ def get_column_definitions(
|
|
77
77
|
|
78
78
|
|
79
79
|
def get_columns(
|
80
|
-
item:
|
81
|
-
attr_map: ty.Optional[
|
82
|
-
) ->
|
80
|
+
item: ty.Dict[str, ty.Any],
|
81
|
+
attr_map: ty.Optional[ty.List[ty.Tuple[str, str, str]]] = None,
|
82
|
+
) -> ty.Tuple[ty.Tuple[str, ...], ty.Tuple[str, ...]]:
|
83
83
|
"""Return pair of resource attributes and corresponding display names.
|
84
84
|
|
85
85
|
:param item: a dictionary which represents a resource.
|