♻️ (flows.py): Add type ignore comments to suppress type checking errors for certain expressions.

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-06-19 20:30:54 -03:00
commit d8bd09661a

View file

@ -56,14 +56,14 @@ def create_flow(
).first(): ).first():
flows = session.exec( flows = session.exec(
select(Flow) select(Flow)
.where(Flow.endpoint_name.like(f"{flow.endpoint_name}-%")) .where(Flow.endpoint_name.like(f"{flow.endpoint_name}-%")) # type: ignore
.where(Flow.user_id == current_user.id) .where(Flow.user_id == current_user.id)
).all() ).all()
if flows: if flows:
# The endpoitn name is like "my-endpoint","my-endpoint-1", "my-endpoint-2" # The endpoitn name is like "my-endpoint","my-endpoint-1", "my-endpoint-2"
# so we need to get the highest number and add 1 # so we need to get the highest number and add 1
# we need to get the last part of the endpoint name # we need to get the last part of the endpoint name
numbers = [int(flow.endpoint_name.split("-")[-1]) for flow in flows] numbers = [int(flow.endpoint_name.split("-")[-1]) for flow in flows] # type: ignore
flow.endpoint_name = f"{flow.endpoint_name}-{max(numbers) + 1}" flow.endpoint_name = f"{flow.endpoint_name}-{max(numbers) + 1}"
else: else:
flow.endpoint_name = f"{flow.endpoint_name}-1" flow.endpoint_name = f"{flow.endpoint_name}-1"