From f3e0aba3ba175e5c030de089b77243e8751f6824 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 31 Mar 2024 10:00:43 +0200 Subject: [PATCH] Continued: - logged types (string or 'None' type) --- fba/commands.py | 26 +++++++++++++------------- fba/http/federation.py | 2 +- fba/networks/lemmy.py | 2 +- fba/networks/pleroma.py | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/fba/commands.py b/fba/commands.py index b951b63..31518a8 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -572,7 +572,7 @@ def fetch_observer(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain) + logger.debug("domain[%s]='%s' is empty after tidyup.domain(): item[domain]='%s' - SKIPPED!", type(domain), domain, item["domain"]) continue logger.debug("domain='%s' - BEFORE!", domain) @@ -829,7 +829,7 @@ def fetch_fba_rss(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain) + logger.debug("domain[%s]='%s' is empty after tidyup.domain() - SKIPPED!", type(domain), domain) continue logger.debug("domain='%s' - BEFORE!", domain) @@ -916,7 +916,7 @@ def fetch_fbabot_atom(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain) + logger.debug("domain[%s]='%s' is empty after tidyup.domain(): href='%s' - SKIPPED!", type(domain), domain, href) continue logger.debug("domain='%s' - BEFORE!", domain) @@ -1124,7 +1124,7 @@ def fetch_txt(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain) + logger.debug("domain[%s]='%s' is empty after tidyup.domain() - SKIPPED!", type(domain), domain) continue elif not domain_helper.is_wanted(domain): logger.debug("domain='%s' is not wanted - SKIPPED!", domain) @@ -1176,7 +1176,7 @@ def fetch_fedipact(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain) + logger.debug("domain[%s]='%s' is empty after tidyup.domain(): row.contents[0]='%s' - SKIPPED!", type(domain), domain, row.contents[0]) continue logger.debug("domain='%s' - BEFORE!", domain) @@ -1485,7 +1485,7 @@ def fetch_fedilist(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain(): row[hostname]='%s' - SKIPPED!", domain, row["hostname"]) + logger.debug("domain[%s]='%s' is empty after tidyup.domain(): row[hostname]='%s' - SKIPPED!", type(domain), domain, row["hostname"]) continue logger.debug("domain='%s' - BEFORE!", domain) @@ -1648,8 +1648,8 @@ def fetch_instances_social(args: argparse.Namespace) -> int: domain = tidyup.domain(row["name"]) if row["name"] not in [None, ""] else None logger.debug("domain='%s' - AFTER!", domain) - if domain is None and domain == "": - logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain) + if domain in [None, ""]: + logger.debug("domain[%s]='%s' is empty after tidyup.domain() - SKIPPED!", type(domain), domain) continue logger.debug("domain='%s' - BEFORE!", domain) @@ -1717,8 +1717,8 @@ def fetch_relaylist(args: argparse.Namespace) -> int: domain = urlparse(row["url"]).netloc.lower().split(":")[0] logger.debug("domain='%s' - AFTER!", domain) - if domain is None and domain == "": - logger.debug("domain='%s' is empty after tidyup.domain() - SKIPPED!", domain) + if domain [None, ""]: + logger.debug("domain[%s]='%s' is empty after tidyup.domain() - SKIPPED!", type(domain), domain) continue logger.debug("domain='%s' - BEFORE!", domain) @@ -1853,7 +1853,7 @@ def fetch_relays(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", domain, row["domain"]) + logger.debug("domain[%s]='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", type(domain), domain, row["domain"]) continue elif domain not in peers: logger.debug("Appending domain='%s' to peers list for relay='%s' ...", domain, row["domain"]) @@ -1895,7 +1895,7 @@ def fetch_relays(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", domain, row["domain"]) + logger.debug("domain[%s]='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", type(domain), domain, row["domain"]) continue elif domain not in peers: logger.debug("Appending domain='%s' to peers list for relay='%s' ...", domain, row["domain"]) @@ -1919,7 +1919,7 @@ def fetch_relays(args: argparse.Namespace) -> int: logger.debug("domain='%s' - AFTER!", domain) if domain in [None, ""]: - logger.debug("domain='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", domain, row["domain"]) + logger.debug("domain[%s]='%s' is empty after tidyup.domain() from origin='%s' - SKIPPED!", type(domain), domain, row["domain"]) continue elif domain not in peers: logger.debug("Appending domain='%s' to peers list for relay='%s' ...", domain, row["domain"]) diff --git a/fba/http/federation.py b/fba/http/federation.py index fbb7f74..2aa070b 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -154,7 +154,7 @@ def fetch_instances(domain: str, origin: str, software: str, command: str, path: logger.debug("instance='%s' - AFTER!", instance) if instance in [None, ""]: - logger.warning("instance='%s' is empty after tidyup.domain(), domain='%s'", instance, domain) + logger.warning("instance[%s]='%s' is empty after tidyup.domain(), domain='%s'", type(instance), instance, domain) continue elif ".." in instance: logger.warning("instance='%s' contains double-dot, removing ...", instance) diff --git a/fba/networks/lemmy.py b/fba/networks/lemmy.py index b65b28f..8a9712d 100644 --- a/fba/networks/lemmy.py +++ b/fba/networks/lemmy.py @@ -215,7 +215,7 @@ def fetch_blocks(domain: str) -> list: logger.debug("blocked='%s'", blocked) if blocked in [None, ""]: - logger.warning("blocked='%s' is empty after tidyup.domain() - SKIPPED!", tag.contents[0]) + logger.warning("blocked[%s]='%s' is empty after tidyup.domain(): tag.contents[0]='%s' - SKIPPED!", type(blocked), blocked, tag.contents[0]) continue elif not domain_helper.is_wanted(blocked): logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked) diff --git a/fba/networks/pleroma.py b/fba/networks/pleroma.py index bdccdc2..3769fee 100644 --- a/fba/networks/pleroma.py +++ b/fba/networks/pleroma.py @@ -126,7 +126,7 @@ def fetch_blocks(domain: str) -> list: logger.debug("blocked='%s' - AFTER!", blocked) if blocked in [None, ""]: - logger.warning("blocked='%s' is empty after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", blocked, domain, block_level) + logger.warning("blocked[%s]='%s' is empty after tidyup.domain(): domain='%s',block_level='%s' - SKIPPED!", blocked, domain, block_level) continue elif validators.domain(blocked) and blacklist.is_blacklisted(blocked): logger.debug("blocked='%s' is blacklisted - SKIPPED!") @@ -163,7 +163,7 @@ def fetch_blocks(domain: str) -> list: logger.debug("blocked='%s' - AFTER!", blocked) if blocked in [None, ""]: - logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level) + logger.warning("blocked[%s]='%s' is empty after tidyup.domain(): domain='%s',block_level='%s'", type(blocked), blocked, domain, block_level) continue elif not domain_helper.is_wanted(blocked): logger.debug("blocked='%s' is not wanted - SKIPPED!", blocked) @@ -223,8 +223,8 @@ def fetch_blocks(domain: str) -> list: logger.debug("blocked='%s',reason='%s' - AFTER!", blocked, reason) - if blocked == "": - logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level) + if blocked in [None, ""]: + logger.warning("blocked[%s]='%s' is empty after tidyup.domain(): domain='%s',block_level='%s'", type(blocked), blocked, domain, block_level) continue logger.debug("Checking %d blockdict records ...", len(blockdict)) @@ -250,8 +250,8 @@ def fetch_blocks(domain: str) -> list: if blocked not in rows or "reason" not in rows[blocked]: logger.warning("Cannot find blocked='%s' in rows()=%d,domain='%s' - BREAK!", blocked, len(rows), domain) break - elif blocked == "": - logger.warning("blocked is empty after tidyup.domain(): domain='%s',block_level='%s'", domain, block_level) + elif blocked in [None, ""]: + logger.warning("blocked[%s]='%s' is empty after tidyup.domain(): domain='%s',block_level='%s'", type(blocked), blocked, domain, block_level) continue logger.debug("Checking %d blockdict record(s) ...", len(blockdict)) -- 2.39.5