Skip to content

Commit d06b6e7

Browse files
committed
ref(*): clean up Go and Python code for make test-style
1 parent ec3a5b1 commit d06b6e7

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

api/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def deploy(self, release, initial=False):
186186
elif release.build.dockerfile and not release.build.procfile:
187187
self.structure = {'cmd': 1}
188188
# if a procfile exists without a web entry, assume docker workflow
189-
elif release.build.procfile and not 'web' in release.build.procfile:
189+
elif release.build.procfile and 'web' not in release.build.procfile:
190190
self.structure = {'cmd': 1}
191191
# default to heroku workflow
192192
else:
@@ -206,7 +206,7 @@ def scale(self, **kwargs): # noqa
206206
for container_type in requested_containers.keys():
207207
if container_type == 'cmd':
208208
continue # allow docker cmd types in case we don't have the image source
209-
if not container_type in available_process_types:
209+
if container_type not in available_process_types:
210210
raise EnvironmentError(
211211
'Container type {} does not exist in application'.format(container_type))
212212
msg = 'Containers scaled ' + ' '.join(

scheduler/coreos.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
if not os.path.exists(ROOT_DIR):
1212
os.mkdir(ROOT_DIR)
1313

14-
MATCH = re.compile('(?P<app>[a-z0-9-]+)_?(?P<version>v[0-9]+)?\.?(?P<c_type>[a-z]+)?.(?P<c_num>[0-9]+)')
14+
MATCH = re.compile(
15+
'(?P<app>[a-z0-9-]+)_?(?P<version>v[0-9]+)?\.?(?P<c_type>[a-z]+)?.(?P<c_num>[0-9]+)')
16+
1517

1618
class FleetClient(object):
1719

@@ -76,15 +78,15 @@ def _create_container(self, name, image, command, template, env, **kwargs):
7678
# prepare memory limit for the container type
7779
mem = kwargs.get('memory', {}).get(l['c_type'], None)
7880
if mem:
79-
l.update({'memory': '-m {}'.format(mem.lower())})
81+
l.update({'memory': '-m {}'.format(mem.lower())})
8082
else:
81-
l.update({'memory': ''})
83+
l.update({'memory': ''})
8284
# prepare memory limit for the container type
8385
cpu = kwargs.get('cpu', {}).get(l['c_type'], None)
8486
if cpu:
85-
l.update({'cpu': '-c {}'.format(cpu)})
87+
l.update({'cpu': '-c {}'.format(cpu)})
8688
else:
87-
l.update({'cpu': ''})
89+
l.update({'cpu': ''})
8890
env.update({'FLEETW_UNIT': name + '.service'})
8991
# construct unit from template
9092
unit = template.format(**l)
@@ -148,7 +150,7 @@ def _wait_for_announcer(self, name, env):
148150
# we bump to 20 minutes here to match the timeout on the router and in the app unit files
149151
for _ in range(1200):
150152
status = subprocess.check_output(
151-
"fleetctl.sh list-units --no-legend --fields unit,sub | grep {name}-announce.service | awk '{{print $2}}'".format(**locals()),
153+
"fleetctl.sh list-units --no-legend --fields unit,sub | grep {name}-announce.service | awk '{{print $2}}'".format(**locals()), # noqa
152154
shell=True, env=env).strip('\n')
153155
if status == 'running':
154156
break
@@ -246,7 +248,7 @@ def attach(self, name):
246248
ExecStart=/bin/sh -c "IMAGE=$(etcdctl get /deis/registry/host 2>&1):$(etcdctl get /deis/registry/port 2>&1)/{image}; port=$(docker inspect -f '{{{{range $k, $v := .ContainerConfig.ExposedPorts }}}}{{{{$k}}}}{{{{end}}}}' $IMAGE | cut -d/ -f1) ; docker run --name {name} {memory} {cpu} -P -e PORT=$port $IMAGE {command}"
247249
ExecStop=/usr/bin/docker rm -f {name}
248250
TimeoutStartSec=20m
249-
"""
251+
""" # noqa
250252

251253
# TODO revisit the "not getting a port" issue after we upgrade to Docker 1.1.0
252254
ANNOUNCE_TEMPLATE = """
@@ -263,7 +265,7 @@ def attach(self, name):
263265
264266
[X-Fleet]
265267
X-ConditionMachineOf={name}.service
266-
"""
268+
""" # noqa
267269

268270
LOG_TEMPLATE = """
269271
[Unit]
@@ -277,4 +279,4 @@ def attach(self, name):
277279
278280
[X-Fleet]
279281
X-ConditionMachineOf={name}.service
280-
"""
282+
""" # noqa

0 commit comments

Comments
 (0)