]> git.mxchange.org Git - fba.git/commitdiff
Notation applied:
authorRoland Häder <roland@mxchange.org>
Sat, 24 Jun 2023 12:01:29 +0000 (14:01 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 24 Jun 2023 12:02:41 +0000 (14:02 +0200)
- decimals in lazy strings with %d
- strings with '%s'

fba/commands.py
fba/helpers/version.py
fba/http/federation.py
fba/http/network.py
fba/networks/mastodon.py
fba/networks/misskey.py
fba/networks/pleroma.py

index 2374f06ca17d9713d073ab70f6c538a50a31b9c9..47a4c5ac405ee83ef235a5e7f7b1fb4afd72f80c 100644 (file)
@@ -68,7 +68,7 @@ def check_instance(args: argparse.Namespace) -> int:
     else:
         logger.info("args.domain='%s' is not known", args.domain)
 
-    logger.debug("status='%d' - EXIT!", status)
+    logger.debug("status=%d - EXIT!", status)
     return status
 
 def fetch_pixelfed_api(args: argparse.Namespace) -> int:
@@ -334,7 +334,7 @@ def fetch_blocks(args: argparse.Namespace) -> int:
                 logger.debug("Invoking blocks.add_instance(%s, %s, %s, %s)", blocker, block["blocked"], block["reason"], block['block_level'])
                 blocks.add_instance(blocker, block["blocked"], block["reason"], block['block_level'])
 
-                logger.debug("block_level='%s',config[bot_enabled]=%s", block['block_level'], config.get("bot_enabled"))
+                logger.debug("block_level='%s',config[bot_enabled]='%s'", block['block_level'], config.get("bot_enabled"))
                 if block['block_level'] == "reject" and config.get("bot_enabled"):
                     logger.debug("blocker='%s' has blocked '%s' with reason='%s' - Adding to bot notification ...", blocker, block["blocked"], block["reason"])
                     blockdict.append({
index 96ba574f504f4ddaa836e1be24aece1d2b13ef67..aa0c54ff6ccf7ed4e23fd8347a8eeebf4aceb0e6 100644 (file)
@@ -96,7 +96,7 @@ def strip_powered_by(software: str) -> str:
         return software
 
     start = software.find("powered by ")
-    logger.debug("start[%s]='%d'", type(start), start)
+    logger.debug("start[%s]=%d", type(start), start)
 
     software = software[start + 11:].strip()
     logger.debug("software='%s'", software)
@@ -117,7 +117,7 @@ def strip_hosted_on(software: str) -> str:
         return software
 
     end = software.find("hosted on ")
-    logger.debug("end[%s]='%d'", type(end), end)
+    logger.debug("end[%s]=%d", type(end), end)
 
     software = software[0:end].strip()
     logger.debug("software[%s]='%s'", type(software), software)
@@ -144,7 +144,7 @@ def strip_until(software: str, until: str) -> str:
     # Next, strip until part
     end = software.find(until)
 
-    logger.debug("end[%s]='%d'", type(end), end)
+    logger.debug("end[%s]=%d", type(end), end)
     if end > 0:
         software = software[0:end].strip()
 
index e3b93b1e5c6bf9d46da084ff76a98d70c7d867ce..84a007105a79201f0b6bcdcc11e2d5b0ffcfcfcf 100644 (file)
@@ -424,7 +424,7 @@ def determine_software(domain: str, path: str = None) -> str:
         # Continue raising it
         raise data["exception"]
     elif "error_message" in data:
-        logger.debug("Returned error_message during fetching nodeinfo: '%s',status_code='%d'", data['error_message'], data['status_code'])
+        logger.debug("Returned error_message during fetching nodeinfo: '%s',status_code=%d", data['error_message'], data['status_code'])
         return fetch_generator_from_path(domain)
     elif "status" in data and data["status"] == "error" and "message" in data:
         logger.warning("JSON response is an error: '%s'", data["message"])
index c57f0a59a583e794365a5b252611a6a42c0e449d..d15b5636617ebea0921e3f7be51292b926f54113 100644 (file)
@@ -84,9 +84,9 @@ def post_json_api(domain: str, path: str, data: str = "", headers: dict = dict()
 
         json_reply["json"] = json_from_response(response)
 
-        logger.debug("response.ok='%s',response.status_code='%d',json_reply[]='%s'", response.ok, response.status_code, type(json_reply))
+        logger.debug("response.ok='%s',response.status_code=%d,json_reply[]='%s'", response.ok, response.status_code, type(json_reply))
         if not response.ok or response.status_code >= 400:
-            logger.warning("Cannot query JSON API: domain='%s',path='%s',data()=%d,response.status_code='%d',json_reply[]='%s'", domain, path, len(data), response.status_code, type(json_reply))
+            logger.warning("Cannot query JSON API: domain='%s',path='%s',data()=%d,response.status_code=%d,json_reply[]='%s'", domain, path, len(data), response.status_code, type(json_reply))
             json_reply["status_code"]   = response.status_code
             json_reply["error_message"] = response.reason
             del json_reply["json"]
@@ -124,7 +124,7 @@ def fetch_api_url(url: str, timeout: tuple) -> dict:
 
         logger.debug("response.ok='%s',response.status_code='%s',json_reply[]='%s'", response.ok, response.status_code, type(json_reply))
         if not response.ok or response.status_code >= 400:
-            logger.warning("Cannot query JSON API: url='%s',response.status_code='%d',json_reply[]='%s'", url, response.status_code, type(json_reply))
+            logger.warning("Cannot query JSON API: url='%s',response.status_code=%d,json_reply[]='%s'", url, response.status_code, type(json_reply))
             json_reply["status_code"]   = response.status_code
             json_reply["error_message"] = response.reason
             del json_reply["json"]
@@ -175,9 +175,9 @@ def get_json_api(domain: str, path: str, headers: dict, timeout: tuple) -> dict:
 
     json_reply["json"] = json_from_response(response)
 
-    logger.debug("response.ok='%s',response.status_code='%d',json_reply[]='%s'", response.ok, response.status_code, type(json_reply))
+    logger.debug("response.ok='%s',response.status_code=%d,json_reply[]='%s'", response.ok, response.status_code, type(json_reply))
     if not response.ok or response.status_code >= 400:
-        logger.warning("Cannot query JSON API: domain='%s',path='%s',response.status_code='%d',json_reply[]='%s'", domain, path, response.status_code, type(json_reply))
+        logger.warning("Cannot query JSON API: domain='%s',path='%s',response.status_code=%d,json_reply[]='%s'", domain, path, response.status_code, type(json_reply))
         json_reply["status_code"]   = response.status_code
         json_reply["error_message"] = response.reason
         del json_reply["json"]
@@ -202,7 +202,7 @@ def send_bot_post(domain: str, blocklist: dict):
 
     logger.debug("blocklist()=%d", len(blocklist))
     for block in blocklist:
-        logger.debug("block[%s]=%s", type(block), block)
+        logger.debug("block[%s]='%s'", type(block), block)
         if block["reason"] is None or block["reason"] == '':
             message = message + block["blocked"] + " with unspecified reason\n"
         else:
index 78939bdeacae58e81d87ed2741be04a2be84a8d8..9ed961b9c31cf14507c1d712d5ea8d67b325bfb2 100644 (file)
@@ -161,7 +161,7 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list:
 
         logger.debug("data[]='%s'", type(data))
         if "error_message" in data:
-            logger.debug("Was not able to fetch domain_blocks from domain='%s': status_code='%d',error_message='%s'", domain, data['status_code'], data['error_message'])
+            logger.debug("Was not able to fetch domain_blocks from domain='%s': status_code=%d,error_message='%s'", domain, data['status_code'], data['error_message'])
             instances.set_last_error(domain, data)
             return blocklist
         elif "json" in data and "error" in data["json"]:
index fa169c7b788549a3da3e5154dc15dfac943205f6..e47c7dd9d04548c5d63171fec5dfb7665a83e69a 100644 (file)
@@ -55,7 +55,7 @@ def fetch_peers(domain: str) -> list:
     # instances page-by-page, since that troonware doesn't support
     # sending them all at once
     while True:
-        logger.debug("Fetching offset='%d' from domain='%s' ...", offset, domain)
+        logger.debug("Fetching offset=%d from domain='%s' ...", offset, domain)
         if offset == 0:
             fetched = network.post_json_api(domain, "/api/federation/instances", json.dumps({
                 "sort" : "+pubAt",
@@ -91,7 +91,7 @@ def fetch_peers(domain: str) -> list:
             logger.debug("Fetched %d row(s) but expected: %d", len(rows), config.get('misskey_limit'))
             offset = offset + (config.get("misskey_limit") - len(rows))
         else:
-            logger.debug("Raising offset by step='%d'", step)
+            logger.debug("Raising offset by step=%d", step)
             offset = offset + step
 
         already = 0
@@ -147,9 +147,9 @@ def fetch_blocks(domain: str) -> list:
     # instances page-by-page since it doesn't support sending them all at once
     while True:
         try:
-            logger.debug("Fetching offset='%d' from domain='%s' ...", offset, domain)
+            logger.debug("Fetching offset=%d from domain='%s' ...", offset, domain)
             if offset == 0:
-                logger.debug("Sending JSON API request to domain='%s',step='%d',offset='%d'", domain, step, offset)
+                logger.debug("Sending JSON API request to domain='%s',step=%d,offset=%d", domain, step, offset)
                 fetched = network.post_json_api(domain, "/api/federation/instances", json.dumps({
                     "sort"     : "+pubAt",
                     "host"     : None,
@@ -157,7 +157,7 @@ def fetch_blocks(domain: str) -> list:
                     "limit"    : step
                 }), headers)
             else:
-                logger.debug("Sending JSON API request to domain='%s',step='%d',offset='%d'", domain, step, offset)
+                logger.debug("Sending JSON API request to domain='%s',step=%d,offset=%d", domain, step, offset)
                 fetched = network.post_json_api(domain, "/api/federation/instances", json.dumps({
                     "sort"     : "+pubAt",
                     "host"     : None,
@@ -186,7 +186,7 @@ def fetch_blocks(domain: str) -> list:
                 logger.debug("Fetched %d row(s) but expected: %d", len(rows), config.get('misskey_limit'))
                 offset = offset + (config.get("misskey_limit") - len(rows))
             else:
-                logger.debug("Raising offset by step='%d'", step)
+                logger.debug("Raising offset by step=%d", step)
                 offset = offset + step
 
             count = 0
@@ -217,7 +217,7 @@ def fetch_blocks(domain: str) -> list:
         # Fetch blocked (full suspended) instances
         try:
             if offset == 0:
-                logger.debug("Sending JSON API request to domain='%s',step='%d',offset='%d'", domain, step, offset)
+                logger.debug("Sending JSON API request to domain='%s',step=%d,offset=%d", domain, step, offset)
                 fetched = network.post_json_api(domain, "/api/federation/instances", json.dumps({
                     "sort"   : "+pubAt",
                     "host"   : None,
@@ -225,7 +225,7 @@ def fetch_blocks(domain: str) -> list:
                     "limit"  : step
                 }), headers)
             else:
-                logger.debug("Sending JSON API request to domain='%s',step='%d',offset='%d'", domain, step, offset)
+                logger.debug("Sending JSON API request to domain='%s',step=%d,offset=%d", domain, step, offset)
                 fetched = network.post_json_api(domain, "/api/federation/instances", json.dumps({
                     "sort"   : "+pubAt",
                     "host"   : None,
@@ -254,7 +254,7 @@ def fetch_blocks(domain: str) -> list:
                 logger.debug("Fetched %d row(s) but expected: %d'", len(rows), config.get('misskey_limit'))
                 offset = offset + (config.get("misskey_limit") - len(rows))
             else:
-                logger.debug("Raising offset by step='%d'", step)
+                logger.debug("Raising offset by step=%d", step)
                 offset = offset + step
 
             count = 0
index 9998321198b5728457ee40ca59c137240b3abed8..8d0e6e0d01aef8e5d1b74056f850d5af30e4188e 100644 (file)
@@ -329,7 +329,7 @@ def fetch_blocks_from_about(domain: str) -> dict:
                 (config.get("connection_timeout"), config.get("read_timeout"))
             )
 
-            logger.debug("response.ok='%s',response.status_code='%d',response.text()=%d", response.ok, response.status_code, len(response.text))
+            logger.debug("response.ok='%s',response.status_code=%d,response.text()=%d", response.ok, response.status_code, len(response.text))
             if not response.ok or response.text.strip() == "":
                 logger.warning("path='%s' does not exist on domain='%s' - SKIPPED!", path, domain)
                 continue