Skip to content

Commit 28ffa2b

Browse files
committed
Blacken openstackclient.compute
Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: I9af45c062d179ab3dc2a5e969e1c467932753a2b Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
1 parent 5cb16ae commit 28ffa2b

43 files changed

Lines changed: 4903 additions & 4155 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

openstackclient/compute/client.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ def make_client(instance):
5151
else:
5252
version = instance._api_version[API_NAME]
5353
from novaclient import api_versions
54+
5455
# convert to APIVersion object
5556
version = api_versions.get_api_version(version)
5657

5758
if version.is_latest():
5859
import novaclient
60+
5961
# NOTE(RuiChen): executing version discovery make sense, but that need
6062
# an initialized REST client, it's not available now,
6163
# fallback to use the max version of novaclient side.
@@ -73,8 +75,11 @@ def make_client(instance):
7375
# Set client http_log_debug to True if verbosity level is high enough
7476
http_log_debug = utils.get_effective_log_level() <= logging.DEBUG
7577

76-
extensions = [ext for ext in nova_client.discover_extensions(version)
77-
if ext.name == "list_extensions"]
78+
extensions = [
79+
ext
80+
for ext in nova_client.discover_extensions(version)
81+
if ext.name == "list_extensions"
82+
]
7883

7984
# Remember interface only if it is set
8085
kwargs = utils.build_kwargs_dict('endpoint_type', instance.interface)
@@ -96,7 +101,7 @@ def make_client(instance):
96101
COMPUTE_API_TYPE,
97102
region_name=instance.region_name,
98103
interface=instance.interface,
99-
)
104+
),
100105
)
101106

102107
return client
@@ -108,8 +113,10 @@ def build_option_parser(parser):
108113
'--os-compute-api-version',
109114
metavar='<compute-api-version>',
110115
default=utils.env('OS_COMPUTE_API_VERSION'),
111-
help=_("Compute API version, default=%s "
112-
"(Env: OS_COMPUTE_API_VERSION)") % DEFAULT_API_VERSION
116+
help=_(
117+
"Compute API version, default=%s " "(Env: OS_COMPUTE_API_VERSION)"
118+
)
119+
% DEFAULT_API_VERSION,
113120
)
114121
return parser
115122

openstackclient/compute/v2/agent.py

Lines changed: 32 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,20 @@ class CreateAgent(command.ShowOne):
3737

3838
def get_parser(self, prog_name):
3939
parser = super(CreateAgent, self).get_parser(prog_name)
40-
parser.add_argument(
41-
"os",
42-
metavar="<os>",
43-
help=_("Type of OS")
44-
)
40+
parser.add_argument("os", metavar="<os>", help=_("Type of OS"))
4541
parser.add_argument(
4642
"architecture",
4743
metavar="<architecture>",
48-
help=_("Type of architecture")
49-
)
50-
parser.add_argument(
51-
"version",
52-
metavar="<version>",
53-
help=_("Version")
54-
)
55-
parser.add_argument(
56-
"url",
57-
metavar="<url>",
58-
help=_("URL")
59-
)
60-
parser.add_argument(
61-
"md5hash",
62-
metavar="<md5hash>",
63-
help=_("MD5 hash")
44+
help=_("Type of architecture"),
6445
)
46+
parser.add_argument("version", metavar="<version>", help=_("Version"))
47+
parser.add_argument("url", metavar="<url>", help=_("URL"))
48+
parser.add_argument("md5hash", metavar="<md5hash>", help=_("MD5 hash"))
6549
parser.add_argument(
6650
"hypervisor",
6751
metavar="<hypervisor>",
6852
default="xen",
69-
help=_("Type of hypervisor")
53+
help=_("Type of hypervisor"),
7054
)
7155
return parser
7256

@@ -78,7 +62,7 @@ def take_action(self, parsed_args):
7862
parsed_args.version,
7963
parsed_args.url,
8064
parsed_args.md5hash,
81-
parsed_args.hypervisor
65+
parsed_args.hypervisor,
8266
)
8367
agent = compute_client.agents.create(*args)._info.copy()
8468
return zip(*sorted(agent.items()))
@@ -95,10 +79,7 @@ class DeleteAgent(command.Command):
9579
def get_parser(self, prog_name):
9680
parser = super(DeleteAgent, self).get_parser(prog_name)
9781
parser.add_argument(
98-
"id",
99-
metavar="<id>",
100-
nargs='+',
101-
help=_("ID of agent(s) to delete")
82+
"id", metavar="<id>", nargs='+', help=_("ID of agent(s) to delete")
10283
)
10384
return parser
10485

@@ -110,13 +91,17 @@ def take_action(self, parsed_args):
11091
compute_client.agents.delete(id)
11192
except Exception as e:
11293
result += 1
113-
LOG.error(_("Failed to delete agent with ID '%(id)s': %(e)s"),
114-
{'id': id, 'e': e})
94+
LOG.error(
95+
_("Failed to delete agent with ID '%(id)s': %(e)s"),
96+
{'id': id, 'e': e},
97+
)
11598

11699
if result > 0:
117100
total = len(parsed_args.id)
118-
msg = (_("%(result)s of %(total)s agents failed "
119-
"to delete.") % {'result': result, 'total': total})
101+
msg = _("%(result)s of %(total)s agents failed " "to delete.") % {
102+
'result': result,
103+
'total': total,
104+
}
120105
raise exceptions.CommandError(msg)
121106

122107

@@ -133,7 +118,7 @@ def get_parser(self, prog_name):
133118
parser.add_argument(
134119
"--hypervisor",
135120
metavar="<hypervisor>",
136-
help=_("Type of hypervisor")
121+
help=_("Type of hypervisor"),
137122
)
138123
return parser
139124

@@ -146,13 +131,19 @@ def take_action(self, parsed_args):
146131
"Architecture",
147132
"Version",
148133
"Md5Hash",
149-
"URL"
134+
"URL",
150135
)
151136
data = compute_client.agents.list(parsed_args.hypervisor)
152-
return (columns,
153-
(utils.get_item_properties(
154-
s, columns,
155-
) for s in data))
137+
return (
138+
columns,
139+
(
140+
utils.get_item_properties(
141+
s,
142+
columns,
143+
)
144+
for s in data
145+
),
146+
)
156147

157148

158149
class SetAgent(command.Command):
@@ -165,26 +156,18 @@ class SetAgent(command.Command):
165156

166157
def get_parser(self, prog_name):
167158
parser = super(SetAgent, self).get_parser(prog_name)
168-
parser.add_argument(
169-
"id",
170-
metavar="<id>",
171-
help=_("ID of the agent")
172-
)
159+
parser.add_argument("id", metavar="<id>", help=_("ID of the agent"))
173160
parser.add_argument(
174161
"--agent-version",
175162
dest="version",
176163
metavar="<version>",
177-
help=_("Version of the agent")
164+
help=_("Version of the agent"),
178165
)
179166
parser.add_argument(
180-
"--url",
181-
metavar="<url>",
182-
help=_("URL of the agent")
167+
"--url", metavar="<url>", help=_("URL of the agent")
183168
)
184169
parser.add_argument(
185-
"--md5hash",
186-
metavar="<md5hash>",
187-
help=_("MD5 hash of the agent")
170+
"--md5hash", metavar="<md5hash>", help=_("MD5 hash of the agent")
188171
)
189172
return parser
190173

0 commit comments

Comments
 (0)