From c4a86836639166ebcad4294a43d4a9b779548080 Mon Sep 17 00:00:00 2001 From: Meni Yakove <441263+myakove@users.noreply.github.com> Date: Mon, 13 Mar 2023 15:50:26 +0200 Subject: [PATCH] Reformat black and isort (#1138) --- .isort.cfg | 7 ------- .pre-commit-config.yaml | 2 +- docs/conf.py | 1 - examples/general.py | 1 - examples/node_network_configuration_policy.py | 1 - examples/pods.py | 1 - examples/role.py | 1 - examples/virtual_machine.py | 1 - ocp_resources/constants.py | 1 - ocp_resources/event.py | 1 - ocp_resources/logger.py | 1 - ocp_resources/machine_set.py | 1 - ocp_resources/network_attachment_definition.py | 1 - ocp_resources/node_network_state.py | 1 - ocp_resources/resource.py | 1 - ocp_resources/utils.py | 1 - pyproject.toml | 16 ++++++++++++++++ 17 files changed, 17 insertions(+), 22 deletions(-) delete mode 100644 .isort.cfg diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index 721f74996f..0000000000 --- a/.isort.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -use_parentheses=true -multi_line_output=3 -include_trailing_comma=true -line_length=88 -lines_after_imports=2 -known_first_party=six diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e21e207944..f3227ea990 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: repos: - repo: https://github.com/myint/autoflake - rev: "v2.0.1" + rev: "v2.0.2" hooks: - id: autoflake args: diff --git a/docs/conf.py b/docs/conf.py index dec0aed1c8..3d167441a0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,7 +19,6 @@ import os import sys - sys.path.insert(0, os.path.abspath("../")) project = "openshift-python-wrapper" diff --git a/examples/general.py b/examples/general.py index c5f3727388..bbebb2c3db 100644 --- a/examples/general.py +++ b/examples/general.py @@ -3,7 +3,6 @@ from ocp_resources.namespace import Namespace - client = DynamicClient(client=kubernetes.config.new_client_from_config()) # The examples given below are relevant to all resources. For simplicity we will use the resource - Namespace. diff --git a/examples/node_network_configuration_policy.py b/examples/node_network_configuration_policy.py index 91c065e775..f775148dc7 100644 --- a/examples/node_network_configuration_policy.py +++ b/examples/node_network_configuration_policy.py @@ -2,7 +2,6 @@ NodeNetworkConfigurationPolicy, ) - # Using capture syntax to switch ipv4 config between interfaces my_nncp = NodeNetworkConfigurationPolicy( name="capture_nncp", diff --git a/examples/pods.py b/examples/pods.py index d425faf195..244bdf2b0f 100644 --- a/examples/pods.py +++ b/examples/pods.py @@ -3,7 +3,6 @@ from ocp_resources.pod import Pod - client = DynamicClient(client=kubernetes.config.new_client_from_config()) # Query to get Pods (resource) in the connected cluster with label of ``label_example=example``. diff --git a/examples/role.py b/examples/role.py index 2e320f965f..83687a9973 100644 --- a/examples/role.py +++ b/examples/role.py @@ -1,6 +1,5 @@ from ocp_resources.role import Role - # The example bellow is also relevant for the ClusterRole resource. # Add multiple rules to a specific Role or ClusterRole as a list of rules dictionaries: rules = [ diff --git a/examples/virtual_machine.py b/examples/virtual_machine.py index 3a39c955d1..444f36db67 100644 --- a/examples/virtual_machine.py +++ b/examples/virtual_machine.py @@ -1,6 +1,5 @@ from ocp_resources.virtual_machine import VirtualMachine - # Create a VM with VirtualMachine( name="vm-example", diff --git a/ocp_resources/constants.py b/ocp_resources/constants.py index 713d8c532e..790dfdc109 100644 --- a/ocp_resources/constants.py +++ b/ocp_resources/constants.py @@ -6,7 +6,6 @@ ) from urllib3.exceptions import MaxRetryError, ProtocolError - DEFAULT_CLUSTER_RETRY_EXCEPTIONS = { MaxRetryError: [], ConnectionAbortedError: [], diff --git a/ocp_resources/event.py b/ocp_resources/event.py index b0873b7d5e..88c032da1d 100644 --- a/ocp_resources/event.py +++ b/ocp_resources/event.py @@ -1,6 +1,5 @@ from ocp_resources.logger import get_logger - LOGGER = get_logger(name=__name__) diff --git a/ocp_resources/logger.py b/ocp_resources/logger.py index 544ac1029a..04b5813c45 100644 --- a/ocp_resources/logger.py +++ b/ocp_resources/logger.py @@ -5,7 +5,6 @@ from colorlog import ColoredFormatter - LOGGER = logging.getLogger(__name__) LOGGERS = {} diff --git a/ocp_resources/machine_set.py b/ocp_resources/machine_set.py index 7642f305c8..94676605de 100644 --- a/ocp_resources/machine_set.py +++ b/ocp_resources/machine_set.py @@ -2,7 +2,6 @@ from ocp_resources.resource import NamespacedResource from ocp_resources.utils import TimeoutExpiredError, TimeoutSampler - TIMEOUT_5MINUTES = 300 diff --git a/ocp_resources/network_attachment_definition.py b/ocp_resources/network_attachment_definition.py index 154b2c3e8d..d5c1b7ca06 100644 --- a/ocp_resources/network_attachment_definition.py +++ b/ocp_resources/network_attachment_definition.py @@ -2,7 +2,6 @@ from ocp_resources.resource import NamespacedResource - DEFAULT_CNI_VERSION = "0.3.1" diff --git a/ocp_resources/node_network_state.py b/ocp_resources/node_network_state.py index 1fab772ae7..dd48a55f7b 100644 --- a/ocp_resources/node_network_state.py +++ b/ocp_resources/node_network_state.py @@ -6,7 +6,6 @@ from ocp_resources.resource import Resource from ocp_resources.utils import TimeoutSampler - SLEEP = 1 diff --git a/ocp_resources/resource.py b/ocp_resources/resource.py index 80b88715f8..277183915f 100644 --- a/ocp_resources/resource.py +++ b/ocp_resources/resource.py @@ -29,7 +29,6 @@ skip_existing_resource_creation_teardown, ) - LOGGER = get_logger(__name__) MAX_SUPPORTED_API_VERSION = "v2" diff --git a/ocp_resources/utils.py b/ocp_resources/utils.py index f92bcaa6b9..48d2652b52 100644 --- a/ocp_resources/utils.py +++ b/ocp_resources/utils.py @@ -4,7 +4,6 @@ from ocp_resources.logger import get_logger - LOGGER = get_logger(name=__name__) diff --git a/pyproject.toml b/pyproject.toml index c9a47e8718..0f0372df82 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,21 @@ [tool.black] line-length = 88 +target_version = ['py37', 'py38', 'py39', 'py310', "py311"] +exclude = ''' +( + /( + | \.git + | \.venv + | \.mypy_cache + | \.tox + )/ +) +''' + +[tool.isort] +line_length = 88 +profile = "black" + [build-system] requires = ["setuptools>=61.2"]