Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifester/_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module with settings variables/constants."""

import os
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions manifester/commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines the CLI commands for Manifester."""

import os
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions manifester/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Defines helper functions used by Manifester."""

from collections import UserDict
import json
import os
Expand Down
6 changes: 2 additions & 4 deletions manifester/manifester.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
This module defines the `Manifester` class, which provides methods for authenticating to and
interacting with the RHSM Subscription API for the purpose of generating a subscription manifest.
"""

from functools import cached_property
from pathlib import Path
import random
import string

from dynaconf.utils.boxing import DynaBox
import requests
from requests.exceptions import RequestException

from manifester.helpers import (
Expand Down Expand Up @@ -54,8 +56,6 @@ def __init__(
self.requester = kwargs["requester"]
self.is_mock = True
else:
import requests

self.requester = requests
self.is_mock = False
else:
Expand All @@ -67,8 +67,6 @@ def __init__(
self.requester = kwargs["requester"]
self.is_mock = True
else:
import requests

self.requester = requests
self.is_mock = False
self.username_prefix = (
Expand Down
19 changes: 10 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ testpaths = ["tests"]
[tool.ruff]
line-length = 100
target-version = "py311"

[tool.ruff.lint]
fixable = ["ALL"]

select = [
Expand Down Expand Up @@ -139,8 +141,8 @@ select = [
"T100", # Trace found: {name} used
"T20", # flake8-print
"TRY004", # Prefer TypeError exception for invalid type
"TRY200", # Use raise from to specify exception cause
"TRY302", # Remove exception handler; error is immediately re-raised
"B904", # Use raise from to specify exception cause
"TRY203", # Remove exception handler; error is immediately re-raised
"PLR0911", # Too many return statements ({returns} > {max_returns})
"PLR0912", # Too many branches ({branches} > {max_branches})
"PLR0915", # Too many statements ({statements} > {max_statements})
Expand All @@ -152,7 +154,6 @@ select = [

ignore = [
"ANN", # flake8-annotations
"PGH001", # No builtin eval() allowed
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D406", # Section name should end with a newline
Expand All @@ -164,27 +165,27 @@ ignore = [
"D107", # Missing docstring in __init__
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"manifester/__init__.py" = ["D104", "F401",]
"manifester/manifester.py" = ["D401",]
"tests/test_manifester.py" = ["D100", "E501", "PLR0911", "PLR2004",]

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

[tool.ruff.flake8-pytest-style]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
inline-quotes = "single"

[tool.ruff.lint.pylint]
max-branches = 16
max-branches = 20

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 20
1 change: 1 addition & 0 deletions scripts/vault_login.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Enables and Disables an OIDC token to access secrets from HashiCorp Vault."""

import sys

from manifester.helpers import Vault
Expand Down
4 changes: 2 additions & 2 deletions tests/test_manifester.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def get(self, *args, **kwargs):
for _x in range(50):
self.pool_response["body"].append(
{
"id": f'{"".join(random.sample(string.ascii_letters, 12))}',
"id": f"{''.join(random.sample(string.ascii_letters, 12))}",
"subscriptionName": "Red Hat Satellite Infrastructure Subscription",
"entitlementsAvailable": random.randrange(100),
}
Expand All @@ -153,7 +153,7 @@ def get(self, *args, **kwargs):
self.allocations_response["body"].append(
{
"uuid": f"{uuid.uuid4().hex}",
"name": f'{"".join(random.sample(string.ascii_letters, 12))}',
"name": f"{''.join(random.sample(string.ascii_letters, 12))}",
}
)
return self
Expand Down
Loading