mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Remove all usage of ansible.module_utils.six from main branch (#10888)
* Get rid of all six.moves imports. * Get rid of iteritems. * Get rid of *_type(s) aliases. * Replace StringIO import. * Get rid of PY2/PY3 constants. * Get rid of raise_from. * Get rid of python_2_unicode_compatible. * Clean up global six imports. * Remove all usage of ansible.module_utils.six. * Linting. * Fix xml module. * Docs adjustments.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import http.client as http_client
|
||||
import json
|
||||
import os
|
||||
import random
|
||||
@@ -13,10 +14,8 @@ from ansible.module_utils.urls import open_url
|
||||
from ansible.module_utils.common.text.converters import to_native
|
||||
from ansible.module_utils.common.text.converters import to_text
|
||||
from ansible.module_utils.common.text.converters import to_bytes
|
||||
from ansible.module_utils.six import text_type
|
||||
from ansible.module_utils.six.moves import http_client
|
||||
from ansible.module_utils.six.moves.urllib.error import URLError, HTTPError
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlparse
|
||||
from urllib.error import URLError, HTTPError
|
||||
from urllib.parse import urlparse
|
||||
|
||||
GET_HEADERS = {'accept': 'application/json', 'OData-Version': '4.0'}
|
||||
POST_HEADERS = {'content-type': 'application/json', 'accept': 'application/json',
|
||||
@@ -378,7 +377,7 @@ class RedfishUtils(object):
|
||||
def write_buffer(body, line):
|
||||
# Adds to the multipart body based on the provided data type
|
||||
# At this time there is only support for strings, dictionaries, and bytes (default)
|
||||
if isinstance(line, text_type):
|
||||
if isinstance(line, str):
|
||||
body.append(to_bytes(line, encoding='utf-8'))
|
||||
elif isinstance(line, dict):
|
||||
body.append(to_bytes(json.dumps(line), encoding='utf-8'))
|
||||
|
||||
Reference in New Issue
Block a user