From 9b2e9ed74dcc891d8472582122cd714d3cd1c412 Mon Sep 17 00:00:00 2001 From: likho Date: Sat, 30 Sep 2023 01:45:42 -0700 Subject: [PATCH] clearer variable names --- microblog.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/microblog.py b/microblog.py index 6f16cad..18e8f69 100644 --- a/microblog.py +++ b/microblog.py @@ -448,11 +448,11 @@ if __name__ == "__main__": def get_avatars(profiles, save_path, img_src): import hashlib imgs, info = fetch([p["avatar"] for p in profiles]) - l = len(imgs) - if l != len(profiles) or l == 0: + length = len(imgs) + if length != len(profiles) or length == 0: print("error in retrieving images", file=sys.stderr) return - for i in range(0,l): + for i in range(0,length): content_type = info[i].split('/') ext = content_type.pop() if content_type.pop() != "image": @@ -461,10 +461,10 @@ if __name__ == "__main__": data = imgs[i].getvalue() h = hashlib.sha1(data).hexdigest() filename = "%s.%s" % (h, ext) + path = "%s/%s" % (save_path, filename) profiles[i]["avatar"] = "%s/%s" % (img_src, filename) - asdf = "%s/%s" % (save_path, filename) - if not os.path.isfile(asdf): - with open(asdf, "wb") as f: + if not os.path.isfile(path): + with open(path, "wb") as f: f.write(data) j, m = fetch(f_cfg["list"])