mirror of
https://github.com/Horizontal42/netsleuth.git
synced 2026-11-11 02:12:04 +03:00
cache dataclass_fields lookup in merge_geo
This commit is contained in:
parent
329ff15e74
commit
ab39922bf6
1 changed files with 2 additions and 1 deletions
|
|
@ -176,8 +176,9 @@ _MERGE_SKIP = {"sources", "ip_type"}
|
|||
def merge_geo(candidates: list[tuple[str, IpGeo]]) -> IpGeo:
|
||||
merged = IpGeo()
|
||||
sources: dict[str, str] = {}
|
||||
fields = dataclass_fields(IpGeo)
|
||||
for name, geo in candidates:
|
||||
for f in dataclass_fields(IpGeo):
|
||||
for f in fields:
|
||||
if f.name in _MERGE_SKIP:
|
||||
continue
|
||||
if getattr(merged, f.name) is not None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue