X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=db2bkmk.py;h=897aabcafa922ee64a7c22f3aa92571d544c9a6d;hb=b2b302b348f0b711557961c70744c818cff664f0;hp=e0ac1c1bcb6b76c6247f7680421a2e66765b34a4;hpb=c88cb7a75e7caf1d67466cfa107981d95115fa0c;p=bookmarks_db.git diff --git a/db2bkmk.py b/db2bkmk.py index e0ac1c1..897aabc 100755 --- a/db2bkmk.py +++ b/db2bkmk.py @@ -5,7 +5,7 @@ This file is a part of Bookmarks database and Internet robot. """ __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design" +__copyright__ = "Copyright (C) 2000-2023 PhiloSoft Design" __license__ = "GNU GPL" import sys @@ -22,7 +22,7 @@ def run(): output_filename = writer.filename transl = 0 - transl_name = "" # dictionary translation; default is no translation + transl_name = "" # dictionary translation; default is no translation for _opt, _arg in optlist: if _opt == '-s': @@ -60,14 +60,13 @@ def run(): sys.stdout.write("Writing %s: " % output_filename) sys.stdout.flush() - if transl: new_ext = str(transl) transl_d = {} from m_lib.flad import fladm transl_db = fladm.load_from_file(transl_name, fladm.check_record, ["URL1", "URL2"], [""]) - # This prevents any other key to appear in transl_db ^ + # This prevents any other key to appear in transl_db ^ # Generate translation dictionary (hash table) if transl == 1: @@ -79,11 +78,12 @@ def run(): else: raise ValueError("transl (%d) must be 1 or 2" % transl) - del transl_db # Save few bytes of memory + del transl_db # Save few bytes of memory from bkmk_objects import Walker + class Transl(Walker): - def __init__(self, transl_d): + def __init__(self, transl_d): # noqa: E306 expected 1 blank line self.transl_d = transl_d def bookmark(self, b, level): @@ -95,7 +95,6 @@ def run(): root_folder.walk_depth(Transl(transl_d)) - outfile = open(output_filename, 'w') root_folder.walk_depth(writer(outfile, prune)) outfile.close()