typing: Use objects from typing
Change-Id: I9211e2918324e5e8135051a7c2279ee574b0e243 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
1 parent
b525e59d0b
commit
8a02564040
31 files changed
+88
-84
No files matched your search
@@ -20,14 +20,14 @@ from collections.abc import Callable
|
||||
import importlib
|
||||
import logging
|
||||
import sys
|
||||
import typing as ty
|
||||
from typing import TYPE_CHECKING, Any, Protocol, TypeVar, runtime_checkable
|
||||
|
||||
from osc_lib.cli import client_config
|
||||
from osc_lib import clientmanager
|
||||
from osc_lib import shell
|
||||
import stevedore
|
||||
|
||||
if ty.TYPE_CHECKING:
|
||||
if TYPE_CHECKING:
|
||||
from keystoneauth1 import access as ksa_access
|
||||
from openstack.compute.v2 import _proxy as compute_proxy
|
||||
from openstack.image.v2 import _proxy as image_proxy
|
||||
@@ -37,7 +37,7 @@ if ty.TYPE_CHECKING:
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
PLUGIN_MODULES: list[ty.Any] = []
|
||||
PLUGIN_MODULES: list[Any] = []
|
||||
|
||||
USER_AGENT = 'python-openstackclient'
|
||||
|
||||
@@ -50,7 +50,7 @@ class ClientManager(clientmanager.ClientManager):
|
||||
in osc-lib so we need to maintain a transition period.
|
||||
"""
|
||||
|
||||
if ty.TYPE_CHECKING:
|
||||
if TYPE_CHECKING:
|
||||
# we know this will be set by us and will not be nullable
|
||||
auth_ref: ksa_access.AccessInfo
|
||||
|
||||
@@ -62,11 +62,11 @@ class ClientManager(clientmanager.ClientManager):
|
||||
# services...
|
||||
# TODO(stephenfin): We also need to migrate object storage...
|
||||
compute: compute_proxy.Proxy
|
||||
identity: ty.Any
|
||||
identity: Any
|
||||
image: image_proxy.Proxy
|
||||
network: network_proxy.Proxy
|
||||
object_store: object_store_v1.APIv1
|
||||
volume: ty.Any
|
||||
volume: Any
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -179,17 +179,17 @@ class ClientManager(clientmanager.ClientManager):
|
||||
|
||||
# Plugin Support
|
||||
|
||||
ArgumentParserT = ty.TypeVar('ArgumentParserT', bound=argparse.ArgumentParser)
|
||||
ArgumentParserT = TypeVar('ArgumentParserT', bound=argparse.ArgumentParser)
|
||||
|
||||
|
||||
@ty.runtime_checkable # Optional: allows usage with isinstance()
|
||||
class PluginModule(ty.Protocol):
|
||||
@runtime_checkable # Optional: allows usage with isinstance()
|
||||
class PluginModule(Protocol):
|
||||
DEFAULT_API_VERSION: str
|
||||
API_VERSION_OPTION: str
|
||||
API_NAME: str
|
||||
API_VERSIONS: tuple[str]
|
||||
|
||||
make_client: Callable[..., ty.Any]
|
||||
make_client: Callable[..., Any]
|
||||
build_option_parser: Callable[[ArgumentParserT], ArgumentParserT]
|
||||
check_api_version: Callable[[str], bool]
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import getpass
|
||||
import logging
|
||||
import os
|
||||
import queue
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff.formatters import table
|
||||
from openstack import utils as sdk_utils
|
||||
@@ -107,7 +107,7 @@ class ProjectCleanup(command.Command):
|
||||
connection = connection.connect_as_project(project)
|
||||
|
||||
if connection:
|
||||
status_queue: queue.Queue[ty.Any] = queue.Queue()
|
||||
status_queue: queue.Queue[Any] = queue.Queue()
|
||||
parsed_args.max_width = int(
|
||||
os.environ.get('CLIFF_MAX_TERM_WIDTH', 0)
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ import argparse
|
||||
import itertools
|
||||
import logging
|
||||
import sys
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from openstack import exceptions as sdk_exceptions
|
||||
from openstack import utils as sdk_utils
|
||||
@@ -203,7 +203,7 @@ def get_network_quotas(
|
||||
#
|
||||
# so we need to make conversion to have data in same format from
|
||||
# all of the services
|
||||
result: dict[str, ty.Any] = {"usage": {}, "reservation": {}}
|
||||
result: dict[str, Any] = {"usage": {}, "reservation": {}}
|
||||
for key, values in dict_quota.items():
|
||||
if values is None:
|
||||
continue
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"""Compute v2 Aggregate action implementations"""
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns
|
||||
from openstack import utils as sdk_utils
|
||||
@@ -33,7 +33,7 @@ from openstackclient.i18n import _
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
_aggregate_formatters: dict[str, type[columns.FormattableColumn[ty.Any]]] = {
|
||||
_aggregate_formatters: dict[str, type[columns.FormattableColumn[Any]]] = {
|
||||
'Hosts': format_columns.ListColumn,
|
||||
'Metadata': format_columns.DictColumn,
|
||||
'hosts': format_columns.ListColumn,
|
||||
@@ -323,7 +323,7 @@ class SetAggregate(command.Command):
|
||||
if kwargs:
|
||||
compute_client.update_aggregate(aggregate.id, **kwargs)
|
||||
|
||||
properties: dict[str, ty.Any] = {}
|
||||
properties: dict[str, Any] = {}
|
||||
if parsed_args.no_property:
|
||||
# NOTE(RuiChen): "availability_zone" can not be unset from
|
||||
# properties. It is already excluded from show and create output.
|
||||
|
||||
@@ -21,7 +21,7 @@ import getpass
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
import iso8601
|
||||
@@ -66,7 +66,7 @@ class PowerStateColumn(cliff_columns.FormattableColumn[int]):
|
||||
return 'N/A'
|
||||
|
||||
|
||||
class AddressesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class AddressesColumn(cliff_columns.FormattableColumn[Any]):
|
||||
"""Generate a formatted string of a server's addresses."""
|
||||
|
||||
def human_readable(self):
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"""Compute v2 Server Group action implementations"""
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns
|
||||
from openstack import utils as sdk_utils
|
||||
@@ -32,7 +32,7 @@ from openstackclient.i18n import _
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
_formatters: dict[str, type[columns.FormattableColumn[ty.Any]]] = {
|
||||
_formatters: dict[str, type[columns.FormattableColumn[Any]]] = {
|
||||
'member_ids': format_columns.ListColumn,
|
||||
'policies': format_columns.ListColumn,
|
||||
'rules': format_columns.DictColumn,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
from collections.abc import Collection
|
||||
import datetime
|
||||
import functools
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib import utils
|
||||
@@ -55,7 +55,7 @@ class ProjectColumn(cliff_columns.FormattableColumn[str]):
|
||||
return project
|
||||
|
||||
|
||||
class CountColumn(cliff_columns.FormattableColumn[Collection[ty.Any]]):
|
||||
class CountColumn(cliff_columns.FormattableColumn[Collection[Any]]):
|
||||
def human_readable(self):
|
||||
return len(self._value) if self._value is not None else None
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"""Identity v2 Service Catalog action implementations"""
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib import exceptions
|
||||
@@ -27,7 +27,7 @@ from openstackclient.i18n import _
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EndpointsColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class EndpointsColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
if not self._value:
|
||||
return ""
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
import uuid
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
@@ -33,7 +33,7 @@ from openstackclient.identity import common
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RolesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class RolesColumn(cliff_columns.FormattableColumn[Any]):
|
||||
"""Generate a formatted string of role names."""
|
||||
|
||||
def human_readable(self):
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"""Identity v3 Service Catalog action implementations"""
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib import exceptions
|
||||
@@ -26,7 +26,7 @@ from openstackclient.i18n import _
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EndpointsColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class EndpointsColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
if not self._value:
|
||||
return ""
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import copy
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from openstack import exceptions as sdk_exc
|
||||
from openstack import utils as sdk_utils
|
||||
@@ -62,7 +62,7 @@ def _format_user(user):
|
||||
|
||||
|
||||
def _get_options_for_user(identity_client, parsed_args):
|
||||
options: dict[str, ty.Any] = {}
|
||||
options: dict[str, Any] = {}
|
||||
if parsed_args.ignore_lockout_failure_attempts:
|
||||
options['ignore_lockout_failure_attempts'] = True
|
||||
if parsed_args.no_ignore_lockout_failure_attempts:
|
||||
|
||||
@@ -19,7 +19,7 @@ import argparse
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib.api import utils as api_utils
|
||||
@@ -840,9 +840,7 @@ class ShowImage(command.ShowOne):
|
||||
parsed_args.image, ignore_missing=False
|
||||
)
|
||||
|
||||
formatters: dict[
|
||||
str, type[cliff_columns.FormattableColumn[ty.Any]]
|
||||
] = {
|
||||
formatters: dict[str, type[cliff_columns.FormattableColumn[Any]]] = {
|
||||
'properties': format_columns.DictColumn,
|
||||
}
|
||||
if parsed_args.human_readable:
|
||||
|
||||
@@ -21,7 +21,7 @@ import copy
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
import urllib.parse
|
||||
|
||||
from openstack import exceptions as sdk_exceptions
|
||||
@@ -446,7 +446,7 @@ class CreateImage(command.ShowOne):
|
||||
|
||||
# Build an attribute dict from the parsed args, only include
|
||||
# attributes that were actually set on the command line
|
||||
kwargs: dict[str, ty.Any] = {'allow_duplicates': True}
|
||||
kwargs: dict[str, Any] = {'allow_duplicates': True}
|
||||
copy_attrs = (
|
||||
'name',
|
||||
'id',
|
||||
@@ -629,7 +629,7 @@ class CreateImage(command.ShowOne):
|
||||
source_volume = volume_client.find_volume(
|
||||
parsed_args.volume, ignore_missing=False
|
||||
)
|
||||
kwargs: dict[str, ty.Any] = {
|
||||
kwargs: dict[str, Any] = {
|
||||
'visibility': None,
|
||||
'protected': None,
|
||||
}
|
||||
@@ -1503,7 +1503,7 @@ class UnsetImage(command.Command):
|
||||
)
|
||||
tagret += 1
|
||||
|
||||
kwargs: dict[str, ty.Any] = {}
|
||||
kwargs: dict[str, Any] = {}
|
||||
if parsed_args.properties:
|
||||
for k in parsed_args.properties:
|
||||
if k in image:
|
||||
@@ -1621,7 +1621,7 @@ class StageImage(command.Command):
|
||||
else:
|
||||
fp = get_data_from_stdin()
|
||||
|
||||
kwargs: dict[str, ty.Any] = {}
|
||||
kwargs: dict[str, Any] = {}
|
||||
|
||||
if parsed_args.progress and parsed_args.filename:
|
||||
# NOTE(stephenfin): we only show a progress bar if the user
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
import abc
|
||||
import contextlib
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import _argparse
|
||||
import openstack.exceptions
|
||||
@@ -317,7 +317,7 @@ class NeutronCommandWithExtraArgs(command.Command):
|
||||
return converter
|
||||
|
||||
def _parse_extra_properties(self, extra_properties):
|
||||
result: dict[str, ty.Any] = {}
|
||||
result: dict[str, Any] = {}
|
||||
if extra_properties:
|
||||
for _property in extra_properties:
|
||||
converter = self._get_property_converter(_property)
|
||||
@@ -350,7 +350,7 @@ class NeutronCommandWithExtraArgs(command.Command):
|
||||
|
||||
class NeutronUnsetCommandWithExtraArgs(NeutronCommandWithExtraArgs):
|
||||
def _parse_extra_properties(self, extra_properties):
|
||||
result: dict[str, ty.Any] = {}
|
||||
result: dict[str, Any] = {}
|
||||
if extra_properties:
|
||||
for _property in extra_properties:
|
||||
result[_property['name']] = None
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"""Floating IP Port Forwarding action implementations"""
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from osc_lib import exceptions
|
||||
from osc_lib import utils
|
||||
@@ -165,7 +165,7 @@ class CreateFloatingIPPortForwarding(
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
attrs: dict[str, ty.Any] = {}
|
||||
attrs: dict[str, Any] = {}
|
||||
client = self.app.client_manager.network
|
||||
floating_ip = client.find_ip(
|
||||
parsed_args.floating_ip,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"""Meter Rule Implementations"""
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from osc_lib import exceptions
|
||||
from osc_lib import utils
|
||||
@@ -35,7 +35,7 @@ def _get_columns(item):
|
||||
|
||||
|
||||
def _get_attrs(client_manager, parsed_args):
|
||||
attrs: dict[str, ty.Any] = {}
|
||||
attrs: dict[str, Any] = {}
|
||||
|
||||
if parsed_args.exclude:
|
||||
attrs['excluded'] = True
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib import exceptions
|
||||
@@ -28,7 +28,7 @@ from openstackclient.network import common
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RulesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class RulesColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
return '\n'.join(str(v) for v in self._value)
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import itertools
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from osc_lib import exceptions
|
||||
from osc_lib import utils
|
||||
@@ -59,7 +59,7 @@ def _is_prop_empty(columns, props, prop_name):
|
||||
|
||||
|
||||
def _exchange_dict_keys_with_values(orig_dict):
|
||||
updated_dict: dict[str, ty.Any] = {}
|
||||
updated_dict: dict[str, Any] = {}
|
||||
for k, v in orig_dict.items():
|
||||
k = [k]
|
||||
if not updated_dict.get(v):
|
||||
@@ -402,7 +402,7 @@ class ListNetworkSegmentRange(command.Lister):
|
||||
'available',
|
||||
)
|
||||
|
||||
display_props: tuple[ty.Any, ...] = tuple()
|
||||
display_props: tuple[Any, ...] = tuple()
|
||||
for s in data:
|
||||
props = utils.get_item_properties(s, columns)
|
||||
if (
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"""Network trunk and subports action implementations"""
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib.cli import format_columns
|
||||
@@ -365,7 +365,7 @@ def _get_columns(item):
|
||||
|
||||
|
||||
def _get_attrs_for_trunk(network_client, identity_client, parsed_args):
|
||||
attrs: dict[str, ty.Any] = {}
|
||||
attrs: dict[str, Any] = {}
|
||||
if parsed_args.name is not None:
|
||||
attrs['name'] = str(parsed_args.name)
|
||||
if parsed_args.description is not None:
|
||||
|
||||
@@ -17,7 +17,7 @@ import argparse
|
||||
import copy
|
||||
import json
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib.cli import format_columns
|
||||
@@ -40,7 +40,7 @@ class AdminStateColumn(cliff_columns.FormattableColumn[bool]):
|
||||
|
||||
|
||||
class SubPortColumn(format_columns.ListDictColumn):
|
||||
_value: ty.Any
|
||||
_value: Any
|
||||
|
||||
def _retrieve_subports(self):
|
||||
if isinstance(self._value, dict):
|
||||
|
||||
@@ -18,7 +18,7 @@ import collections
|
||||
import copy
|
||||
import json
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib.cli import format_columns
|
||||
@@ -40,7 +40,7 @@ class AdminStateColumn(cliff_columns.FormattableColumn[bool]):
|
||||
return 'UP' if self._value else 'DOWN'
|
||||
|
||||
|
||||
class RouterInfoColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class RouterInfoColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
try:
|
||||
return json.dumps(self._value)
|
||||
@@ -48,7 +48,7 @@ class RouterInfoColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
return ''
|
||||
|
||||
|
||||
class RoutesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class RoutesColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
# Map the route keys to match --route option.
|
||||
for route in self._value or []:
|
||||
@@ -110,7 +110,7 @@ def _passed_multiple_gateways(extension_supported, external_gateways):
|
||||
|
||||
|
||||
def _get_external_gateway_attrs(client_manager, parsed_args):
|
||||
attrs: dict[str, ty.Any] = {}
|
||||
attrs: dict[str, Any] = {}
|
||||
|
||||
if parsed_args.external_gateways:
|
||||
external_gateways: collections.defaultdict[str, list[dict]] = (
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"""Security Group action implementations"""
|
||||
|
||||
import argparse
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib import utils
|
||||
@@ -66,12 +66,12 @@ def _format_compute_security_group_rules(sg_rules):
|
||||
return utils.format_list(rules, separator='\n')
|
||||
|
||||
|
||||
class NetworkSecurityGroupRulesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class NetworkSecurityGroupRulesColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
return _format_network_security_group_rules(self._value)
|
||||
|
||||
|
||||
class ComputeSecurityGroupRulesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class ComputeSecurityGroupRulesColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
return _format_compute_security_group_rules(self._value)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import copy
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib.cli import format_columns
|
||||
@@ -44,7 +44,7 @@ def _update_arguments(obj_list, parsed_args_list, option):
|
||||
raise exceptions.CommandError(msg)
|
||||
|
||||
|
||||
class AllocationPoolsColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class AllocationPoolsColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
pool_formatted = [
|
||||
'{}-{}'.format(pool.get('start', ''), pool.get('end', ''))
|
||||
@@ -53,7 +53,7 @@ class AllocationPoolsColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
return ','.join(pool_formatted)
|
||||
|
||||
|
||||
class HostRoutesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class HostRoutesColumn(cliff_columns.FormattableColumn[Any]):
|
||||
def human_readable(self):
|
||||
# Map the host route keys to match --host-route option.
|
||||
return utils.format_list_of_dicts(
|
||||
@@ -61,7 +61,7 @@ class HostRoutesColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
)
|
||||
|
||||
|
||||
class UnsortedListColumn(cliff_columns.FormattableColumn[list[ty.Any]]):
|
||||
class UnsortedListColumn(cliff_columns.FormattableColumn[list[Any]]):
|
||||
# format_columns.ListColumn sorts the output, but for things like
|
||||
# DNS server addresses the order matters
|
||||
def human_readable(self):
|
||||
@@ -831,7 +831,7 @@ class UnsetSubnet(common.NeutronUnsetCommandWithExtraArgs):
|
||||
client = self.app.client_manager.network
|
||||
obj = client.find_subnet(parsed_args.subnet, ignore_missing=False)
|
||||
|
||||
attrs: dict[str, ty.Any] = {}
|
||||
attrs: dict[str, Any] = {}
|
||||
if parsed_args.gateway:
|
||||
attrs['gateway_ip'] = None
|
||||
if parsed_args.dns_nameservers:
|
||||
|
||||
@@ -18,7 +18,7 @@ import argparse
|
||||
import copy
|
||||
import functools
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from openstack.block_storage.v2 import volume as _volume
|
||||
@@ -61,7 +61,7 @@ class KeyValueHintAction(argparse.Action):
|
||||
)
|
||||
|
||||
|
||||
class AttachmentsColumn(cliff_columns.FormattableColumn[list[ty.Any]]):
|
||||
class AttachmentsColumn(cliff_columns.FormattableColumn[list[Any]]):
|
||||
"""Formattable column for attachments column.
|
||||
|
||||
Unlike the parent FormattableColumn class, the initializer of the
|
||||
@@ -92,7 +92,7 @@ class AttachmentsColumn(cliff_columns.FormattableColumn[list[ty.Any]]):
|
||||
return msg
|
||||
|
||||
|
||||
def _format_volume(volume: _volume.Volume) -> dict[str, ty.Any]:
|
||||
def _format_volume(volume: _volume.Volume) -> dict[str, Any]:
|
||||
# Some columns returned by openstacksdk should not be shown because they're
|
||||
# either irrelevant or duplicates
|
||||
ignored_columns = {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import functools
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from openstack.block_storage.v2 import snapshot as _snapshot
|
||||
@@ -61,7 +61,7 @@ class VolumeIdColumn(cliff_columns.FormattableColumn[str]):
|
||||
return volume
|
||||
|
||||
|
||||
def _format_snapshot(snapshot: _snapshot.Snapshot) -> dict[str, ty.Any]:
|
||||
def _format_snapshot(snapshot: _snapshot.Snapshot) -> dict[str, Any]:
|
||||
# Some columns returned by openstacksdk should not be shown because they're
|
||||
# either irrelevant or duplicates
|
||||
ignored_columns = {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import functools
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from osc_lib.cli import format_columns
|
||||
@@ -32,7 +32,7 @@ from openstackclient.identity import common as identity_common
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EncryptionInfoColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class EncryptionInfoColumn(cliff_columns.FormattableColumn[Any]):
|
||||
"""Formattable column for encryption info column.
|
||||
|
||||
Unlike the parent FormattableColumn class, the initializer of the
|
||||
|
||||
@@ -18,7 +18,7 @@ import argparse
|
||||
import copy
|
||||
import functools
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from openstack.block_storage.v3 import volume as _volume
|
||||
@@ -62,7 +62,7 @@ class KeyValueHintAction(argparse.Action):
|
||||
)
|
||||
|
||||
|
||||
class AttachmentsColumn(cliff_columns.FormattableColumn[list[ty.Any]]):
|
||||
class AttachmentsColumn(cliff_columns.FormattableColumn[list[Any]]):
|
||||
"""Formattable column for attachments column.
|
||||
|
||||
Unlike the parent FormattableColumn class, the initializer of the
|
||||
@@ -93,7 +93,7 @@ class AttachmentsColumn(cliff_columns.FormattableColumn[list[ty.Any]]):
|
||||
return msg
|
||||
|
||||
|
||||
def _format_volume(volume: _volume.Volume) -> dict[str, ty.Any]:
|
||||
def _format_volume(volume: _volume.Volume) -> dict[str, Any]:
|
||||
# Some columns returned by openstacksdk should not be shown because they're
|
||||
# either irrelevant or duplicates
|
||||
ignored_columns = {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from openstack import utils as sdk_utils
|
||||
from osc_lib.cli import format_columns
|
||||
@@ -57,7 +57,7 @@ def _format_attachment(attachment):
|
||||
# VolumeAttachmentManager.create returns a dict while everything else
|
||||
# returns a VolumeAttachment object
|
||||
if isinstance(attachment, dict):
|
||||
data: tuple[ty.Any, ...] = ()
|
||||
data: tuple[Any, ...] = ()
|
||||
for column in columns:
|
||||
if column == 'connection_info':
|
||||
data += (format_columns.DictColumn(attachment[column]),)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import functools
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from openstack.block_storage.v3 import snapshot as _snapshot
|
||||
@@ -61,7 +61,7 @@ class VolumeIdColumn(cliff_columns.FormattableColumn[str]):
|
||||
return volume
|
||||
|
||||
|
||||
def _format_snapshot(snapshot: _snapshot.Snapshot) -> dict[str, ty.Any]:
|
||||
def _format_snapshot(snapshot: _snapshot.Snapshot) -> dict[str, Any]:
|
||||
# Some columns returned by openstacksdk should not be shown because they're
|
||||
# either irrelevant or duplicates
|
||||
ignored_columns = {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
import functools
|
||||
import logging
|
||||
import typing as ty
|
||||
from typing import Any
|
||||
|
||||
from cinderclient import api_versions
|
||||
from cliff import columns as cliff_columns
|
||||
@@ -32,7 +32,7 @@ from openstackclient.identity import common as identity_common
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EncryptionInfoColumn(cliff_columns.FormattableColumn[ty.Any]):
|
||||
class EncryptionInfoColumn(cliff_columns.FormattableColumn[Any]):
|
||||
"""Formattable column for encryption info column.
|
||||
|
||||
Unlike the parent FormattableColumn class, the initializer of the
|
||||
|
||||
Reference in new issue
Block a user