From 584b8434872322a9f617831742cc6b15977ecfbc Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 10 Nov 2016 21:01:12 -0500 Subject: pep8: fix style errors reported by pycodestyle 2.1.0 pycodestyle 2.1.0 is in Ubuntu zesty, and complained about the changes made here. Simple style changes. This makes 'make pep8' pass again when built in a zesty build system with proposed enabled. --- cloudinit/config/cc_ca_certs.py | 4 ++-- cloudinit/config/cc_growpart.py | 1 + cloudinit/config/cc_resizefs.py | 1 + cloudinit/handlers/upstart_job.py | 1 + cloudinit/safeyaml.py | 1 + cloudinit/sources/DataSourceAliYun.py | 1 + cloudinit/sources/DataSourceAltCloud.py | 1 + cloudinit/sources/DataSourceBigstep.py | 1 + cloudinit/sources/DataSourceEc2.py | 1 + cloudinit/sources/DataSourceGCE.py | 1 + cloudinit/util.py | 4 ++-- 11 files changed, 13 insertions(+), 4 deletions(-) (limited to 'cloudinit') diff --git a/cloudinit/config/cc_ca_certs.py b/cloudinit/config/cc_ca_certs.py index 8d319e22..df77ba62 100644 --- a/cloudinit/config/cc_ca_certs.py +++ b/cloudinit/config/cc_ca_certs.py @@ -82,8 +82,8 @@ def add_ca_certs(certs): # We have to strip the content because blank lines in the file # causes subsequent entries to be ignored. (LP: #1077020) orig = util.load_file(CA_CERT_CONFIG) - cur_cont = '\n'.join([l for l in orig.splitlines() - if l != CA_CERT_FILENAME]) + cur_cont = '\n'.join([line for line in orig.splitlines() + if line != CA_CERT_FILENAME]) out = "%s\n%s\n" % (cur_cont.rstrip(), CA_CERT_FILENAME) util.write_file(CA_CERT_CONFIG, out, omode="wb") diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py index a95e6c81..03df6047 100644 --- a/cloudinit/config/cc_growpart.py +++ b/cloudinit/config/cc_growpart.py @@ -354,4 +354,5 @@ def handle(_name, cfg, _cloud, log, _args): else: log.debug("'%s' %s: %s" % (entry, action, msg)) + RESIZERS = (('growpart', ResizeGrowPart), ('gpart', ResizeGpart)) diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index 1b917966..f3c36c9b 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -69,6 +69,7 @@ def _resize_xfs(mount_point, devpth): def _resize_ufs(mount_point, devpth): return ('growfs', devpth) + # Do not use a dictionary as these commands should be able to be used # for multiple filesystem types if possible, e.g. one command for # ext2, ext3 and ext4. diff --git a/cloudinit/handlers/upstart_job.py b/cloudinit/handlers/upstart_job.py index ab381e00..309af91e 100644 --- a/cloudinit/handlers/upstart_job.py +++ b/cloudinit/handlers/upstart_job.py @@ -116,4 +116,5 @@ def _has_suitable_upstart(): else: return True + SUITABLE_UPSTART = _has_suitable_upstart() diff --git a/cloudinit/safeyaml.py b/cloudinit/safeyaml.py index eba5d056..f6a3f765 100644 --- a/cloudinit/safeyaml.py +++ b/cloudinit/safeyaml.py @@ -23,6 +23,7 @@ class _CustomSafeLoader(yaml.SafeLoader): def construct_python_unicode(self, node): return self.construct_scalar(node) + _CustomSafeLoader.add_constructor( u'tag:yaml.org,2002:python/unicode', _CustomSafeLoader.construct_python_unicode) diff --git a/cloudinit/sources/DataSourceAliYun.py b/cloudinit/sources/DataSourceAliYun.py index 19957212..535813ab 100644 --- a/cloudinit/sources/DataSourceAliYun.py +++ b/cloudinit/sources/DataSourceAliYun.py @@ -38,6 +38,7 @@ def parse_public_keys(public_keys): keys.extend(key) return keys + # Used to match classes to dependencies datasources = [ (DataSourceAliYun, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), diff --git a/cloudinit/sources/DataSourceAltCloud.py b/cloudinit/sources/DataSourceAltCloud.py index 20345389..fac7bbcc 100644 --- a/cloudinit/sources/DataSourceAltCloud.py +++ b/cloudinit/sources/DataSourceAltCloud.py @@ -270,6 +270,7 @@ class DataSourceAltCloud(sources.DataSource): else: return False + # Used to match classes to dependencies # Source DataSourceAltCloud does not really depend on networking. # In the future 'dsmode' like behavior can be added to offer user diff --git a/cloudinit/sources/DataSourceBigstep.py b/cloudinit/sources/DataSourceBigstep.py index f80956a5..e8fd0088 100644 --- a/cloudinit/sources/DataSourceBigstep.py +++ b/cloudinit/sources/DataSourceBigstep.py @@ -46,6 +46,7 @@ def get_url_from_file(): raise return content + # Used to match classes to dependencies datasources = [ (DataSourceBigstep, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py index c0b7ddd3..acbc2356 100644 --- a/cloudinit/sources/DataSourceEc2.py +++ b/cloudinit/sources/DataSourceEc2.py @@ -202,6 +202,7 @@ class DataSourceEc2(sources.DataSource): return az[:-1] return None + # Used to match classes to dependencies datasources = [ (DataSourceEc2, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py index 6c12d703..5ed59559 100644 --- a/cloudinit/sources/DataSourceGCE.py +++ b/cloudinit/sources/DataSourceGCE.py @@ -156,6 +156,7 @@ class DataSourceGCE(sources.DataSource): def region(self): return self.availability_zone.rsplit('-', 1)[0] + # Used to match classes to dependencies datasources = [ (DataSourceGCE, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), diff --git a/cloudinit/util.py b/cloudinit/util.py index 9a3d3cd7..ed2d93e5 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -2030,8 +2030,8 @@ def parse_mount_info(path, mountinfo_lines, log=LOG): continue # Ignore mounts where the common path is not the same. - l = min(len(mount_point_elements), len(path_elements)) - if mount_point_elements[0:l] != path_elements[0:l]: + x = min(len(mount_point_elements), len(path_elements)) + if mount_point_elements[0:x] != path_elements[0:x]: continue # Ignore mount points higher than an already seen mount -- cgit v1.2.3