X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=check_dups.py;h=df79df86cbe1aecea85ef89601b097c06b8c4225;hb=0fc56e5cbd6dcd8837709be9ebb6facaa7fc687b;hp=0a267ac60544a28322657df7ba7227aa26e7deaa;hpb=c88cb7a75e7caf1d67466cfa107981d95115fa0c;p=bookmarks_db.git diff --git a/check_dups.py b/check_dups.py index 0a267ac..df79df8 100755 --- a/check_dups.py +++ b/check_dups.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """Check duplicate URLs in the bookmarks database This file is a part of Bookmarks database and Internet robot. @@ -9,12 +9,13 @@ import sys __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design" +__copyright__ = "Copyright (C) 2000-2023 PhiloSoft Design" __license__ = "GNU GPL" log_file = None + def report_dup(href, object_no): s = "Duplicate URL: %s (first at rec. %d)" % (href, object_no) @@ -43,7 +44,7 @@ def run(): pass if report_stats: - print("Broytman check_dups, Copyright (C) 2000-2017 PhiloSoft Design") + print("Broytman check_dups, Copyright (C) 2000-2023 PhiloSoft Design") if args: sys.stderr.write("check_urls: too many arguments\n") @@ -51,7 +52,7 @@ def run(): sys.exit(1) if log_filename: - log_file = open(log_filename, 'w') + log_file = open(log_filename, 'wt') from storage import storage storage = storage() @@ -68,7 +69,6 @@ def run(): if report_stats: print("Ok") - dup_dict = {} for object_no in range(objects): @@ -76,12 +76,11 @@ def run(): if object.isBookmark: href = object.href - if dup_dict.has_key(href): + if href in dup_dict: report_dup(href, dup_dict[href]) else: dup_dict[href] = object_no - if log_filename: log_file.close()