Merge lp:~barryprice/juju-deployer/resolve-pep8-failures into lp:juju-deployer

Proposed by Barry Price
Status: Merged
Approved by: Barry Price
Approved revision: 221
Merged at revision: 221
Proposed branch: lp:~barryprice/juju-deployer/resolve-pep8-failures
Merge into: lp:juju-deployer
Prerequisite: lp:~barryprice/juju-deployer/resolve-OpenStack-1501-option-errors
Diff against target: 174 lines (+21/-32)
9 files modified
deployer/action/diff.py (+3/-2)
deployer/config.py (+1/-2)
deployer/deployment.py (+1/-2)
deployer/env/base.py (+3/-3)
deployer/env/go.py (+1/-4)
deployer/relation.py (+2/-6)
deployer/service.py (+4/-5)
deployer/tests/test_diff.py (+3/-2)
deployer/utils.py (+3/-6)
To merge this branch: bzr merge lp:~barryprice/juju-deployer/resolve-pep8-failures
Reviewer Review Type Date Requested Status
Benjamin Allot Approve
Canonical IS Reviewers Pending
Review via email: mp+392359@code.launchpad.net

Commit message

Fix PEP8/Flake8 errors

To post a comment you must log in.
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Benjamin Allot (ballot) wrote :

LGTM

review: Approve
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

