Skip to content

Commit 6099b49

Browse files
authored
Stop using six import. (#175)
1 parent 44a1472 commit 6099b49

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- "proxmox inventory plugin and proxmox module utils - avoid Python 2 compatibility imports (https://github.com/ansible-collections/community.proxmox/pull/175)."

plugins/inventory/proxmox.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,12 @@
202202

203203
import itertools
204204
import re
205+
from urllib.parse import urlencode
205206

206207
from ansible.module_utils.common._collections_compat import MutableMapping
207208

208209
from ansible.errors import AnsibleError
209210
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
210-
from ansible.module_utils.six import string_types
211-
from ansible.module_utils.six.moves.urllib.parse import urlencode
212211
from ansible.utils.display import Display
213212

214213
from ansible_collections.community.proxmox.plugins.module_utils.version import LooseVersion
@@ -472,7 +471,7 @@ def _get_vm_config(self, properties, node, vmid, vmtype, name):
472471
out_val[k] = v
473472
value = out_val
474473

475-
if config not in plaintext_configs and isinstance(value, string_types) \
474+
if config not in plaintext_configs and isinstance(value, (str, bytes)) \
476475
and all("=" in v for v in value.split(",")):
477476
# split off strings with commas to a dict
478477
# skip over any keys that cannot be processed

plugins/plugin_utils/unsafe.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import re
99

10-
from ansible.module_utils.six import binary_type, text_type
1110
from ansible.module_utils.common._collections_compat import Mapping, Set
1211
from ansible.module_utils.common.collections import is_sequence
1312
from ansible.utils.unsafe_proxy import (
@@ -29,11 +28,11 @@ def make_unsafe(value):
2928
return set(make_unsafe(elt) for elt in value)
3029
elif is_sequence(value):
3130
return type(value)(make_unsafe(elt) for elt in value)
32-
elif isinstance(value, binary_type):
31+
elif isinstance(value, bytes):
3332
if _RE_TEMPLATE_CHARS_BYTES.search(value):
3433
value = _make_unsafe(value)
3534
return value
36-
elif isinstance(value, text_type):
35+
elif isinstance(value, str):
3736
if _RE_TEMPLATE_CHARS.search(value):
3837
value = _make_unsafe(value)
3938
return value

0 commit comments

Comments
 (0)