summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-01-31 10:15:31 -0500
committerGitHub <noreply@github.com>2020-01-31 10:15:31 -0500
commit1bb1896ec900622e02c1ffb59db4d3f2df4a964d (patch)
treeb1339e806a8682e8fdf8582b83630cf9d20ce04a /cloudinit
parent0ecbd888c9491176ae41bbfa2b74a05234882000 (diff)
downloadvyos-cloud-init-1bb1896ec900622e02c1ffb59db4d3f2df4a964d.tar.gz
vyos-cloud-init-1bb1896ec900622e02c1ffb59db4d3f2df4a964d.zip
cloudinit: replace "from six import X" imports (except in util.py) (#183)
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/cmd/devel/tests/test_logs.py2
-rw-r--r--cloudinit/cmd/devel/tests/test_render.py2
-rw-r--r--cloudinit/cmd/tests/test_clean.py2
-rw-r--r--cloudinit/cmd/tests/test_cloud_id.py2
-rw-r--r--cloudinit/cmd/tests/test_main.py2
-rw-r--r--cloudinit/cmd/tests/test_query.py2
-rw-r--r--cloudinit/cmd/tests/test_status.py2
-rw-r--r--cloudinit/config/cc_debug.py3
-rw-r--r--cloudinit/config/cc_landscape.py3
-rw-r--r--cloudinit/config/cc_puppet.py3
-rw-r--r--cloudinit/config/cc_rightscale_userdata.py3
-rw-r--r--cloudinit/config/cc_seed_random.py3
-rw-r--r--cloudinit/config/cc_zypper_add_repo.py3
-rw-r--r--cloudinit/config/tests/test_snap.py2
-rw-r--r--cloudinit/distros/parsers/hostname.py2
-rw-r--r--cloudinit/distros/parsers/hosts.py2
-rw-r--r--cloudinit/distros/parsers/resolv_conf.py2
-rw-r--r--cloudinit/helpers.py6
-rw-r--r--cloudinit/net/dhcp.py2
-rw-r--r--cloudinit/signal_handler.py3
20 files changed, 21 insertions, 30 deletions
diff --git a/cloudinit/cmd/devel/tests/test_logs.py b/cloudinit/cmd/devel/tests/test_logs.py
index 4951797b..d2dfa8de 100644
--- a/cloudinit/cmd/devel/tests/test_logs.py
+++ b/cloudinit/cmd/devel/tests/test_logs.py
@@ -2,7 +2,7 @@
from datetime import datetime
import os
-from six import StringIO
+from io import StringIO
from cloudinit.cmd.devel import logs
from cloudinit.sources import INSTANCE_JSON_SENSITIVE_FILE
diff --git a/cloudinit/cmd/devel/tests/test_render.py b/cloudinit/cmd/devel/tests/test_render.py
index 988bba03..a7fcf2ce 100644
--- a/cloudinit/cmd/devel/tests/test_render.py
+++ b/cloudinit/cmd/devel/tests/test_render.py
@@ -1,7 +1,7 @@
# This file is part of cloud-init. See LICENSE file for license information.
-from six import StringIO
import os
+from io import StringIO
from collections import namedtuple
from cloudinit.cmd.devel import render
diff --git a/cloudinit/cmd/tests/test_clean.py b/cloudinit/cmd/tests/test_clean.py
index f092ab3d..13a69aa1 100644
--- a/cloudinit/cmd/tests/test_clean.py
+++ b/cloudinit/cmd/tests/test_clean.py
@@ -5,7 +5,7 @@ from cloudinit.util import ensure_dir, sym_link, write_file
from cloudinit.tests.helpers import CiTestCase, wrap_and_call, mock
from collections import namedtuple
import os
-from six import StringIO
+from io import StringIO
mypaths = namedtuple('MyPaths', 'cloud_dir')
diff --git a/cloudinit/cmd/tests/test_cloud_id.py b/cloudinit/cmd/tests/test_cloud_id.py
index 73738170..3f3727fd 100644
--- a/cloudinit/cmd/tests/test_cloud_id.py
+++ b/cloudinit/cmd/tests/test_cloud_id.py
@@ -4,7 +4,7 @@
from cloudinit import util
from collections import namedtuple
-from six import StringIO
+from io import StringIO
from cloudinit.cmd import cloud_id
diff --git a/cloudinit/cmd/tests/test_main.py b/cloudinit/cmd/tests/test_main.py
index 57b8fdf5..384fddc6 100644
--- a/cloudinit/cmd/tests/test_main.py
+++ b/cloudinit/cmd/tests/test_main.py
@@ -3,7 +3,7 @@
from collections import namedtuple
import copy
import os
-from six import StringIO
+from io import StringIO
from cloudinit.cmd import main
from cloudinit import safeyaml
diff --git a/cloudinit/cmd/tests/test_query.py b/cloudinit/cmd/tests/test_query.py
index c48605ad..6d36a4ea 100644
--- a/cloudinit/cmd/tests/test_query.py
+++ b/cloudinit/cmd/tests/test_query.py
@@ -1,7 +1,7 @@
# This file is part of cloud-init. See LICENSE file for license information.
import errno
-from six import StringIO
+from io import StringIO
from textwrap import dedent
import os
diff --git a/cloudinit/cmd/tests/test_status.py b/cloudinit/cmd/tests/test_status.py
index aded8580..1ed10896 100644
--- a/cloudinit/cmd/tests/test_status.py
+++ b/cloudinit/cmd/tests/test_status.py
@@ -2,7 +2,7 @@
from collections import namedtuple
import os
-from six import StringIO
+from io import StringIO
from textwrap import dedent
from cloudinit.atomic_helper import write_json
diff --git a/cloudinit/config/cc_debug.py b/cloudinit/config/cc_debug.py
index 610dbc8b..4d5a6aa2 100644
--- a/cloudinit/config/cc_debug.py
+++ b/cloudinit/config/cc_debug.py
@@ -28,8 +28,7 @@ location that this cloud-init has been configured with when running.
"""
import copy
-
-from six import StringIO
+from io import StringIO
from cloudinit import type_utils
from cloudinit import util
diff --git a/cloudinit/config/cc_landscape.py b/cloudinit/config/cc_landscape.py
index eaf1e940..a9c04d86 100644
--- a/cloudinit/config/cc_landscape.py
+++ b/cloudinit/config/cc_landscape.py
@@ -56,8 +56,7 @@ The following default client config is provided, but can be overridden::
"""
import os
-
-from six import BytesIO
+from io import BytesIO
from configobj import ConfigObj
diff --git a/cloudinit/config/cc_puppet.py b/cloudinit/config/cc_puppet.py
index b088db6e..c01f5b8f 100644
--- a/cloudinit/config/cc_puppet.py
+++ b/cloudinit/config/cc_puppet.py
@@ -77,11 +77,10 @@ See https://puppet.com/docs/puppet/latest/config_file_csr_attributes.html
pp_preshared_key: 342thbjkt82094y0uthhor289jnqthpc2290
"""
-from six import StringIO
-
import os
import socket
import yaml
+from io import StringIO
from cloudinit import helpers
from cloudinit import util
diff --git a/cloudinit/config/cc_rightscale_userdata.py b/cloudinit/config/cc_rightscale_userdata.py
index bd8ee89f..a5aca038 100644
--- a/cloudinit/config/cc_rightscale_userdata.py
+++ b/cloudinit/config/cc_rightscale_userdata.py
@@ -50,13 +50,12 @@ user scripts configuration directory, to be run later by ``cc_scripts_user``.
#
import os
+from urllib.parse import parse_qs
from cloudinit.settings import PER_INSTANCE
from cloudinit import url_helper as uhelp
from cloudinit import util
-from six.moves.urllib_parse import parse_qs
-
frequency = PER_INSTANCE
MY_NAME = "cc_rightscale_userdata"
diff --git a/cloudinit/config/cc_seed_random.py b/cloudinit/config/cc_seed_random.py
index a5d7c73f..b65f3ed9 100644
--- a/cloudinit/config/cc_seed_random.py
+++ b/cloudinit/config/cc_seed_random.py
@@ -61,8 +61,7 @@ used::
import base64
import os
-
-from six import BytesIO
+from io import BytesIO
from cloudinit import log as logging
from cloudinit.settings import PER_INSTANCE
diff --git a/cloudinit/config/cc_zypper_add_repo.py b/cloudinit/config/cc_zypper_add_repo.py
index aba26952..05855b0c 100644
--- a/cloudinit/config/cc_zypper_add_repo.py
+++ b/cloudinit/config/cc_zypper_add_repo.py
@@ -7,7 +7,6 @@
import configobj
import os
-from six import string_types
from textwrap import dedent
from cloudinit.config.schema import get_schema_doc
@@ -110,7 +109,7 @@ def _format_repo_value(val):
return 1 if val else 0
if isinstance(val, (list, tuple)):
return "\n ".join([_format_repo_value(v) for v in val])
- if not isinstance(val, string_types):
+ if not isinstance(val, str):
return str(val)
return val
diff --git a/cloudinit/config/tests/test_snap.py b/cloudinit/config/tests/test_snap.py
index 3c472891..cbbb173d 100644
--- a/cloudinit/config/tests/test_snap.py
+++ b/cloudinit/config/tests/test_snap.py
@@ -1,7 +1,7 @@
# This file is part of cloud-init. See LICENSE file for license information.
import re
-from six import StringIO
+from io import StringIO
from cloudinit.config.cc_snap import (
ASSERTIONS_FILE, add_assertions, handle, maybe_install_squashfuse,
diff --git a/cloudinit/distros/parsers/hostname.py b/cloudinit/distros/parsers/hostname.py
index dd434ac6..e74c083c 100644
--- a/cloudinit/distros/parsers/hostname.py
+++ b/cloudinit/distros/parsers/hostname.py
@@ -4,7 +4,7 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
-from six import StringIO
+from io import StringIO
from cloudinit.distros.parsers import chop_comment
diff --git a/cloudinit/distros/parsers/hosts.py b/cloudinit/distros/parsers/hosts.py
index 64444581..54e4e934 100644
--- a/cloudinit/distros/parsers/hosts.py
+++ b/cloudinit/distros/parsers/hosts.py
@@ -4,7 +4,7 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
-from six import StringIO
+from io import StringIO
from cloudinit.distros.parsers import chop_comment
diff --git a/cloudinit/distros/parsers/resolv_conf.py b/cloudinit/distros/parsers/resolv_conf.py
index a62055ae..299d54b5 100644
--- a/cloudinit/distros/parsers/resolv_conf.py
+++ b/cloudinit/distros/parsers/resolv_conf.py
@@ -4,7 +4,7 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
-from six import StringIO
+from io import StringIO
from cloudinit.distros.parsers import chop_comment
from cloudinit import log as logging
diff --git a/cloudinit/helpers.py b/cloudinit/helpers.py
index dcd2645e..7d2a3305 100644
--- a/cloudinit/helpers.py
+++ b/cloudinit/helpers.py
@@ -12,10 +12,8 @@ from time import time
import contextlib
import os
-
-from six import StringIO
-from six.moves.configparser import (
- NoSectionError, NoOptionError, RawConfigParser)
+from configparser import NoSectionError, NoOptionError, RawConfigParser
+from io import StringIO
from cloudinit.settings import (PER_INSTANCE, PER_ALWAYS, PER_ONCE,
CFG_ENV_NAME)
diff --git a/cloudinit/net/dhcp.py b/cloudinit/net/dhcp.py
index c033cc8e..19d0199c 100644
--- a/cloudinit/net/dhcp.py
+++ b/cloudinit/net/dhcp.py
@@ -10,6 +10,7 @@ import os
import re
import signal
import time
+from io import StringIO
from cloudinit.net import (
EphemeralIPv4Network, find_fallback_nic, get_devicelist,
@@ -17,7 +18,6 @@ from cloudinit.net import (
from cloudinit.net.network_state import mask_and_ipv4_to_bcast_addr as bcip
from cloudinit import temp_utils
from cloudinit import util
-from six import StringIO
LOG = logging.getLogger(__name__)
diff --git a/cloudinit/signal_handler.py b/cloudinit/signal_handler.py
index 12fdfe6c..9272d22d 100644
--- a/cloudinit/signal_handler.py
+++ b/cloudinit/signal_handler.py
@@ -9,8 +9,7 @@
import inspect
import signal
import sys
-
-from six import StringIO
+from io import StringIO
from cloudinit import log as logging
from cloudinit import util