Skip to content

Commit e8129af

Browse files
Fix the linting issues
1 parent c3e4a84 commit e8129af

2 files changed

Lines changed: 21 additions & 23 deletions

File tree

juju/bundle.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ async def _download_bundle(self, charm_url, origin):
196196
}])
197197
if len(resp.results) != 1:
198198
raise JujuError("expected one result, received {}".format(resp.results))
199-
199+
200200
result = resp.results[0]
201201
if not result.url:
202202
raise JujuError("no url found for bundle {}".format(charm_url.name))
@@ -208,13 +208,13 @@ async def _download_bundle(self, charm_url, origin):
208208
return self._get_bundle_yaml(archive)
209209

210210
raise JujuError('charm facade not supported')
211-
211+
212212
def _get_bundle_yaml(self, archive):
213213
for member in archive.infolist():
214214
if member.filename == "bundle.yaml":
215215
return archive.read(member)
216216
raise JujuError("bundle.yaml not found")
217-
217+
218218
async def _resolve_charms(self):
219219
deployed = dict()
220220

@@ -243,7 +243,7 @@ async def _resolve_charms(self):
243243
charm_url = URL.parse(spec['charm'])
244244
channel = None
245245
track, risk = '', ''
246-
if 'channel' in spec:
246+
if 'channel' in spec:
247247
channel = Channel.parse(spec['channel'])
248248
track, risk = channel.track, channel.risk
249249

@@ -252,10 +252,10 @@ async def _resolve_charms(self):
252252
else:
253253
architecture = await self.model._resolve_architecture(charm_url)
254254

255-
origin = client.CharmOrigin(source="charm-hub",
256-
architecture=architecture,
257-
risk=risk,
258-
track=track)
255+
origin = client.CharmOrigin(source="charm-hub",
256+
architecture=architecture,
257+
risk=risk,
258+
track=track)
259259
charm_url, charm_origin = await self.model._resolve_charm(charm_url, origin)
260260

261261
spec['charm'] = str(charm_url)
@@ -264,10 +264,9 @@ async def _resolve_charms(self):
264264
self.origins[str(charm_url)] = {}
265265
self.origins[str(charm_url)][str(channel)] = charm_origin
266266
else:
267-
results = await self.client_facade.ResolveCharms(references=[spec['charm']])
267+
await self.client_facade.ResolveCharms(references=[spec['charm']])
268268
# TODO (stickupkid): Ensure that this works as expected.
269269

270-
271270
async def execute_plan(self):
272271
await self._resolve_charms()
273272

@@ -285,11 +284,11 @@ def applications(self):
285284
apps_dict = self.bundle.get('applications',
286285
self.bundle.get('services', {}))
287286
return list(apps_dict.keys())
288-
287+
289288
@property
290289
def applications_specs(self):
291290
return self.bundle.get('applications',
292-
self.bundle.get('services', {}))
291+
self.bundle.get('services', {}))
293292

294293
def resolve_relation(self, reference):
295294
parts = reference.split(":", maxsplit=1)
@@ -307,7 +306,7 @@ def resolve(self, reference):
307306

308307

309308
def is_local_charm(charm_url):
310-
return charm_url.startswith('.') or charm_url.startswith('local:')
309+
return charm_url.startswith('.') or charm_url.startswith('local:')
311310

312311

313312
def get_charm_series(path):
@@ -584,7 +583,7 @@ async def run(self, context):
584583
arch = self.architecture
585584
if not arch:
586585
arch = await context.model._resolve_architecture(url)
587-
origin = client.CharmOrigin(source="charm-hub",
586+
origin = client.CharmOrigin(source="charm-hub",
588587
architecture=arch,
589588
risk=ch.risk,
590589
track=ch.track)

juju/model.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from .names import is_valid_application
3636
from .offerendpoints import ParseError as OfferParseError
3737
from .offerendpoints import parse_local_endpoint, parse_offer_url
38-
from .origin import Channel, Risk
38+
from .origin import Channel
3939
from .placement import parse as parse_placement
4040
from .tag import application as application_tag
4141
from .url import URL, Schema
@@ -1418,7 +1418,6 @@ async def deploy(
14181418
if trust and (self.info.agent_version < client.Number.from_json('2.4.0')):
14191419
raise NotImplementedError("trusted is not supported on model version {}".format(self.info.agent_version))
14201420

1421-
14221421
# Attempt to resolve a charm or bundle based on the URL.
14231422
# In an ideal world this should be moved to the controller, and we
14241423
# wouldn't have to deal with this at all.
@@ -1440,18 +1439,18 @@ async def deploy(
14401439
origin = client.CharmOrigin(source="local", architecture=architecture)
14411440
if not (entity_path.is_dir() or entity_path.is_file()):
14421441
raise JujuError('{} path not found'.format(entity_url))
1443-
1442+
14441443
is_bundle = (
1445-
(entity_url.endswith(".yaml") and entity_path.exists()) or
1444+
(entity_url.endswith(".yaml") and entity_path.exists()) or
14461445
bundle_path.exists()
14471446
)
14481447

14491448
elif Schema.CHARM_STORE.matches(url.schema):
1450-
result = await self.charmstore.entity(str(url),
1449+
result = await self.charmstore.entity(str(url),
14511450
channel=channel,
14521451
include_stats=False)
14531452
identifier = result['Id']
1454-
origin = client.CharmOrigin(source="charm-store",
1453+
origin = client.CharmOrigin(source="charm-store",
14551454
architecture=architecture,
14561455
risk=channel)
14571456
is_bundle = url.series == "bundle"
@@ -1462,7 +1461,7 @@ async def deploy(
14621461
ch = Channel('latest', 'stable')
14631462
if channel:
14641463
ch = Channel.parse(channel).normalize()
1465-
origin = client.CharmOrigin(source="charm-hub",
1464+
origin = client.CharmOrigin(source="charm-hub",
14661465
architecture=architecture,
14671466
risk=ch.risk,
14681467
track=ch.track)
@@ -1598,11 +1597,11 @@ async def _resolve_charm(self, url, origin):
15981597
async def _resolve_architecture(self, url):
15991598
if url.architecture:
16001599
return url.architecture
1601-
1600+
16021601
constraints = await self.get_constraints()
16031602
if 'arch' in constraints:
16041603
return constraints['arch']
1605-
1604+
16061605
return "amd64"
16071606

16081607
async def _add_store_resources(self, application, entity_url,

0 commit comments

Comments
 (0)