frontend
This commit is contained in:
@@ -49,6 +49,10 @@ def _build_graph(tests: dict[str, Any]) -> dict[str, set[str]]:
|
||||
|
||||
|
||||
def _compatible(a: Any, b: Any) -> bool:
|
||||
# Hard conflict: same testpoint but different STA assignment means they cannot share a window.
|
||||
if _has_testpoint_sta_conflict(a.config, b.config):
|
||||
return False
|
||||
|
||||
# Compatible when same rotation, or both non-P3P and overlap has identical testpoints.
|
||||
if a.rotation == b.rotation:
|
||||
return True
|
||||
@@ -57,6 +61,20 @@ def _compatible(a: Any, b: Any) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def _has_testpoint_sta_conflict(
|
||||
config_a: dict[str, dict[str, str | None]],
|
||||
config_b: dict[str, dict[str, str | None]],
|
||||
) -> bool:
|
||||
testpoint_to_sta_a = _build_testpoint_sta_map(config_a)
|
||||
testpoint_to_sta_b = _build_testpoint_sta_map(config_b)
|
||||
|
||||
overlap = set(testpoint_to_sta_a.keys()) & set(testpoint_to_sta_b.keys())
|
||||
for testpoint in overlap:
|
||||
if testpoint_to_sta_a[testpoint] != testpoint_to_sta_b[testpoint]:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _same_test_points_for_overlap(
|
||||
config_a: dict[str, dict[str, str | None]],
|
||||
config_b: dict[str, dict[str, str | None]],
|
||||
@@ -95,6 +113,30 @@ def _build_station_testpoint_map(config: dict[str, dict[str, str | None]]) -> di
|
||||
return station_to_testpoint
|
||||
|
||||
|
||||
def _build_testpoint_sta_map(config: dict[str, dict[str, str | None]]) -> dict[str, set[str]]:
|
||||
testpoint_to_sta: dict[str, set[str]] = {}
|
||||
|
||||
def _add_entry(entry: dict[str, str | None]) -> None:
|
||||
testpoint = _norm(entry.get("test_point") or entry.get("Testpoint"))
|
||||
sta_raw = _norm(entry.get("sta") or entry.get("STA"))
|
||||
if not testpoint or not sta_raw:
|
||||
return
|
||||
for sta in sta_raw.split(","):
|
||||
sta_clean = _norm(sta)
|
||||
if sta_clean:
|
||||
testpoint_to_sta.setdefault(testpoint, set()).add(sta_clean)
|
||||
|
||||
for band in ("5G", "6G", "2G"):
|
||||
entry = config.get(band) or {}
|
||||
_add_entry(entry)
|
||||
|
||||
for station_key in ("Station 1", "Station 2", "Station 3"):
|
||||
entry = config.get(station_key) or {}
|
||||
_add_entry(entry)
|
||||
|
||||
return testpoint_to_sta
|
||||
|
||||
|
||||
def _norm(value: Any) -> str:
|
||||
if value is None:
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user