Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint: Black -> Ruff formatter #14896

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ repos:
exclude: tests/foreman/data/
- id: check-yaml
- id: debug-statements
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
rev: v0.4.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: local
hooks:
- id: fix-uuids
Expand Down
1 change: 1 addition & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Global Configurations for py.test runner"""

import pytest

pytest_plugins = [
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
http://sphinx-doc.org/config.html

"""

import builtins
import os
import sys
Expand Down
24 changes: 7 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
[tool.black]
line-length = 100
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.venv
| _build
| buck-out
| build
| dist
)/
'''

[tool.ruff]
target-version = "py311"
# Allow lines to be as long as 100.
line-length = 100
exclude = [".git", ".hg", ".mypy_cache", ".venv", "_build", "buck-out", "build", "dist"]

[tool.ruff.format]
# Preserve quotes
quote-style = "preserve" # TODO: change to "single" when flake8-quotes is enabled

[tool.ruff.lint]
fixable = ["ALL"]
Expand Down
6 changes: 1 addition & 5 deletions pytest_fixtures/component/virtwho_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ def org_module(request, default_org, module_sca_manifest_org):

@pytest.fixture
def org_session(request, session, session_sca):
if 'sca' in request.module.__name__.split('.')[-1]:
org_session = session_sca
else:
org_session = session
return org_session
return session_sca if 'sca' in request.module.__name__.split('.')[-1] else session


@pytest.fixture
Expand Down
1 change: 1 addition & 0 deletions pytest_fixtures/core/contenthosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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
"""

from broker import Broker
import pytest

Expand Down
5 changes: 1 addition & 4 deletions pytest_fixtures/core/xdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ def align_to_satellite(request, worker_id, satellite_factory):
settings.set("server.hostname", None)
on_demand_sat = None

if worker_id in ['master', 'local']:
worker_pos = 0
else:
worker_pos = int(worker_id.replace('gw', ''))
worker_pos = 0 if worker_id in ["master", "local"] else int(worker_id.replace("gw", ""))

# attempt to add potential satellites from the broker inventory file
if settings.server.inventory_filter:
Expand Down
1 change: 0 additions & 1 deletion pytest_plugins/capsule_n-minus.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def pytest_addoption(parser):


def pytest_collection_modifyitems(items, config):

if not config.getoption('n_minus', False):
return

Expand Down
1 change: 0 additions & 1 deletion pytest_plugins/requirements/req_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class ReqUpdater:

# Installed package name as key and its counterpart in requirements file as value
package_deviates = {
'Betelgeuse': 'betelgeuse',
Expand Down
1 change: 1 addition & 0 deletions pytest_plugins/requirements/update_requirements.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Plugin enables pytest to notify and update the requirements"""

from .req_updater import ReqUpdater

updater = ReqUpdater()
Expand Down
2 changes: 1 addition & 1 deletion pytest_plugins/sanity_plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" A sanity testing plugin to assist in executing robottelo tests as sanity tests smartly
"""A sanity testing plugin to assist in executing robottelo tests as sanity tests smartly

1. Make installer test to run first which should set the hostname and all other tests then
should run after that
Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/acs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
update Update an alternate content source.

"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/activationkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
subscriptions List associated subscriptions
update Update an activation key
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Options:
-h, --help Print help
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
roles Manage ansible roles
variables Manage ansible variables
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
remove_operatingsystem Disassociate a resource
update Update an architecture.
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/arfreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
list List ARF reports

"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
logout Wipe your credentials
status Information about current connections
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generic base class for cli hammer commands."""

import re

from wait_for import wait_for
Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/bootdisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
host Download host image
subnet Download subnet generic image
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/capsule.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
refresh-features Refresh capsule features
update Update a capsule
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/computeprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
-h, --help Print help
Update a compute resource.
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/computeresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
list List all compute resources.
update Update a compute resource.
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/content_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
list List content credentials
update Update a content credential
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/content_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
list View content view export histories

"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/content_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
version Imports a content archive to a content view version

"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

-h, --help print help
"""

from robottelo.cli import hammer
from robottelo.cli.base import Base, CLIError

Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
list List all the default parameters
providers List all the providers
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/discoveredhost.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
reboot Reboot a host
refresh-facts Refresh the facts of a host
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/discoveryrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
list List all discovery rules
update Update a rule
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/docker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Docker related hammer commands"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
set_parameter Create or update parameter for a domain.
update Update a domain.
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
sc-params List all smart class parameters
update Update an environment
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/erratum.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
info Show an erratum
list List errata
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/fact.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

list List all fact values.
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
info Show a file
list List files
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
list List all filters
update Update a filter
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/globalparam.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
list List all common parameters.
set Set a global parameter.
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/gpgkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
list List GPG Keys
update Update a GPG Key
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/hammer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers to interact with hammer command line utility."""

import csv
import json
import re
Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
update Update a host

"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/host_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
-h, --help Print help

"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/hostcollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
remove-host Remove hosts from the host collection
update Update a host collection
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/hostgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
set-parameter Create or update parameter for a hostgroup
update Update a host group
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Options:
-h, --help Print help
"""

from robottelo.cli.base import Base


Expand Down
1 change: 1 addition & 0 deletions robottelo/cli/job_invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
rerun Rerun the job

"""

from robottelo.cli.base import Base


Expand Down
Loading
Loading