Change successfully merged at revision 221

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'deployer/action/diff.py'
2--- deployer/action/diff.py 2016-12-16 11:17:35 +0000
3+++ deployer/action/diff.py 2020-10-16 07:31:11 +0000
4@@ -143,8 +143,9 @@
5 mod['cfg-constraints'] = dep_constraints
6
7 # Now collect all the options from both services and diff them.
8- all_options = (set(dep_service.get('options', {}).keys()) |
9- set(env_service.get('options', {}).keys()))
10+ all_options = (
11+ set(dep_service.get('options', {}).keys()) | set(env_service.get('options', {}).keys())
12+ )
13 for key in all_options:
14 dep_value = dep_service.get('options', {}).get(key)
15 # Assume the charm default if the deployment specifies no value.
16
17=== modified file 'deployer/config.py'
18--- deployer/config.py 2016-07-12 02:29:52 +0000
19+++ deployer/config.py 2020-10-16 07:31:11 +0000
20@@ -59,8 +59,7 @@
21
22 # Check if this is a v4 bundle.
23 services = yaml_result.get('services')
24- if (isinstance(services, dict) and
25- 'services' not in services):
26+ if (isinstance(services, dict) and 'services' not in services):
27 self.version = 4
28 yaml_result = {config_file: yaml_result}
29
30
31=== modified file 'deployer/deployment.py'
32--- deployer/deployment.py 2020-10-07 02:09:02 +0000
33+++ deployer/deployment.py 2020-10-16 07:31:11 +0000
34@@ -256,8 +256,7 @@
35 def _resolve_include(self, svc_name, k, v):
36 feedback = Feedback()
37 for include_type in ["file", "base64"]:
38- if (not isinstance(v, six.string_types) or
39- not v.startswith("include-%s://" % include_type)):
40+ if (not isinstance(v, six.string_types) or not v.startswith("include-%s://" % include_type)):
41 continue
42 include, fname = v.split("://", 1)
43 ip = resolve_include(fname, self.include_dirs)
44
45=== modified file 'deployer/env/base.py'
46--- deployer/env/base.py 2020-02-26 12:08:57 +0000
47+++ deployer/env/base.py 2020-10-16 07:31:11 +0000
48@@ -145,9 +145,9 @@
49 units have finished executing stop hooks and are removed).
50
51 """
52- if (self.juju_version == 1 and
53- ((isinstance(mid, int) and mid == 0) or
54- (mid.isdigit() and int(mid) == 0))):
55+ if (
56+ self.juju_version == 1 and ((isinstance(mid, int) and mid == 0) or (mid.isdigit() and int(mid) == 0))
57+ ):
58 # Don't kill state server
59 raise RuntimeError("Can't terminate machine 0")
60 if get_juju_major_version() == 1:
61
62=== modified file 'deployer/env/go.py'
63--- deployer/env/go.py 2017-08-30 09:01:00 +0000
64+++ deployer/env/go.py 2020-10-16 07:31:11 +0000
65@@ -283,10 +283,7 @@
66 d = NormalizedDelta(d)
67 name = d.get('Name', d.get('Id', 'unknown'))
68 state = (
69- d.get('workload-status') or
70- d.get('Status') or
71- d.get('Life') or
72- 'unknown'
73+ d.get('workload-status') or d.get('Status') or d.get('Life') or 'unknown'
74 )
75 if et == "relation":
76 name = self._format_endpoints(d['Endpoints'])
77
78=== modified file 'deployer/relation.py'
79--- deployer/relation.py 2016-12-20 15:10:01 +0000
80+++ deployer/relation.py 2020-10-16 07:31:11 +0000
81@@ -17,10 +17,7 @@
82 # equal only by service if name is "*" or unset
83 return (
84 (self.ep == ep.ep) or (
85- (not self.name or self.name == "*" or
86- not ep.name or ep.name == "*") and
87- self.service == ep.service
88- )
89+ (not self.name or self.name == "*" or not ep.name or ep.name == "*") and self.service == ep.service)
90 )
91
92
93@@ -35,8 +32,7 @@
94 def __eq__(self, ep_pair):
95 if not isinstance(ep_pair, EndpointPair):
96 return False
97- return (ep_pair.ep_x in self and
98- ep_pair.ep_y in self)
99+ return (ep_pair.ep_x in self and ep_pair.ep_y in self)
100
101 def __contains__(self, ep):
102 return (self.ep_x == ep or self.ep_y == ep)
103
104=== modified file 'deployer/service.py'
105--- deployer/service.py 2017-03-16 04:23:06 +0000
106+++ deployer/service.py 2020-10-16 07:31:11 +0000
107@@ -128,8 +128,7 @@
108 unit_names = list(svc_units.keys())
109 unit_names.sort(key=lambda unit: int(unit.split('/')[1]))
110 machine = (
111- svc_units[unit_names[int(u_idx)]].get('Machine') or
112- svc_units[unit_names[int(u_idx)]].get('machine')
113+ svc_units[unit_names[int(u_idx)]].get('Machine') or svc_units[unit_names[int(u_idx)]].get('machine')
114 )
115 if not machine:
116 self.deployment.log.warning(
117@@ -273,9 +272,9 @@
118 return
119
120 self.service.svc_data['to'] = (
121- unit_mapping +
122- list(itertools.repeat(
123- unit_mapping[-1], unit_count - len(unit_mapping)))
124+ unit_mapping + list(itertools.repeat(
125+ unit_mapping[-1], unit_count - len(unit_mapping))
126+ )
127 )
128 unit_mapping = self.service.unit_placement
129
130
131=== modified file 'deployer/tests/test_diff.py'
132--- deployer/tests/test_diff.py 2020-10-16 07:31:11 +0000
133+++ deployer/tests/test_diff.py 2020-10-16 07:31:11 +0000
134@@ -191,8 +191,9 @@
135 env = MemoryEnvironment(dpl.name, dpl)
136 diff = Diff(env, edited_dpl, {}).do_diff()
137 # verify ceilometer<->keystone present in unknown relations
138- self.assertTrue('ceilometer' in str(diff['relations']['unknown']) and
139- 'keystone' in str(diff['relations']['unknown']))
140+ self.assertTrue(
141+ 'ceilometer' in str(diff['relations']['unknown']) and 'keystone' in str(diff['relations']['unknown'])
142+ )
143
144 def test_diff_cfg_replace_with_unnamed_relations(self):
145 dpl = self.get_deployment()
146
147=== modified file 'deployer/utils.py'
148--- deployer/utils.py 2017-03-16 04:23:06 +0000
149+++ deployer/utils.py 2020-10-16 07:31:11 +0000
150@@ -245,12 +245,10 @@
151 def _get_juju_home():
152 if get_juju_major_version() == 1:
153 return (
154- os.environ.get("JUJU_HOME") or
155- path_join(os.environ.get('HOME'), '.juju')
156+ os.environ.get("JUJU_HOME") or path_join(os.environ.get('HOME'), '.juju')
157 )
158 return (
159- os.environ.get("JUJU_DATA") or
160- path_join(os.environ.get('HOME'), '.local', 'share', 'juju')
161+ os.environ.get("JUJU_DATA") or path_join(os.environ.get('HOME'), '.local', 'share', 'juju')
162 )
163
164
165@@ -325,8 +323,7 @@
166 for (key, value) in source.items():
167 if key == 'relations' and key in target:
168 target[key] = relations_combine(target[key], value)
169- elif (key in target and isinstance(target[key], dict) and
170- isinstance(value, dict)):
171+ elif (key in target and isinstance(target[key], dict) and isinstance(value, dict)):
172 target[key] = dict_merge(target[key], value)
173 else:
174 target[key] = value

Subscribers

People subscribed via source and target branches