From 722863c1038663cbe117443a292908ce9b84d160 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 21 Sep 2021 20:31:32 +0200 Subject: [PATCH] fix: [clean-up] use format() instead concatenation --- bin/import.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/import.py b/bin/import.py index 39c55e6..398dd8d 100644 --- a/bin/import.py +++ b/bin/import.py @@ -58,7 +58,7 @@ class CPEHandler( xml.sax.ContentHandler ): self.record = {} self.itemcount += 1 if self.itemcount % 5000 == 0: - print ("... " + str(self.itemcount) + " items processed (" + str(self.wordcount) + " words)") + print ("... {} items processed ({} words)".format(str(self.itemcount), str(self.wordcount))) def CPEExtractor( cpe=None ): @@ -106,7 +106,7 @@ if __name__ == '__main__': print(e) sys.exit(1) - print("Uncompressing " + cpe_path + ".gz ...") + print("Uncompressing {}.gz ...".format(cpe_path)) try: with gzip.open(cpe_path + ".gz", 'rb') as cpe_gz: with open(cpe_path, 'wb') as cpe_xml: @@ -117,10 +117,10 @@ if __name__ == '__main__': sys.exit(1) elif os.path.isfile(cpe_path): - print("Using existing file " + cpe_path + " ...") + print("Using existing file {} ...".format(cpe_path)) if rdb.dbsize() > 0: - print("Flushing " + str(rdb.dbsize()) + " keys from the database...") + print("Flushing {} keys from the database...".format(str(rdb.dbsize()))) rdb.flushdb() print("Populating the database (please be patient)...") @@ -128,4 +128,4 @@ if __name__ == '__main__': Handler = CPEHandler() parser.setContentHandler( Handler ) parser.parse(cpe_path) - print("Done! " + str(rdb.dbsize()) + " keys inserted.") + print("Done! {} keys inserted.".format(str(rdb.dbsize())))