From 6ad04db5bd95ad7b9eb50c550da6e5f25a267591 Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Fri, 15 Nov 2024 16:13:32 +0100 Subject: [PATCH] improve code --- dnstapir/dns/mozpsl.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dnstapir/dns/mozpsl.py b/dnstapir/dns/mozpsl.py index 9590a86..9edd97b 100644 --- a/dnstapir/dns/mozpsl.py +++ b/dnstapir/dns/mozpsl.py @@ -43,12 +43,15 @@ def insert(self, array: list[str], nlbl: int, icann: bool) -> None: def search(self, key: list[str]) -> tuple[int, int]: """Search Trie""" + core = 0 + pcore = 0 current = self.root for label in key: - if current.icann: + if current.icann is True: core = current.count - else: + elif current.icann is False: pcore = current.count + # # If current.icann is None, do not update core or pcore if label not in current.children: if current.count != 0: break