Skip to content
Snippets Groups Projects
Commit 5c74efe8 authored by Karel van Klink's avatar Karel van Klink :smiley_cat: Committed by Neda Moeini
Browse files

Bump to python 3.12

parent 42877bcf
No related branches found
No related tags found
1 merge request!139Feature/add validation workflows
......@@ -364,7 +364,7 @@ def _evaluate_decision(decision: OPAResult, *, auto_error: bool, **context: dict
raise HTTPException(
status_code=HTTPStatus.FORBIDDEN,
detail=f"User is not allowed to access resource: {context.get('resource')} Decision was taken with id: {did}",
detail=f"User is not allowed to access resource: {context.get("resource")} Decision was taken with id: {did}",
)
......
......@@ -307,14 +307,14 @@ def import_iptrunks(filepath: str = common_filepath_option) -> None:
iptrunk_ipv4_network = ipv4_network_a
else:
# Handle the case where IPv4 networks are different
typer.echo(f"Error: IPv4 networks are different for trunk {trunk['id']}.")
typer.echo(f"Error: IPv4 networks are different for trunk {trunk["id"]}.")
continue
# Check if IPv6 networks are the same
if ipv6_network_a == ipv6_network_b:
iptrunk_ipv6_network = ipv6_network_a
else:
# Handle the case where IPv6 networks are different
typer.echo(f"Error: IPv6 networks are different for trunk {trunk['id']}.")
typer.echo(f"Error: IPv6 networks are different for trunk {trunk["id"]}.")
continue
typer.echo(
......@@ -343,7 +343,7 @@ def import_iptrunks(filepath: str = common_filepath_option) -> None:
)
start_process("create_imported_iptrunk", [initial_data.model_dump()])
successfully_imported_data.append(trunk["id"])
typer.echo(f"Successfully imported IP Trunk: {trunk['id']}")
typer.echo(f"Successfully imported IP Trunk: {trunk["id"]}")
except ValidationError as e:
typer.echo(f"Validation error: {e}")
......
......@@ -26,7 +26,7 @@ class LibreNMSClient:
self.snmp_config = config.SNMP
self.headers = {
"User-Agent": f"geant-service-orchestrator/{metadata.version('geant-service-orchestrator')}",
"User-Agent": f"geant-service-orchestrator/{metadata.version("geant-service-orchestrator")}",
"Accept": "application/json",
"Content-Type": "application/json",
"X-Auth-Token": token,
......
......@@ -47,7 +47,7 @@ def available_interfaces_choices(router_id: UUID, speed: str) -> Choice | None:
if get_router_vendor(router_id) != Vendor.NOKIA:
return None
interfaces = {
interface["name"]: f"{interface['name']} {interface['description']}"
interface["name"]: f"{interface["name"]} {interface["description"]}"
for interface in NetboxClient().get_available_interfaces(router_id, speed)
}
return Choice("ae member", zip(interfaces.keys(), interfaces.items(), strict=True)) # type: ignore[arg-type]
......@@ -77,7 +77,7 @@ def available_interfaces_choices_including_current_members(
],
)
options = {
interface["name"]: f"{interface['name']} {interface['description']}" for interface in available_interfaces
interface["name"]: f"{interface["name"]} {interface["description"]}" for interface in available_interfaces
}
return Choice("ae member", zip(options.keys(), options.items(), strict=True)) # type: ignore[arg-type]
......
......@@ -31,6 +31,10 @@ extend-exclude = [
"gso/migrations",
"docs",
]
target-version = "py312"
line-length = 120
[tool.ruff.lint]
ignore = [
"COM812",
"D203",
......@@ -41,7 +45,6 @@ ignore = [
"PLR0904",
"PLW1514",
]
line-length = 120
select = [
"A",
"ARG",
......@@ -92,16 +95,16 @@ select = [
"W",
"YTT"
]
target-version = "py311"
[tool.ruff.flake8-tidy-imports]
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.per-file-ignores]
"test/*" = ["ARG001", "D", "S101", "PLR2004"]
[tool.ruff.lint.per-file-ignores]
"gso/workflows/*" = ["PLR0917", "PLR0914"]
"test/*" = ["ARG001", "D", "S101", "PLR2004", "PLR0917", "PLR0914", "PLC0415", "PLC2701"]
"setup.py" = ["D100"]
[tool.ruff.isort]
[tool.ruff.lint.isort]
known-third-party = ["pydantic", "migrations"]
known-first-party = ["test", "docs"]
......@@ -113,6 +116,3 @@ filterwarnings = [
"ignore",
"default:::gso",
]
[tool.ruff.lint.per-file-ignores]
"test/*" = ["PLR0917", "S101", "D104", "D105", "D103", "D100", "ARG001", "D102", "PLR2004", "D101", "D106", "D107", "PLR0914", "PLC0415", "PLC2701"]
"gso/workflows/*" = ["PLR0917", "PLR0914"]
\ No newline at end of file
......@@ -143,7 +143,7 @@ def test_successful_iptrunk_creation_with_standard_lso_result(
])
assert subscription.status == "provisioning"
assert subscription.description == (
f"IP trunk {sorted_sides[0]} {sorted_sides[1]}, geant_s_sid:{input_form_wizard_data[0]['geant_s_sid']}"
f"IP trunk {sorted_sides[0]} {sorted_sides[1]}, geant_s_sid:{input_form_wizard_data[0]["geant_s_sid"]}"
)
assert mock_execute_playbook.call_count == 6
......
......@@ -59,7 +59,7 @@ def test_create_nokia_router_success(
mock_v4 = faker.ipv4()
mock_v6 = faker.ipv6()
mock_fqdn = (
f"{router_creation_input_form_data['hostname']}.{mock_site.site_name.lower()}."
f"{router_creation_input_form_data["hostname"]}.{mock_site.site_name.lower()}."
f"{mock_site.site_country_code.lower()}.geant.net"
)
mock_hostname_available.return_value = True
......@@ -143,7 +143,7 @@ def test_create_nokia_router_lso_failure(
mock_v4_net = faker.ipv4(network=True)
mock_v6 = faker.ipv6()
mock_fqdn = (
f"{router_creation_input_form_data['hostname']}.{mock_site.site_name.lower()}."
f"{router_creation_input_form_data["hostname"]}.{mock_site.site_name.lower()}."
f"{mock_site.site_country_code.lower()}.geant.net"
)
mock_hostname_available.return_value = True
......
......@@ -35,7 +35,7 @@ def test_create_site(responses, faker):
assert subscription.status == "active"
assert (
subscription.description
== f"Site in {initial_site_data[1]['site_city']}, {initial_site_data[1]['site_country']}"
== f"Site in {initial_site_data[1]["site_city"]}, {initial_site_data[1]["site_country"]}"
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment