typing: Indicate tuples to be extended

Change-Id: Ie5907de8d60f2f39e98f6a88227cebb2e2ff565c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2025-02-19 20:15:43 +00:00
parent 9c7a5d4e51
commit bdd55d989d
43 changed files with 164 additions and 185 deletions

View File

@ -172,17 +172,14 @@ class ListAvailabilityZone(command.Lister):
return result
def take_action(self, parsed_args):
columns: tuple[str, ...] = ('Zone Name', 'Zone Status')
if parsed_args.long:
columns = (
'Zone Name',
'Zone Status',
columns += (
'Zone Resource',
'Host Name',
'Service Name',
'Service Status',
)
else:
columns = ('Zone Name', 'Zone Status')
# Show everything by default.
show_all = (

View File

@ -73,17 +73,9 @@ class ListExtension(command.Lister):
return parser
def take_action(self, parsed_args):
columns: tuple[str, ...] = ('Name', 'Alias', 'Description')
if parsed_args.long:
columns = (
'Name',
'Alias',
'Description',
'Namespace',
'Updated At',
'Links',
)
else:
columns = ('Name', 'Alias', 'Description')
columns += ('Namespace', 'Updated At', 'Links')
data = []

View File

@ -290,7 +290,7 @@ class ListQuota(command.Lister):
if default_result != project_result:
result += project_result
columns = (
columns: tuple[str, ...] = (
'id',
'cores',
'injected_files',
@ -303,7 +303,7 @@ class ListQuota(command.Lister):
'server_groups',
'server_group_members',
)
column_headers = (
column_headers: tuple[str, ...] = (
'Project ID',
'Cores',
'Injected Files',
@ -352,7 +352,7 @@ class ListQuota(command.Lister):
if default_result != project_result:
result += project_result
columns = (
columns: tuple[str, ...] = (
'id',
'backups',
'backup_gigabytes',
@ -361,7 +361,7 @@ class ListQuota(command.Lister):
'snapshots',
'volumes',
)
column_headers = (
column_headers: tuple[str, ...] = (
'Project ID',
'Backups',
'Backup Gigabytes',
@ -407,7 +407,7 @@ class ListQuota(command.Lister):
if default_result != project_result:
result += project_result
columns = (
columns: tuple[str, ...] = (
'id',
'floating_ips',
'networks',
@ -419,7 +419,7 @@ class ListQuota(command.Lister):
'subnets',
'subnet_pools',
)
column_headers = (
column_headers: tuple[str, ...] = (
'Project ID',
'Floating IPs',
'Networks',
@ -823,11 +823,11 @@ and ``server-group-members`` output for a given quota class."""
if k not in ('usage', 'reservation')
]
columns = (
columns: tuple[str, ...] = (
'resource',
'limit',
)
column_headers = (
column_headers: tuple[str, ...] = (
'Resource',
'Limit',
)

View File

@ -194,8 +194,8 @@ class ListAggregate(command.Lister):
aggregates = list(compute_client.aggregates())
if sdk_utils.supports_microversion(compute_client, '2.41'):
column_headers = ("ID", "UUID")
columns = ("id", "uuid")
column_headers: tuple[str, ...] = ("ID", "UUID")
columns: tuple[str, ...] = ("id", "uuid")
else:
column_headers = ("ID",)
columns = ("id",)

View File

@ -329,7 +329,7 @@ class ListFlavor(command.Lister):
if parsed_args.long and not f.extra_specs:
compute_client.fetch_flavor_extra_specs(f)
columns = (
columns: tuple[str, ...] = (
"id",
"name",
"ram",
@ -345,7 +345,7 @@ class ListFlavor(command.Lister):
"extra_specs",
)
column_headers = (
column_headers: tuple[str, ...] = (
"ID",
"Name",
"RAM",

View File

@ -119,14 +119,20 @@ class ListHypervisor(command.Lister):
if parsed_args.matching:
list_opts['hypervisor_hostname_pattern'] = parsed_args.matching
column_headers = (
column_headers: tuple[str, ...] = (
"ID",
"Hypervisor Hostname",
"Hypervisor Type",
"Host IP",
"State",
)
columns = ('id', 'name', 'hypervisor_type', 'host_ip', 'state')
columns: tuple[str, ...] = (
'id',
'name',
'hypervisor_type',
'host_ip',
'state',
)
if parsed_args.long:
if not sdk_utils.supports_microversion(compute_client, '2.88'):

View File

@ -372,7 +372,7 @@ class ListKeypair(command.Lister):
else:
data = compute_client.keypairs(**kwargs)
columns = ("Name", "Fingerprint")
columns: tuple[str, ...] = ("Name", "Fingerprint")
if sdk_utils.supports_microversion(compute_client, '2.2'):
columns += ("Type",)

View File

@ -430,7 +430,7 @@ class AddFixedIP(command.ShowOne):
interface = compute_client.create_server_interface(server.id, **kwargs)
columns = (
columns: tuple[str, ...] = (
'port_id',
'server_id',
'net_id',
@ -438,7 +438,7 @@ class AddFixedIP(command.ShowOne):
'port_state',
'fixed_ips',
)
column_headers = (
column_headers: tuple[str, ...] = (
'Port ID',
'Server ID',
'Network ID',
@ -842,8 +842,13 @@ with status ``SHELVED`` or ``SHELVED_OFFLOADED``."""
**kwargs,
)
columns = ('id', 'server id', 'volume id', 'device')
column_headers = ('ID', 'Server ID', 'Volume ID', 'Device')
columns: tuple[str, ...] = ('id', 'server id', 'volume id', 'device')
column_headers: tuple[str, ...] = (
'ID',
'Server ID',
'Volume ID',
'Device',
)
if sdk_utils.supports_microversion(compute_client, '2.49'):
columns += ('tag',)
column_headers += ('Tag',)
@ -2802,12 +2807,12 @@ class ListServer(command.Lister):
msg % search_opts['changes-since']
)
columns = (
columns: tuple[str, ...] = (
'id',
'name',
'status',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
'Status',

View File

@ -220,13 +220,13 @@ class ListServerEvent(command.Lister):
data = compute_client.server_actions(server_id, **kwargs)
columns = (
columns: tuple[str, ...] = (
'request_id',
'server_id',
'action',
'start_time',
)
column_headers = (
column_headers: tuple[str, ...] = (
'Request ID',
'Server ID',
'Action',

View File

@ -216,12 +216,12 @@ class ListServerGroup(command.Lister):
if sdk_utils.supports_microversion(compute_client, '2.64'):
policy_key = 'Policy'
columns = (
columns: tuple[str, ...] = (
'id',
'name',
policy_key.lower(),
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
policy_key,

View File

@ -333,7 +333,7 @@ class ShowMigration(command.ShowOne):
ignore_missing=False,
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Server UUID',
'Status',
@ -352,7 +352,7 @@ class ShowMigration(command.ShowOne):
'Updated At',
)
columns = (
columns: tuple[str, ...] = (
'id',
'server_id',
'status',

View File

@ -42,8 +42,8 @@ class ListServerVolume(command.Lister):
)
volumes = compute_client.volume_attachments(server)
columns = ()
column_headers = ()
columns: tuple[str, ...] = ()
column_headers: tuple[str, ...] = ()
if not sdk_utils.supports_microversion(compute_client, '2.89'):
columns += ('id',)

View File

@ -109,7 +109,7 @@ deployment."""
def take_action(self, parsed_args):
compute_client = self.app.client_manager.sdk_connection.compute
columns = (
columns: tuple[str, ...] = (
"id",
"binary",
"host",
@ -118,7 +118,7 @@ deployment."""
"state",
"updated_at",
)
column_headers = (
column_headers: tuple[str, ...] = (
"ID",
"Binary",
"Host",

View File

@ -133,18 +133,19 @@ class ListEndpoint(command.Lister):
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
columns: tuple[str, ...] = (
'ID',
'Region',
'Service Name',
'Service Type',
)
if parsed_args.long:
columns = (
'ID',
'Region',
'Service Name',
'Service Type',
columns += (
'PublicURL',
'AdminURL',
'InternalURL',
)
else:
columns = ('ID', 'Region', 'Service Name', 'Service Type')
data = identity_client.endpoints.list()
for ep in data:

View File

@ -170,10 +170,9 @@ class ListProject(command.Lister):
return parser
def take_action(self, parsed_args):
columns: tuple[str, ...] = ('ID', 'Name')
if parsed_args.long:
columns = ('ID', 'Name', 'Description', 'Enabled')
else:
columns = ('ID', 'Name')
columns += ('Description', 'Enabled')
data = self.app.client_manager.identity.tenants.list()
if parsed_args.sort:
data = utils.sort_items(data, parsed_args.sort)

View File

@ -121,10 +121,9 @@ class ListService(command.Lister):
return parser
def take_action(self, parsed_args):
columns: tuple[str, ...] = ('ID', 'Name', 'Type')
if parsed_args.long:
columns = ('ID', 'Name', 'Type', 'Description')
else:
columns = ('ID', 'Name', 'Type')
columns += ('Description',)
data = self.app.client_manager.identity.services.list()
return (
columns,

View File

@ -230,21 +230,11 @@ class ListUser(command.Lister):
)
project = project.id
columns: tuple[str, ...] = ('id', 'name')
column_headers: tuple[str, ...] = ('ID', 'Name')
if parsed_args.long:
columns = (
'ID',
'Name',
'tenantId',
'Email',
'Enabled',
)
column_headers = (
'ID',
'Name',
'Project',
'Email',
'Enabled',
)
columns += ('tenantId', 'email', 'enabled')
column_headers += ('Project', 'Email', 'Enabled')
# Cache the project list
project_cache = {}
try:
@ -256,8 +246,6 @@ class ListUser(command.Lister):
formatters['tenantId'] = functools.partial(
ProjectColumn, project_cache=project_cache
)
else:
columns = column_headers = ('ID', 'Name')
data = identity_client.users.list(tenant_id=project)
if parsed_args.project:

View File

@ -224,7 +224,7 @@ class ListEndpoint(command.Lister):
)
if endpoint:
columns = ('ID', 'Name')
columns: tuple[str, ...] = ('ID', 'Name')
data = identity_client.endpoint_filter.list_projects_for_endpoint(
endpoint=endpoint.id
)

View File

@ -278,10 +278,9 @@ class ListGroup(command.Lister):
user = None
# List groups
columns: tuple[str, ...] = ('ID', 'Name')
if parsed_args.long:
columns = ('ID', 'Name', 'Domain ID', 'Description')
else:
columns = ('ID', 'Name')
columns += ('Domain ID', 'Description')
data = identity_client.groups.list(
domain=domain,
user=user,

View File

@ -113,12 +113,11 @@ class ListPolicy(command.Lister):
return parser
def take_action(self, parsed_args):
columns: tuple[str, ...] = ('ID', 'Type')
column_headers: tuple[str, ...] = columns
if parsed_args.long:
columns = ('ID', 'Type', 'Blob')
column_headers = ('ID', 'Type', 'Rules')
else:
columns = ('ID', 'Type')
column_headers = columns
columns += ('Blob',)
column_headers += ('Rules',)
data = self.app.client_manager.identity.policies.list()
return (
column_headers,

View File

@ -245,10 +245,9 @@ class ListProject(command.Lister):
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
columns: tuple[str, ...] = ('ID', 'Name')
if parsed_args.long:
columns = ('ID', 'Name', 'Domain ID', 'Description', 'Enabled')
else:
columns = ('ID', 'Name')
columns += ('Domain ID', 'Description', 'Enabled')
kwargs = {}
domain_id = None

View File

@ -428,7 +428,7 @@ class ListRole(command.Lister):
domain = identity_client.find_domain(
name_or_id=parsed_args.domain,
)
columns = ('ID', 'Name', 'Domain')
columns: tuple[str, ...] = ('ID', 'Name', 'Domain')
data = identity_client.roles(domain_id=domain.id)
else:
columns = ('ID', 'Name')

View File

@ -158,12 +158,11 @@ class ListService(command.Lister):
def take_action(self, parsed_args):
identity_client = self.app.client_manager.sdk_connection.identity
columns: tuple[str, ...] = ('id', 'name', 'type')
column_headers: tuple[str, ...] = ('ID', 'Name', 'Type')
if parsed_args.long:
columns = ('id', 'name', 'type', 'description', 'is_enabled')
column_headers = ('ID', 'Name', 'Type', 'Description', 'Enabled')
else:
columns = ('id', 'name', 'type')
column_headers = ('ID', 'Name', 'Type')
columns += ('description', 'is_enabled')
column_headers += ('Description', 'Enabled')
data = identity_client.services()

View File

@ -467,7 +467,7 @@ class ListImage(command.Lister):
kwargs['is_private'] = True
if parsed_args.long:
columns = (
columns: tuple[str, ...] = (
'ID',
'Name',
'Disk Format',
@ -480,7 +480,7 @@ class ListImage(command.Lister):
'owner_id',
'properties',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
'Disk Format',

View File

@ -881,7 +881,7 @@ class ListImage(command.Lister):
if parsed_args.is_hidden:
kwargs['is_hidden'] = parsed_args.is_hidden
if parsed_args.long:
columns = (
columns: tuple[str, ...] = (
'ID',
'Name',
'Disk Format',
@ -894,7 +894,7 @@ class ListImage(command.Lister):
'owner_id',
'tags',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
'Disk Format',
@ -956,7 +956,7 @@ class ListImageProjects(command.Lister):
def take_action(self, parsed_args):
image_client = self.app.client_manager.image
columns = ("Image ID", "Member ID", "Status")
columns: tuple[str, ...] = ("Image ID", "Member ID", "Status")
image_id = image_client.find_image(
parsed_args.image,
@ -1862,8 +1862,8 @@ class StoresInfo(command.Lister):
def take_action(self, parsed_args):
image_client = self.app.client_manager.image
try:
columns = ("id", "description", "is_default")
column_headers = ("ID", "Description", "Default")
columns: tuple[str, ...] = ("id", "description", "is_default")
column_headers: tuple[str, ...] = ("ID", "Description", "Default")
if parsed_args.detail:
columns += ("properties",)
column_headers += ("Properties",)

View File

@ -318,7 +318,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
network_client = self.app.client_manager.network
identity_client = self.app.client_manager.identity
columns = (
columns: tuple[str, ...] = (
'id',
'floating_ip_address',
'fixed_ip_address',
@ -326,7 +326,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
'floating_network_id',
'project_id',
)
headers = (
headers: tuple[str, ...] = (
'ID',
'Floating IP Address',
'Fixed IP Address',
@ -335,7 +335,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
'Project',
)
if parsed_args.long:
columns = columns + (
columns += (
'router_id',
'status',
'description',
@ -343,7 +343,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
'dns_name',
'dns_domain',
)
headers = headers + (
headers += (
'Router',
'Status',
'Description',
@ -403,14 +403,14 @@ class ListFloatingIP(common.NetworkAndComputeLister):
)
def take_action_compute(self, client, parsed_args):
columns = (
columns: tuple[str, ...] = (
'ID',
'IP',
'Fixed IP',
'Instance ID',
'Pool',
)
headers = (
headers: tuple[str, ...] = (
'ID',
'Floating IP Address',
'Fixed IP Address',

View File

@ -573,7 +573,7 @@ class ListNetwork(common.NetworkAndComputeLister):
def take_action_network(self, client, parsed_args):
identity_client = self.app.client_manager.identity
if parsed_args.long:
columns = (
columns: tuple[str, ...] = (
'id',
'name',
'status',
@ -586,7 +586,7 @@ class ListNetwork(common.NetworkAndComputeLister):
'availability_zones',
'tags',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
'Status',

View File

@ -223,7 +223,7 @@ class ListNetworkAgent(command.Lister):
def take_action(self, parsed_args):
client = self.app.client_manager.network
columns = (
columns: tuple[str, ...] = (
'id',
'agent_type',
'host',
@ -232,7 +232,7 @@ class ListNetworkAgent(command.Lister):
'is_admin_state_up',
'binary',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Agent Type',
'Host',

View File

@ -265,12 +265,12 @@ class ListNetworkRBAC(command.Lister):
def take_action(self, parsed_args):
client = self.app.client_manager.network
columns = (
columns: tuple[str, ...] = (
'id',
'object_type',
'object_id',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Object Type',
'Object ID',

View File

@ -178,14 +178,14 @@ class ListNetworkSegment(command.Lister):
filters = {'network_id': _network.id}
data = network_client.segments(**filters)
headers = (
headers: tuple[str, ...] = (
'ID',
'Name',
'Network',
'Network Type',
'Segment',
)
columns = (
columns: tuple[str, ...] = (
'id',
'name',
'network_id',
@ -193,8 +193,8 @@ class ListNetworkSegment(command.Lister):
'segmentation_id',
)
if parsed_args.long:
headers = headers + ('Physical Network',)
columns = columns + ('physical_network',)
headers += ('Physical Network',)
columns += ('physical_network',)
return (
headers,

View File

@ -42,9 +42,9 @@ def _get_columns(item):
def _get_ranges(item):
item = sorted([int(i) for i in item])
for a, b in itertools.groupby(enumerate(item), lambda xy: xy[1] - xy[0]):
b = list(b)
c = list(b)
yield (
f"{b[0][1]}-{b[-1][1]}" if b[0][1] != b[-1][1] else str(b[0][1])
f"{c[0][1]}-{c[-1][1]}" if c[0][1] != c[-1][1] else str(c[0][1])
)
@ -354,7 +354,7 @@ class ListNetworkSegmentRange(command.Lister):
filters = {}
data = network_client.network_segment_ranges(**filters)
headers = (
headers: tuple[str, ...] = (
'ID',
'Name',
'Default',
@ -365,7 +365,7 @@ class ListNetworkSegmentRange(command.Lister):
'Minimum ID',
'Maximum ID',
)
columns = (
columns: tuple[str, ...] = (
'id',
'name',
'default',
@ -387,11 +387,11 @@ class ListNetworkSegmentRange(command.Lister):
# should be listed in output.
parsed_args.long = True
if parsed_args.long:
headers = headers + (
headers += (
'Used',
'Available',
)
columns = columns + (
columns += (
'used',
'available',
)

View File

@ -151,8 +151,8 @@ class ListNetworkTrunk(command.Lister):
def take_action(self, parsed_args):
client = self.app.client_manager.network
data = client.trunks()
headers = ('ID', 'Name', 'Parent Port', 'Description')
columns = ('id', 'name', 'port_id', 'description')
headers: tuple[str, ...] = ('ID', 'Name', 'Parent Port', 'Description')
columns: tuple[str, ...] = ('id', 'name', 'port_id', 'description')
if parsed_args.long:
headers += (
'Status',
@ -277,8 +277,16 @@ class ListNetworkSubport(command.Lister):
client = self.app.client_manager.network
trunk_id = client.find_trunk(parsed_args.trunk)
data = client.get_trunk_subports(trunk_id)
headers = ('Port', 'Segmentation Type', 'Segmentation ID')
columns = ('port_id', 'segmentation_type', 'segmentation_id')
headers: tuple[str, ...] = (
'Port',
'Segmentation Type',
'Segmentation ID',
)
columns: tuple[str, ...] = (
'port_id',
'segmentation_type',
'segmentation_id',
)
return (
headers,
(

View File

@ -734,14 +734,14 @@ class ListRouter(command.Lister):
identity_client = self.app.client_manager.identity
client = self.app.client_manager.network
columns = (
columns: tuple[str, ...] = (
'id',
'name',
'status',
'is_admin_state_up',
'project_id',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
'Status',
@ -787,27 +787,27 @@ class ListRouter(command.Lister):
d.is_distributed is not None
and 'is_distributed' not in columns
):
columns = columns + ('is_distributed',)
column_headers = column_headers + ('Distributed',)
columns += ('is_distributed',)
column_headers += ('Distributed',)
if d.is_ha is not None and 'is_ha' not in columns:
columns = columns + ('is_ha',)
column_headers = column_headers + ('HA',)
columns += ('is_ha',)
column_headers += ('HA',)
if parsed_args.long:
columns = columns + (
columns += (
'routes',
'external_gateway_info',
)
column_headers = column_headers + (
column_headers += (
'Routes',
'External gateway info',
)
# availability zone will be available only when
# router_availability_zone extension is enabled
if client.find_extension("router_availability_zone"):
columns = columns + ('availability_zones',)
column_headers = column_headers + ('Availability zones',)
columns = columns + ('tags',)
column_headers = column_headers + ('Tags',)
columns += ('availability_zones',)
column_headers += ('Availability zones',)
columns += ('tags',)
column_headers += ('Tags',)
return (
column_headers,

View File

@ -277,7 +277,7 @@ class ListSecurityGroup(common.NetworkAndComputeLister):
fields=self.FIELDS_TO_RETRIEVE, **filters
)
columns = ("ID", "Name", "Description", "Project ID", "tags")
columns = ("id", "name", "description", "project_id", "tags")
column_headers = ("ID", "Name", "Description", "Project", "Tags")
return (
column_headers,
@ -297,15 +297,11 @@ class ListSecurityGroup(common.NetworkAndComputeLister):
all_projects=parsed_args.all_projects,
)
columns = (
"ID",
"Name",
"Description",
)
column_headers = columns
columns: tuple[str, ...] = ("id", "name", "description")
column_headers: tuple[str, ...] = ("ID", "Name", "Description")
if parsed_args.all_projects:
columns = columns + ('Tenant ID',)
column_headers = column_headers + ('Project',)
columns += ('tenant_id',)
column_headers += ('Project',)
return (
column_headers,
(

View File

@ -451,7 +451,7 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
return parser
def _get_column_headers(self, parsed_args):
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'IP Protocol',
'Ethertype',
@ -461,9 +461,9 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
'Remote Security Group',
)
if self.is_neutron:
column_headers = column_headers + ('Remote Address Group',)
column_headers += ('Remote Address Group',)
if parsed_args.group is None:
column_headers = column_headers + ('Security Group',)
column_headers += ('Security Group',)
return column_headers
def take_action_network(self, client, parsed_args):
@ -474,7 +474,7 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
self.log.warning(msg)
column_headers = self._get_column_headers(parsed_args)
columns = (
columns: tuple[str, ...] = (
'id',
'protocol',
'ether_type',
@ -496,7 +496,7 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
).id
query = {'security_group_id': security_group_id}
else:
columns = columns + ('security_group_id',)
columns += ('security_group_id',)
if parsed_args.ingress:
query['direction'] = 'ingress'
@ -523,7 +523,7 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
def take_action_compute(self, client, parsed_args):
column_headers = self._get_column_headers(parsed_args)
columns = (
columns: tuple[str, ...] = (
"ID",
"IP Protocol",
"Ethertype",
@ -539,7 +539,7 @@ class ListSecurityGroupRule(common.NetworkAndComputeLister):
)
rules_to_list = security_group['rules']
else:
columns = columns + ('parent_group_id',)
columns += ('parent_group_id',)
for security_group in compute_v2.list_security_groups(
client, all_projects=parsed_args.all_projects
):

View File

@ -606,8 +606,8 @@ class ListSubnet(command.Lister):
_tag.get_tag_filtering_args(parsed_args, filters)
data = network_client.subnets(**filters)
headers = ('ID', 'Name', 'Network', 'Subnet')
columns = ('id', 'name', 'network_id', 'cidr')
headers: tuple[str, ...] = ('ID', 'Name', 'Network', 'Subnet')
columns: tuple[str, ...] = ('id', 'name', 'network_id', 'cidr')
if parsed_args.long:
headers += (
'Project',

View File

@ -356,8 +356,8 @@ class ListSubnetPool(command.Lister):
_tag.get_tag_filtering_args(parsed_args, filters)
data = network_client.subnet_pools(**filters)
headers = ('ID', 'Name', 'Prefixes')
columns = ('id', 'name', 'prefixes')
headers: tuple[str, ...] = ('ID', 'Name', 'Prefixes')
columns: tuple[str, ...] = ('id', 'name', 'prefixes')
if parsed_args.long:
headers += (
'Default Prefix Length',

View File

@ -148,10 +148,9 @@ class ListContainer(command.Lister):
return parser
def take_action(self, parsed_args):
columns: tuple[str, ...] = ('Name',)
if parsed_args.long:
columns = ('Name', 'Bytes', 'Count')
else:
columns = ('Name',)
columns += ('Bytes', 'Count')
kwargs = {}
if parsed_args.prefix:

View File

@ -162,16 +162,9 @@ class ListObject(command.Lister):
return parser
def take_action(self, parsed_args):
columns: tuple[str, ...] = ('Name',)
if parsed_args.long:
columns = (
'Name',
'Bytes',
'Hash',
'Content Type',
'Last Modified',
)
else:
columns = ('Name',)
columns += ('Bytes', 'Hash', 'Content Type', 'Last Modified')
kwargs = {}
if parsed_args.prefix:

View File

@ -376,7 +376,7 @@ class ListVolume(command.Lister):
volume_client = self.app.client_manager.volume
if parsed_args.long:
columns = (
columns: tuple[str, ...] = (
'ID',
'Display Name',
'Status',
@ -386,7 +386,7 @@ class ListVolume(command.Lister):
'Attachments',
'Metadata',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
'Status',

View File

@ -118,7 +118,7 @@ class CreateVolumeBackup(command.ShowOne):
ignore_missing=False,
).id
columns = (
columns: tuple[str, ...] = (
"id",
"name",
"volume_id",
@ -240,7 +240,7 @@ class ListVolumeBackup(command.Lister):
def take_action(self, parsed_args):
volume_client = self.app.client_manager.sdk_connection.volume
columns = (
columns: tuple[str, ...] = (
'id',
'name',
'description',
@ -249,7 +249,7 @@ class ListVolumeBackup(command.Lister):
'is_incremental',
'created_at',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
'Description',
@ -358,7 +358,7 @@ class RestoreVolumeBackup(command.ShowOne):
ignore_missing=False,
)
columns = (
columns: tuple[str, ...] = (
'id',
'volume_id',
'volume_name',
@ -448,7 +448,7 @@ class ShowVolumeBackup(command.ShowOne):
def take_action(self, parsed_args):
volume_client = self.app.client_manager.sdk_connection.volume
backup = volume_client.find_backup(parsed_args.backup)
columns = (
columns: tuple[str, ...] = (
"availability_zone",
"container",
"created_at",

View File

@ -19,13 +19,13 @@ from openstackclient.i18n import _
def _format_cluster(cluster, detailed=False):
columns = (
columns: tuple[str, ...] = (
'name',
'binary',
'state',
'status',
)
column_headers = (
column_headers: tuple[str, ...] = (
'Name',
'Binary',
'State',
@ -147,7 +147,7 @@ class ListBlockStorageCluster(command.Lister):
)
raise exceptions.CommandError(msg)
columns = ('Name', 'Binary', 'State', 'Status')
columns: tuple[str, ...] = ('Name', 'Binary', 'State', 'Status')
if parsed_args.long:
columns += (
'Num Hosts',

View File

@ -162,7 +162,7 @@ class CreateVolumeBackup(command.ShowOne):
kwargs['availability_zone'] = parsed_args.availability_zone
columns = (
columns: tuple[str, ...] = (
"id",
"name",
"volume_id",
@ -298,7 +298,7 @@ class ListVolumeBackup(command.Lister):
def take_action(self, parsed_args):
volume_client = self.app.client_manager.sdk_connection.volume
columns = (
columns: tuple[str, ...] = (
'id',
'name',
'description',
@ -307,7 +307,7 @@ class ListVolumeBackup(command.Lister):
'is_incremental',
'created_at',
)
column_headers = (
column_headers: tuple[str, ...] = (
'ID',
'Name',
'Description',
@ -411,7 +411,7 @@ class RestoreVolumeBackup(command.ShowOne):
def take_action(self, parsed_args):
volume_client = self.app.client_manager.sdk_connection.volume
columns = (
columns: tuple[str, ...] = (
'id',
'volume_id',
'volume_name',
@ -654,7 +654,7 @@ class ShowVolumeBackup(command.ShowOne):
def take_action(self, parsed_args):
volume_client = self.app.client_manager.sdk_connection.volume
backup = volume_client.find_backup(parsed_args.backup)
columns = (
columns: tuple[str, ...] = (
"availability_zone",
"container",
"created_at",