Skip to content

Commit

Permalink
[6.12.z] Switch import formatting to use Ruff (#12713)
Browse files Browse the repository at this point in the history
Switch import formatting to use Ruff

This now drops the old standard of one import per line in favor of a
less noisy standard (isort).
  • Loading branch information
JacobCallahan authored Sep 23, 2023
1 parent 18469d9 commit c3f6623
Show file tree
Hide file tree
Showing 315 changed files with 1,631 additions and 1,713 deletions.
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# configuration for pre-commit git hooks

repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand Down
13 changes: 11 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ select = [
# "C90", # mccabe
"E", # pycodestyle
"F", # flake8
"I", # isort
# "Q", # flake8-quotes
"UP", # pyupgrade
"W", # pycodestyle
]

# Allow lines to be as long as 100 characters.
line-length = 100
ignore = [
"E501", # line too long - handled by black
]

[tool.ruff.isort]
force-sort-within-sections = true
known-first-party = [
"robottelo",
]
combine-as-imports = true


[tool.ruff.flake8-quotes]
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/computeprofile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compute Profile Fixtures
import pytest
from nailgun import entities
import pytest


@pytest.fixture(scope='module')
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/contentview.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Content View Fixtures
import pytest
from nailgun.entity_mixins import call_entity_method_with_timeout
import pytest

from robottelo.constants import DEFAULT_CV

Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/domain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Domain Fixtures
import pytest
from nailgun import entities
import pytest


@pytest.fixture(scope='session')
Expand Down
8 changes: 2 additions & 6 deletions pytest_fixtures/component/host.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Host Specific Fixtures
import pytest
from fauxfactory import gen_string
from nailgun import entities
import pytest

from robottelo.cli.factory import setup_org_for_a_rh_repo
from robottelo.constants import DEFAULT_CV
from robottelo.constants import ENVIRONMENT
from robottelo.constants import PRDS
from robottelo.constants import REPOS
from robottelo.constants import REPOSET
from robottelo.constants import DEFAULT_CV, ENVIRONMENT, PRDS, REPOS, REPOSET


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/hostgroup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hostgroup Fixtures
import pytest
from nailgun import entities
import pytest
from requests.exceptions import HTTPError

from robottelo.logging import logger
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/katello_agent.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from box import Box
import pytest

from robottelo.config import settings
from robottelo.utils.installer import InstallerCommand
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/katello_certs_check.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# katello_certs_check Fixtures
from pathlib import Path

import pytest
from fauxfactory import gen_string
import pytest

from robottelo.constants import CERT_DATA as cert_data
from robottelo.hosts import Capsule
Expand Down
4 changes: 1 addition & 3 deletions pytest_fixtures/component/maintain.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
from robottelo import constants
from robottelo.config import settings
from robottelo.constants import SATELLITE_MAINTAIN_YML
from robottelo.hosts import Capsule
from robottelo.hosts import Satellite
from robottelo.hosts import SatelliteHostError
from robottelo.hosts import Capsule, Satellite, SatelliteHostError
from robottelo.logging import logger

synced_repos = pytest.StashKey[dict]
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/os.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Operating System Fixtures
import pytest
from nailgun import entities
import pytest


@pytest.fixture(scope='session')
Expand Down
9 changes: 3 additions & 6 deletions pytest_fixtures/component/oscap.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
from pathlib import PurePath

import pytest
from fauxfactory import gen_string
from nailgun import entities
import pytest

from robottelo.cli.factory import make_scapcontent
from robottelo.config import robottelo_tmp_dir
from robottelo.config import settings
from robottelo.constants import DataFile
from robottelo.constants import OSCAP_PROFILE
from robottelo.constants import OSCAP_TAILORING_FILE
from robottelo.config import robottelo_tmp_dir, settings
from robottelo.constants import OSCAP_PROFILE, OSCAP_TAILORING_FILE, DataFile


@pytest.fixture(scope="session")
Expand Down
16 changes: 9 additions & 7 deletions pytest_fixtures/component/provision_azure.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Azure CR Fixtures
import pytest
from fauxfactory import gen_string
import pytest
from wrapanapi import AzureSystem

from robottelo.config import settings
from robottelo.constants import AZURERM_RHEL7_FT_BYOS_IMG_URN
from robottelo.constants import AZURERM_RHEL7_FT_CUSTOM_IMG_URN
from robottelo.constants import AZURERM_RHEL7_FT_GALLERY_IMG_URN
from robottelo.constants import AZURERM_RHEL7_FT_IMG_URN
from robottelo.constants import AZURERM_RHEL7_UD_IMG_URN
from robottelo.constants import DEFAULT_ARCHITECTURE
from robottelo.constants import (
AZURERM_RHEL7_FT_BYOS_IMG_URN,
AZURERM_RHEL7_FT_CUSTOM_IMG_URN,
AZURERM_RHEL7_FT_GALLERY_IMG_URN,
AZURERM_RHEL7_FT_IMG_URN,
AZURERM_RHEL7_UD_IMG_URN,
DEFAULT_ARCHITECTURE,
)


@pytest.fixture(scope='session')
Expand Down
14 changes: 8 additions & 6 deletions pytest_fixtures/component/provision_gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
import json
from tempfile import mkstemp

import pytest
from fauxfactory import gen_string
import pytest
from wrapanapi.systems.google import GoogleCloudSystem

from robottelo.config import settings
from robottelo.constants import DEFAULT_ARCHITECTURE
from robottelo.constants import DEFAULT_PTABLE
from robottelo.constants import FOREMAN_PROVIDERS
from robottelo.constants import GCE_RHEL_CLOUD_PROJECTS
from robottelo.constants import GCE_TARGET_RHEL_IMAGE_NAME
from robottelo.constants import (
DEFAULT_ARCHITECTURE,
DEFAULT_PTABLE,
FOREMAN_PROVIDERS,
GCE_RHEL_CLOUD_PROJECTS,
GCE_TARGET_RHEL_IMAGE_NAME,
)
from robottelo.exceptions import GCECertNotFoundError


Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/provision_pxe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import re
from tempfile import mkstemp

import pytest
from box import Box
from broker import Broker
from fauxfactory import gen_string
from packaging.version import Version
import pytest

from robottelo import constants
from robottelo.config import settings
Expand Down
6 changes: 2 additions & 4 deletions pytest_fixtures/component/provisioning_template.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Provisioning Template Fixtures
import pytest
from box import Box
from nailgun import entities
from packaging.version import Version
import pytest

from robottelo import constants
from robottelo.constants import DEFAULT_PTABLE
from robottelo.constants import DEFAULT_PXE_TEMPLATE
from robottelo.constants import DEFAULT_TEMPLATE
from robottelo.constants import DEFAULT_PTABLE, DEFAULT_PXE_TEMPLATE, DEFAULT_TEMPLATE


@pytest.fixture(scope='module')
Expand Down
7 changes: 2 additions & 5 deletions pytest_fixtures/component/repository.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Repository Fixtures
import pytest
from fauxfactory import gen_string
from nailgun import entities
from nailgun.entity_mixins import call_entity_method_with_timeout
import pytest

from robottelo.constants import DEFAULT_ARCHITECTURE
from robottelo.constants import PRDS
from robottelo.constants import REPOS
from robottelo.constants import REPOSET
from robottelo.constants import DEFAULT_ARCHITECTURE, PRDS, REPOS, REPOSET


@pytest.fixture(scope='module')
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/rh_cloud.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from broker import Broker
import pytest

from robottelo.constants import DEFAULT_SUBSCRIPTION_NAME

Expand Down
21 changes: 11 additions & 10 deletions pytest_fixtures/component/satellite_auth.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import copy
import socket

import pytest
from box import Box
from nailgun import entities
import pytest

from robottelo.config import settings
from robottelo.constants import AUDIENCE_MAPPER
from robottelo.constants import CERT_PATH
from robottelo.constants import GROUP_MEMBERSHIP_MAPPER
from robottelo.constants import HAMMER_CONFIG
from robottelo.constants import HAMMER_SESSIONS
from robottelo.constants import LDAP_ATTR
from robottelo.constants import LDAP_SERVER_TYPE
from robottelo.hosts import IPAHost
from robottelo.hosts import SSOHost
from robottelo.constants import (
AUDIENCE_MAPPER,
CERT_PATH,
GROUP_MEMBERSHIP_MAPPER,
HAMMER_CONFIG,
HAMMER_SESSIONS,
LDAP_ATTR,
LDAP_SERVER_TYPE,
)
from robottelo.hosts import IPAHost, SSOHost
from robottelo.utils.datafactory import gen_string
from robottelo.utils.issue_handlers import is_open

Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/subnet.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Subnet Fixtures
import pytest
from nailgun import entities
import pytest


@pytest.fixture(scope='module')
Expand Down
5 changes: 2 additions & 3 deletions pytest_fixtures/component/taxonomy.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Content Component fixtures
import pytest
from manifester import Manifester
import pytest

from robottelo.config import settings
from robottelo.constants import DEFAULT_LOC
from robottelo.constants import DEFAULT_ORG
from robottelo.constants import DEFAULT_LOC, DEFAULT_ORG
from robottelo.utils.manifest import clone


Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/component/templatesync.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fauxfactory import gen_string
import pytest
import requests
from fauxfactory import gen_string

from robottelo.config import settings
from robottelo.constants import FOREMAN_TEMPLATE_ROOT_DIR
Expand Down
5 changes: 2 additions & 3 deletions pytest_fixtures/component/user_role.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest
from fauxfactory import gen_alphanumeric
from fauxfactory import gen_string
from fauxfactory import gen_alphanumeric, gen_string
from nailgun import entities
import pytest


@pytest.fixture(scope='class')
Expand Down
6 changes: 2 additions & 4 deletions pytest_fixtures/core/broker.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from contextlib import contextmanager

import pytest
from box import Box
from broker import Broker
import pytest

from robottelo.config import settings
from robottelo.hosts import ContentHostError
from robottelo.hosts import lru_sat_ready_rhel
from robottelo.hosts import Satellite
from robottelo.hosts import ContentHostError, Satellite, lru_sat_ready_rhel


@pytest.fixture(scope='session')
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/core/contenthosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
The functions in this module are read in the pytest_plugins/fixture_markers.py module
All functions in this module will be treated as fixtures that apply the contenthost mark
"""
import pytest
from broker import Broker
import pytest

from robottelo import constants
from robottelo.config import settings
Expand Down
6 changes: 2 additions & 4 deletions pytest_fixtures/core/reporting.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import datetime

import pytest
from _pytest.junitxml import xml_key
import pytest
from xdist import get_xdist_worker_id

from robottelo.config import setting_is_set
from robottelo.config import settings

from robottelo.config import setting_is_set, settings

FMT_XUNIT_TIME = '%Y-%m-%dT%H:%M:%S'

Expand Down
18 changes: 9 additions & 9 deletions pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
from contextlib import contextmanager

import pytest
from broker import Broker
import pytest
from wait_for import wait_for

from robottelo.config import configure_airgun
from robottelo.config import configure_nailgun
from robottelo.config import settings
from robottelo.hosts import Capsule
from robottelo.hosts import get_sat_rhel_version
from robottelo.hosts import IPAHost
from robottelo.hosts import lru_sat_ready_rhel
from robottelo.hosts import Satellite
from robottelo.config import configure_airgun, configure_nailgun, settings
from robottelo.hosts import (
Capsule,
IPAHost,
Satellite,
get_sat_rhel_version,
lru_sat_ready_rhel,
)
from robottelo.logging import logger
from robottelo.utils.installer import InstallerCommand

Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/core/ui.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from fauxfactory import gen_string
import pytest
from requests.exceptions import HTTPError

from robottelo.logging import logger
Expand Down
2 changes: 1 addition & 1 deletion pytest_fixtures/core/upgrade.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from broker import Broker
import pytest

from robottelo.hosts import Capsule
from robottelo.logging import logger
Expand Down
Loading

0 comments on commit c3f6623

Please sign in to comment.