From 99907b89626aa75419330214c74cfaac6e4c2743 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 7 Aug 2024 18:28:49 +0300 Subject: [PATCH] Style(Robots): Rename `check_url` to `check_bookmark` Also rename `smart_get` to `get_url`. --- Robots/bkmk_rforking.py | 2 +- Robots/bkmk_rforking_sub.py | 2 +- Robots/bkmk_robot_base.py | 8 ++++---- bkmk-add.py | 2 +- check_urls.py | 2 +- check_urls_db.py | 2 +- get_url.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Robots/bkmk_rforking.py b/Robots/bkmk_rforking.py index c956d13..ca845b8 100644 --- a/Robots/bkmk_rforking.py +++ b/Robots/bkmk_rforking.py @@ -54,7 +54,7 @@ _set_subproc = True class robot_forking(Robot): subproc = 'urllib' # Default subprocess - def check_url(self, bookmark): + def check_bookmark(self, bookmark): global _set_subproc if _set_subproc: _set_subproc = False diff --git a/Robots/bkmk_rforking_sub.py b/Robots/bkmk_rforking_sub.py index 8bbf68f..76d070d 100755 --- a/Robots/bkmk_rforking_sub.py +++ b/Robots/bkmk_rforking_sub.py @@ -40,7 +40,7 @@ def run(): while 1: bookmark = pickle.loads(bkmk_in.read_record()) log(bookmark.href) - robot.check_url(bookmark) + robot.check_bookmark(bookmark) bkmk_out.write_record(pickle.dumps(bookmark)) log.outfile.flush() diff --git a/Robots/bkmk_robot_base.py b/Robots/bkmk_robot_base.py index 6d3479a..bb90d88 100644 --- a/Robots/bkmk_robot_base.py +++ b/Robots/bkmk_robot_base.py @@ -97,13 +97,13 @@ class robot_base(Robot): def version_str(self): return self.__class__.__name__ - def check_url(self, bookmark): + def check_bookmark(self, bookmark): try: self.start = int(time.time()) bookmark.icon = None error, http_status_code, redirect_to, headers, content = \ - self.smart_get(bookmark, bookmark.href, True) + self.get_url(bookmark, bookmark.href, True) if error is not None: bookmark.error = error @@ -217,7 +217,7 @@ class robot_base(Robot): icon_error, \ icon_status_code, icon_redirect_to, \ icon_headers, icon_data = \ - self.smart_get(bookmark, _icon_url) + self.get_url(bookmark, _icon_url) if icon_error: raise IOError("No icon: " + icon_error) break @@ -336,7 +336,7 @@ class robot_base(Robot): finally: self.finish_check_url(bookmark) - def smart_get(self, bookmark, url, accept_charset=False): + def get_url(self, bookmark, url, accept_charset=False): split_results = urlsplit(url) url_proto = split_results.scheme url_host = split_results.hostname diff --git a/bkmk-add.py b/bkmk-add.py index d4c1add..8259df5 100755 --- a/bkmk-add.py +++ b/bkmk-add.py @@ -59,7 +59,7 @@ def run(): print("Using", robot) robot = robot(None) - robot.check_url(bookmark) # get real title and last modified date + robot.check_bookmark(bookmark) # get real title and last modified date robot.stop() if title: # forced title diff --git a/check_urls.py b/check_urls.py index 9009d00..e7d68f9 100755 --- a/check_urls.py +++ b/check_urls.py @@ -48,7 +48,7 @@ def run(): bookmark = Bookmark(href=url, add_date=None) bookmark.parent = None - robot.check_url(bookmark) + robot.check_bookmark(bookmark) if hasattr(bookmark, 'error'): print(bookmark.error) diff --git a/check_urls_db.py b/check_urls_db.py index dbab6bf..515bbfc 100755 --- a/check_urls_db.py +++ b/check_urls_db.py @@ -133,7 +133,7 @@ def run(): getattr(old_object, attr_name)) else: log("Checking %s" % href) - robot.check_url(object) + robot.check_bookmark(object) checked[href] = object_no urls_no = urls_no + 1 diff --git a/get_url.py b/get_url.py index 996b829..2a411e5 100755 --- a/get_url.py +++ b/get_url.py @@ -32,7 +32,7 @@ def run(): bookmark.parent = None error, redirect_code, redirect_to, headers, content = \ - robot.smart_get(bookmark, url, True) + robot.get_url(bookmark, url, True) if error: sys.stderr.write(error + '\n') -- 2.39.5