Skip to content
Snippets Groups Projects
Verified Commit a60153a2 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

make type ignore statements more specific

parent 1d77588e
Branches
Tags
1 merge request!76make type ignore statements more specific
Pipeline #84151 passed
......@@ -19,7 +19,7 @@ class IptrunkType(strEnum):
T = TypeVar("T", covariant=True)
class IptrunkSides(UniqueConstrainedList[T]): # type: ignore
class IptrunkSides(UniqueConstrainedList[T]): # type: ignore[type-var]
min_items = 2
max_items = 2
......
......@@ -247,8 +247,8 @@ def _await_pp_results(subscription: SubscriptionModel, label_text: str = DEFAULT
class Config:
title = f"Deploying {subscription.product.name}..."
warning_label: Label = label_text # type: ignore
pp_run_results: dict = None # type: ignore
warning_label: Label = label_text # type: ignore[assignment]
pp_run_results: dict = None # type: ignore[assignment]
confirm: Accept = Accept("INCOMPLETE")
@validator("pp_run_results", allow_reuse=True, pre=True, always=True)
......@@ -299,14 +299,15 @@ def _confirm_pp_results(state: State) -> FormGenerator:
if not successful_run:
pp_retry_label1: Label = (
"Provisioning Proxy - playbook execution failed: inspect the output before proceeding" # type: ignore
"Provisioning Proxy - playbook execution failed: "
"inspect the output before proceeding" # type: ignore[assignment]
)
run_status: str = ReadOnlyField(state["pp_run_results"]["status"])
run_results: LongText = ReadOnlyField(json.dumps(state["pp_run_results"]["output"], indent=4))
if not successful_run:
pp_retry_label: Label = (
"Click submit to retry. Otherwise, abort the workflow from the process tab." # type: ignore
"Click submit to retry. Otherwise, abort the workflow from the process tab." # type: ignore[assignment]
)
yield ConfirmRunPage
......
......@@ -30,7 +30,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
title = product_name
tt_number: str
customer: customer_selector() # type: ignore
customer: customer_selector() # type: ignore[valid-type]
geant_s_sid: str
iptrunk_description: str
iptrunk_type: IptrunkType
......@@ -42,13 +42,13 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
class AeMembersListA(UniqueConstrainedList[str]):
min_items = initial_user_input.iptrunk_minimum_links
RouterEnumA = Choice("Select a router", zip(routers.keys(), routers.items())) # type: ignore
RouterEnumA = Choice("Select a router", zip(routers.keys(), routers.items())) # type: ignore[arg-type]
class CreateIptrunkSideAForm(FormPage):
class Config:
title = "Provide subscription details for side A of the trunk."
iptrunk_sideA_node_id: RouterEnumA # type: ignore
iptrunk_sideA_node_id: RouterEnumA # type: ignore[valid-type]
iptrunk_sideA_ae_iface: str
iptrunk_sideA_ae_geant_a_sid: str
iptrunk_sideA_ae_members: AeMembersListA
......@@ -58,7 +58,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
# Remove the selected router for side A, to prevent any loops
routers.pop(str(user_input_side_a.iptrunk_sideA_node_id.name))
RouterEnumB = Choice("Select a router", zip(routers.keys(), routers.items())) # type: ignore
RouterEnumB = Choice("Select a router", zip(routers.keys(), routers.items())) # type: ignore[arg-type]
class AeMembersListB(UniqueConstrainedList[str]):
min_items = len(user_input_side_a.iptrunk_sideA_ae_members)
......@@ -68,7 +68,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
class Config:
title = "Provide subscription details for side B of the trunk."
iptrunk_sideB_node_id: RouterEnumB # type: ignore
iptrunk_sideB_node_id: RouterEnumB # type: ignore[valid-type]
iptrunk_sideB_ae_iface: str
iptrunk_sideB_ae_geant_a_sid: str
iptrunk_sideB_ae_members: AeMembersListB
......
......@@ -31,7 +31,8 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
}
ReplacedSide = Choice(
"Select the side of the IP trunk to be replaced", zip(sides_dict.keys(), sides_dict.items()) # type: ignore
"Select the side of the IP trunk to be replaced",
zip(sides_dict.keys(), sides_dict.items()), # type: ignore[arg-type]
)
class OldSideIptrunkForm(FormPage):
......@@ -44,8 +45,8 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
)
tt_number: str
replace_side: ReplacedSide # type: ignore
warning_label: Label = "Are we moving to a different Site?" # type: ignore
replace_side: ReplacedSide # type: ignore[valid-type]
warning_label: Label = "Are we moving to a different Site?" # type: ignore[assignment]
migrate_to_different_site: Optional[bool] = False
old_side_input = yield OldSideIptrunkForm
......@@ -73,7 +74,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
continue
routers[str(router_id)] = router_description
NewRouterEnum = Choice("Select a new router", zip(routers.keys(), routers.items())) # type: ignore
NewRouterEnum = Choice("Select a new router", zip(routers.keys(), routers.items())) # type: ignore[arg-type]
class LagMemberList(UniqueConstrainedList[str]):
min_items = len(subscription.iptrunk.iptrunk_sides[0].iptrunk_side_ae_members)
......@@ -87,7 +88,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
f"{subscription.iptrunk.iptrunk_sides[1].iptrunk_side_node.router_fqdn}"
)
new_node: NewRouterEnum # type: ignore
new_node: NewRouterEnum # type: ignore[valid-type]
new_lag_interface: str
new_lag_member_interfaces: LagMemberList
......@@ -241,7 +242,8 @@ def confirm_continue_move_fiber() -> FormGenerator:
title = "Please confirm before continuing"
info_label: Label = (
"New Trunk interface has been deployed, wait for the physical connection to be moved" # type: ignore
"New Trunk interface has been deployed, "
"wait for the physical connection to be moved." # type: ignore[assignment]
)
yield ProvisioningResultPage
......@@ -303,7 +305,7 @@ def confirm_continue_restore_isis() -> FormGenerator:
title = "Please confirm before continuing"
info_label: Label = (
"ISIS config has been deployed, confirm if you want to restore the old metric" # type: ignore
"ISIS config has been deployed, confirm if you want to restore the old metric." # type: ignore[assignment]
)
yield ProvisioningResultPage
......
......@@ -23,7 +23,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
geant_s_sid: str = subscription.iptrunk.geant_s_sid
iptrunk_description: str = subscription.iptrunk.iptrunk_description
iptrunk_type: IptrunkType = subscription.iptrunk.iptrunk_type
iptrunk_speed: PhyPortCapacity = subscription.iptrunk.iptrunk_speed # type: ignore
iptrunk_speed: PhyPortCapacity = subscription.iptrunk.iptrunk_speed # type: ignore[assignment]
iptrunk_minimum_links: int = subscription.iptrunk.iptrunk_minimum_links
iptrunk_isis_metric: int = ReadOnlyField(subscription.iptrunk.iptrunk_isis_metric)
iptrunk_ipv4_network: ipaddress.IPv4Network = ReadOnlyField(subscription.iptrunk.iptrunk_ipv4_network)
......
......@@ -18,7 +18,7 @@ def initial_input_form_generator() -> FormGenerator:
class TerminateForm(FormPage):
termination_label: Label = (
"Please confirm whether configuration should get removed from the A and B sides of the trunk, and whether "
"IPAM resources should be released." # type: ignore
"IPAM resources should be released." # type: ignore[assignment]
)
tt_number: str
remove_configuration: bool = True
......
......@@ -28,7 +28,7 @@ def _site_selector() -> Choice:
site_subscriptions[str(site_id)] = site_description
# noinspection PyTypeChecker
return Choice("Select a site", zip(site_subscriptions.keys(), site_subscriptions.items())) # type: ignore
return Choice("Select a site", zip(site_subscriptions.keys(), site_subscriptions.items())) # type: ignore[arg-type]
def initial_input_form_generator(product_name: str) -> FormGenerator:
......@@ -37,8 +37,8 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
title = product_name
tt_number: str
customer: customer_selector() # type: ignore
router_site: _site_selector() # type: ignore
customer: customer_selector() # type: ignore[valid-type]
router_site: _site_selector() # type: ignore[valid-type]
hostname: str
ts_port: PortNumber
router_vendor: RouterVendor
......
......@@ -21,7 +21,7 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
class TerminateForm(FormPage):
termination_label: Label = (
"Please confirm whether configuration should get removed from the router, and whether IPAM resources should"
" be released." # type: ignore
" be released." # type: ignore[assignment]
)
tt_number: str
remove_configuration: bool = True
......
......@@ -21,7 +21,7 @@ def initial_input_form_generator(product_name: str) -> FormGenerator: # noqa: C
class Config:
title = product_name
customer: customer_selector() # type: ignore
customer: customer_selector() # type: ignore[valid-type]
site_name: str
site_city: str
site_country: str
......
......@@ -29,7 +29,7 @@ def _generate_routers() -> dict[str, str]:
def initial_input_form_generator() -> FormGenerator:
routers = _generate_routers()
RouterEnum = Choice("Select a router", zip(routers.keys(), routers.items())) # type: ignore
RouterEnum = Choice("Select a router", zip(routers.keys(), routers.items())) # type: ignore[arg-type]
class CreateIptrunkForm(FormPage):
class Config:
......@@ -42,13 +42,13 @@ def initial_input_form_generator() -> FormGenerator:
iptrunk_speed: PhyPortCapacity
iptrunk_minimum_links: int
iptrunk_sideA_node_id: RouterEnum # type: ignore
iptrunk_sideA_node_id: RouterEnum # type: ignore[valid-type]
iptrunk_sideA_ae_iface: str
iptrunk_sideA_ae_geant_a_sid: str
iptrunk_sideA_ae_members: UniqueConstrainedList[str]
iptrunk_sideA_ae_members_descriptions: UniqueConstrainedList[str]
iptrunk_sideB_node_id: RouterEnum # type: ignore
iptrunk_sideB_node_id: RouterEnum # type: ignore[valid-type]
iptrunk_sideB_ae_iface: str
iptrunk_sideB_ae_geant_a_sid: str
iptrunk_sideB_ae_members: UniqueConstrainedList[str]
......
......@@ -11,7 +11,7 @@ def customer_selector() -> Choice:
for customer in all_customers():
customers[customer["id"]] = customer["name"]
return Choice("Select a customer", zip(customers.keys(), customers.items())) # type: ignore
return Choice("Select a customer", zip(customers.keys(), customers.items())) # type: ignore[arg-type]
def iso_from_ipv4(ipv4_address: IPv4Address) -> str:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment