mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Python code modernization, 3/n (#1157)
* Remove __metaclass__ = type. for i in $(grep -REl '__metaclass__ = type' plugins/ tests/); do sed -e '/^__metaclass__ = type/d' -i $i; done * Remove super arguments, and stop inheriting from object.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
def _normalize_ipaddr(ipaddr):
|
||||
@@ -12,7 +11,7 @@ def _normalize_ipaddr(ipaddr):
|
||||
return ipaddress.ip_address(ipaddr).compressed
|
||||
|
||||
|
||||
class FilterModule(object):
|
||||
class FilterModule:
|
||||
""" IP address and network manipulation filters """
|
||||
|
||||
def filters(self):
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
def sanitize_host_info(data):
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from io import StringIO
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
import pytest
|
||||
from ansible.inventory.data import InventoryData
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
@@ -96,7 +92,7 @@ def create_get_option(options, default=False):
|
||||
return get_option
|
||||
|
||||
|
||||
class FakeClient(object):
|
||||
class FakeClient:
|
||||
def __init__(self, *hosts):
|
||||
self.get_results = {}
|
||||
list_reply = []
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import datetime
|
||||
import io
|
||||
import json
|
||||
@@ -483,7 +480,7 @@ class TCPSocketStreamTest(unittest.TestCase):
|
||||
stdout_data = cls.stdout_data
|
||||
stderr_data = cls.stderr_data
|
||||
|
||||
class Handler(BaseHTTPRequestHandler, object):
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
resp_data = self.get_resp_data()
|
||||
self.send_response(101)
|
||||
|
||||
@@ -9,6 +9,4 @@
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
DEFAULT_DOCKER_API_VERSION = "1.45"
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.docker.plugins.module_utils._api import constants
|
||||
from ansible_collections.community.docker.tests.unit.plugins.module_utils._api.constants import (
|
||||
DEFAULT_DOCKER_API_VERSION,
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
OBJ = {
|
||||
"read": "2015-02-11T19:20:46.667237763+02:00",
|
||||
"network": {
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import unittest
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import unittest
|
||||
|
||||
import requests
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import unittest
|
||||
|
||||
from ansible_collections.community.docker.plugins.module_utils._api.transport.sshconn import (
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import unittest
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import unittest
|
||||
|
||||
from ansible_collections.community.docker.plugins.module_utils._api.api.client import (
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.docker.plugins.module_utils._api.utils.json_stream import (
|
||||
json_splitter,
|
||||
json_stream,
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import unittest
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import unittest
|
||||
|
||||
from ansible_collections.community.docker.plugins.module_utils._api.utils.proxy import (
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.docker.plugins.module_utils._compose_v2 import (
|
||||
Event,
|
||||
)
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.module_utils._compose_v2 import (
|
||||
Event,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.module_utils._copy import (
|
||||
_stream_generator_to_fileobj,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import tarfile
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.module_utils._logfmt import (
|
||||
InvalidLogFmt,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.module_utils._scramble import (
|
||||
scramble,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.module_utils._util import (
|
||||
compare_dict_allow_more_present,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.modules.docker_container_copy_into import (
|
||||
parse_modern,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.module_utils._image_archive import (
|
||||
api_image_id,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.modules.docker_image_build import (
|
||||
_quote_csv,
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.docker.plugins.modules.docker_network import (
|
||||
validate_cidr,
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import tarfile
|
||||
from tempfile import TemporaryFile
|
||||
|
||||
Reference in New Issue
Block a user