Skip to content
Snippets Groups Projects
Commit 4e9a1cab authored by Erik Reid's avatar Erik Reid
Browse files

lint & typing

parent 4bcafeb6
No related branches found
No related tags found
No related merge requests found
......@@ -139,7 +139,7 @@ def get_pops() -> PopList:
city=pop_dict['city'],
country=pop_dict['country'],
)
return PopList(pops=map(_make_pop, pop_list_obj))
return PopList(pops=list(map(_make_pop, pop_list_obj)))
@router.get("/equipment")
......@@ -163,7 +163,7 @@ def get_equipment() -> EquipmentList:
pop=equipment_dict['pop'],
status=equipment_dict['status'],
)
return EquipmentList(equipment=map(_make_equipment, equipment_list_obj))
return EquipmentList(equipment=list(map(_make_equipment, equipment_list_obj)))
@router.get("/trunks")
......
import concurrent.futures
import jsonschema
import logging
import time
from threading import Event
from typing import Any
import jsonschema
import requests
from . import cache
......
import functools
import logging
from collections.abc import Generator
import re
from collections.abc import Generator
from typing import Any
from pydantic import BaseModel
......@@ -36,9 +36,10 @@ class Service(BaseModel):
class ServiceList(BaseModel):
services: list[Service]
def endpoint_to_pop(endpoint: dict[str, Any], inprov_equipment_dict: list[dict[str, str]]) -> str:
def endpoint_to_pop(endpoint: dict[str, Any], inprov_equipment_dict: dict[str, dict[str, Any]]) -> str:
def _hostname_to_equipment(_hn):
def _hostname_to_equipment(_hn: str) -> str:
m = re.match(r'^(.+)\.geant\.net$', _hn)
if not m:
logger.error(f'unexpected hostname pattern: {_hn}')
......@@ -58,9 +59,9 @@ def endpoint_to_pop(endpoint: dict[str, Any], inprov_equipment_dict: list[dict[s
logger.error(f'unknown endpoint equipment: {eq_name}')
return '?'
return inprov_equipment_dict[eq_name]['pop']
pop_name = inprov_equipment_dict[eq_name]['pop']
assert isinstance(pop_name, str) # mypy noise
return pop_name
def _services(service_type: str | None = None) -> Generator[Service]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment