global check_subp, subp_pipe
stop_subp(log)
- check_subp = Subprocess("%s/Robots/bkmk_rforking_sub.py" % os.path.dirname(sys.argv[0]),
+ check_subp = Subprocess("%s/Robots/bkmk_rforking_sub.py"
+ % os.path.dirname(sys.argv[0]),
control_stderr=True)
subp_pipe = RecordFile(check_subp)
subproc_attrs = []
for attr in dir(self):
if attr.startswith('subproc_'):
- subproc_attrs.append((attr[len('subproc_'):], getattr(self, attr)))
+ subproc_attrs.append(
+ (attr[len('subproc_'):], getattr(self, attr))
+ )
if subproc_attrs:
subproc += ':' + ':'.join(
['='.join((k, v)) for k, v in subproc_attrs]
from subproc import RecordFile
-lib_dir = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), os.pardir))
+lib_dir = os.path.normpath(os.path.dirname(os.path.dirname(sys.argv[0])))
sys.path.append(lib_dir) # for bkmk_objects.py
# multiple spaces before operator
url = "%s://%s%s" % (url_type, url_host, url_path)
- error, redirect_code, redirect_to, headers, content = self.get(bookmark, url, True)
+ error, redirect_code, redirect_to, headers, content = \
+ self.get(bookmark, url, True)
if error:
bookmark.error = error
content_type = headers["Content-Type"]
self.log(" Content-Type: %s" % content_type)
try:
- # extract charset from "text/html; foo; charset=UTF-8, bar; baz;"
+ # extract charset from
+ # "text/html; foo; charset=UTF-8, bar; baz;"
content_type, charset = content_type.split(';', 1)
content_type = content_type.strip()
charset = charset.split('=')[1].strip().split(',')[0]
icon = None
if not icon:
icon = "/favicon.ico"
- icon_url = urljoin("%s://%s%s" % (url_type, url_host, url_path), icon)
+ icon_url = urljoin(
+ "%s://%s%s" % (url_type, url_host, url_path), icon)
self.log(" looking for icon at: %s" % icon_url)
if icon_url in icons:
if icons[icon_url]:
try:
_icon_url = icon_url
for i in range(8):
- error, icon_redirect_code, icon_redirect_to, \
- icon_headers, icon_data = \
+ error, icon_redirect_code, \
+ icon_redirect_to, icon_headers, \
+ icon_data = \
self.get(bookmark, _icon_url)
if icon_redirect_code:
_icon_url = icon_redirect_to
- self.log(" redirect to : %s" % _icon_url)
+ self.log(" redirect to : %s"
+ % _icon_url)
else:
if icon_data is None:
raise IOError("No icon")
raise IOError("Too many redirects")
except:
etype, emsg, tb = sys.exc_info()
- self.log(" no icon : %s %s" % (etype, emsg))
+ self.log(" no icon : %s %s"
+ % (etype, emsg))
etype = emsg = tb = None
icons[icon_url] = None
else:
or content_type.startswith("image/") \
or content_type.startswith("text/plain"):
bookmark.icon_href = icon_url
- self.log(" got icon : %s" % content_type)
- if content_type.startswith("application/") \
- or content_type.startswith("text/plain"):
- self.log(" non-image content type, assume x-icon")
+ self.log(" got icon : %s"
+ % content_type)
+ if (
+ content_type.startswith("application/")
+ or content_type.startswith(
+ "text/plain")
+ ):
+ self.log(" non-image content type,"
+ " assume x-icon")
content_type = 'image/x-icon'
- bookmark.icon = "data:%s;base64,%s" % (content_type, b64encode(icon_data))
- icons[icon_url] = (content_type, bookmark.icon)
+ bookmark.icon = "data:%s;base64,%s" \
+ % (content_type, b64encode(icon_data))
+ icons[icon_url] = (content_type,
+ bookmark.icon
+ )
else:
- self.log(" no icon : bad content type '%s'" % content_type)
+ self.log(" no icon :"
+ "bad content type '%s'"
+ % content_type
+ )
icons[icon_url] = None
if parser and parser.refresh:
refresh = parser.refresh
try:
timeout = float(refresh.split(';')[0])
except (IndexError, ValueError):
- self.set_redirect(bookmark, "html", "Bad redirect to %s (%s)" % (url, refresh))
+ self.set_redirect(bookmark, "html",
+ "Bad redirect to %s (%s)"
+ % (url, refresh)
+ )
else:
try:
timeout = int(refresh.split(';')[0])
except ValueError:
pass # float timeout
- self.set_redirect(bookmark, "html", "%s (%s sec)" % (url, timeout))
+ self.set_redirect(bookmark, "html",
+ "%s (%s sec)"
+ % (url, timeout)
+ )
except KeyError as key:
self.log(" no header: %s" % key)
# Error 401 -- authentication required
def http_error_401(self, url, fp, errcode, errmsg, headers, data=None):
- raise IOError(('http error', errcode, "Authentication required ", headers))
+ raise IOError(
+ ('http error', errcode, "Authentication required ", headers))
def http_error_default(self, url, fp, errcode, errmsg, headers):
if fp:
urllib._urlopener = MyURLopener()
# Fake headers to pretend this is a real browser
-_user_agent = "Mozilla/5.0 (X11; U; Linux 2.6 i686; en) Gecko/20001221 Firefox/2.0.0"
+_user_agent = "Mozilla/5.0 (X11; U; Linux 2.6 i686; en)"
+" Gecko/20001221 Firefox/2.0.0"
urllib._urlopener.addheaders[0] = ('User-Agent', _user_agent)
_x_user_agent = "bookmarks_db (Python %d.%d.%d; urllib/%s)" % (
- sys.version_info[0], sys.version_info[1], sys.version_info[2], urllib.__version__)
+ sys.version_info[0], sys.version_info[1],
+ sys.version_info[2], urllib.__version__
+)
urllib._urlopener.addheader('X-User-Agent', _x_user_agent)
urllib._urlopener.addheader('Referer', '')
fname, headers = urllib.urlretrieve(url)
finally:
if accept_charset and bookmark.charset:
- del urllib._urlopener.addheaders[-1] # Remove Accept-Charset
+ # Remove Accept-Charset
+ del urllib._urlopener.addheaders[-1]
infile = open(fname, 'rb')
content = infile.read()
except IOError as e:
if (e[0] == "http error") and (e[1] == -1):
error = None
- bookmark.no_error = "The server did not return any header - it is not an error, actually"
+ bookmark.no_error = "The server did not return any header - "
+ "it is not an error, actually"
self.log(' no headers: %s' % bookmark.no_error)
else:
error = get_error(e)
# Fake headers to pretend this is a real browser
-_user_agent = "Mozilla/5.0 (X11; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0"
+_user_agent = "Mozilla/5.0 (X11; Linux i686; rv:30.0)"
+" Gecko/20100101 Firefox/30.0"
_x_user_agent = "bookmarks_db (Python %d.%d.%d; urllib2)" % (
sys.version_info[0], sys.version_info[1], sys.version_info[2])
return None, e.code, e.hdrs['Location'], None, None
else:
self.log(' HTTP Error %s: %s' % (e.code, e.msg))
- return "HTTP Error %s: %s" % (e.code, e.msg), None, None, None, None
+ return ("HTTP Error %s: %s" % (e.code, e.msg),
+ None, None, None, None)
except urllib2.URLError as e:
self.log(' URL Error: %s' % e.reason)
self.current_folder = None
def load(self):
- bookmarks_db = fladm.load_from_file(self.filename, fladm.check_record, ["Level"])
+ bookmarks_db = fladm.load_from_file(
+ self.filename, fladm.check_record, ["Level"])
root_folder = Folder()
self.folder_stack = [root_folder]
elif level <= save_level - 1:
self.unindent(save_level, level)
else:
- raise ValueError("new level (%d) too big; must be %d - %d" % (level, save_level-1, save_level+1))
+ raise ValueError("new level (%d) too big; must be %d - %d"
+ % (level, save_level-1, save_level+1))
save_level = level
- got_folder = record.has_key("Folder") # Test here to save got_folder for next loop
+ # Test here to save got_folder for next loop
+ got_folder = record.has_key("Folder")
if record.has_key("URL"):
comment = record["Comment"].replace("\\n", '\n')
self.current_folder.append(bookmark)
elif record.has_key("Folder"):
- folder = Folder(record["AddDate"], record["Comment"], record["LastModified"])
+ folder = Folder(
+ record["AddDate"], record["Comment"],
+ record["LastModified"]
+ )
folder.name = record["Folder"]
self.current_folder.append(folder)
self.folder_stack.append(folder)
self.current_folder.append(Ruler())
else:
- raise KeyError("neither \"URL\" nor \"Folder\" nor \"Ruler\" in record " + str(record))
+ raise KeyError(
+ 'neither "URL" nor "Folder" nor "Ruler" in record '
+ + str(record)
+ )
if save_level >= 0:
self.unindent(save_level, 0)
else:
- raise ValueError("new level (%d) too little - must be >= 0" % save_level)
+ raise ValueError("new level (%d) too little - must be >= 0"
+ % save_level)
return root_folder
root_folder = Folder()
root_folder.header = ''
- root_folder.add_date = convert_date_from_json(bookmarks_dict.get("dateAdded"))
+ root_folder.add_date = convert_date_from_json(
+ bookmarks_dict.get("dateAdded"))
root_folder.comment = ''
- root_folder.last_modified = convert_date_from_json(bookmarks_dict.get("lastModified"))
+ root_folder.last_modified = convert_date_from_json(
+ bookmarks_dict.get("lastModified"))
self.folder_stack = [root_folder]
self.current_folder = root_folder
bookmarks_dict["type"] = "text/x-moz-place-container"
self.load_folder(root_folder, bookmarks_dict)
if self.folder_stack:
- raise RuntimeError('Excessive folder stack: %s' % self.folder_stack)
+ raise RuntimeError('Excessive folder stack: %s'
+ % self.folder_stack)
return root_folder
for record in fdict["children"]:
if record["type"] == "text/x-moz-place-container":
folder = Folder(
- add_date=convert_date_from_json(record.get("dateAdded")),
+ add_date=convert_date_from_json(
+ record.get("dateAdded")),
comment=get_comment(record.get("annos")),
- last_modified=convert_date_from_json(record.get("lastModified")))
+ last_modified=convert_date_from_json(
+ record.get("lastModified")))
folder.guid = record.get("guid")
self.current_folder.append(folder)
self.folder_stack.append(folder)
elif record["type"] == "text/x-moz-place":
bookmark = Bookmark(
href=record["uri"].encode('utf-8'),
- add_date=convert_date_from_json(record.get("dateAdded")),
- last_modified=convert_date_from_json(record.get("lastModified")),
+ add_date=convert_date_from_json(
+ record.get("dateAdded")),
+ last_modified=convert_date_from_json(
+ record.get("lastModified")),
keyword=get_str(record, "keyword"),
comment=get_comment(record.get("annos")),
icon_href=record.get("iconuri"),
elif record["type"] == "text/x-moz-place-separator":
ruler = Ruler()
- ruler.add_date = convert_date_from_json(record.get("dateAdded"))
+ ruler.add_date = convert_date_from_json(
+ record.get("dateAdded"))
ruler.guid = record.get("guid")
ruler.id = record["id"]
ruler.index = record["index"]
- ruler.last_modified = convert_date_from_json(record.get("lastModified"))
+ ruler.last_modified = convert_date_from_json(
+ record.get("lastModified"))
ruler.name = encode_title(record.get("title"))
ruler.comment = get_comment(record.get("annos"))
self.current_folder.append(ruler)
else:
- raise ValueError('Unknown record type "%s"' % record["type"])
+ raise ValueError('Unknown record type "%s"'
+ % record["type"])
del self.folder_stack[-1]
if self.folder_stack:
AddDate: %s
Comment: %s
LastModified: %s
-""" % (level, f.name, strftime(f.add_date), f.comment, strftime(f.last_modified)))
+""" % (
+ level, f.name, strftime(f.add_date), f.comment,
+ strftime(f.last_modified))
+ )
def bookmark(self, b, level):
self.outfile.write("""
LastVisit: %s
LastModified: %s
Keyword: %s
-Comment: %s""" % (level+1, b.name, b.href, strftime(b.add_date), strftime(b.last_visit), strftime(b.last_modified), b.keyword, b.comment))
+Comment: %s""" % (
+ level+1, b.name, b.href, strftime(b.add_date),
+ strftime(b.last_visit), strftime(b.last_modified),
+ b.keyword, b.comment)
+ )
for attr_name, attr_out in (
("error", "Error"), ("no_error", "NoError"),
self.outfile.write("\n%s: %s" % (attr_out, value))
if hasattr(b, "last_tested"):
- self.outfile.write("\n%s: %s" % ("LastTested", strftime(getattr(b, "last_tested"))))
+ self.outfile.write("\nLastTested: %s" % strftime(b.last_tested))
self.outfile.write("\n")
def start_folder(self, f, level):
self.outfile.write(ind_s*level + '<DT><H3 ADD_DATE="%s"' % f.add_date)
- if (BKMK_FORMAT == "MOZILLA") and f.last_modified: self.outfile.write(' LAST_MODIFIED="%s"' % f.last_modified)
+ if (BKMK_FORMAT == "MOZILLA") and f.last_modified:
+ self.outfile.write(' LAST_MODIFIED="%s"' % f.last_modified)
self.outfile.write('>%s</H3>\n' % quote_title(f.name))
self._folder(f, level)
self.outfile.write(ind_s*level + "</DL><p>\n")
def bookmark(self, b, level):
- self.outfile.write(ind_s*(level+1) + '<DT><A HREF="%s" ADD_DATE="%s"' % (b.href, b.add_date))
+ self.outfile.write(ind_s*(level+1) + '<DT><A HREF="%s" ADD_DATE="%s"'
+ % (b.href, b.add_date))
if b.last_visit: self.outfile.write(' LAST_VISIT="%s"' % b.last_visit)
if b.last_modified:
self.outfile.write(' LAST_MODIFIED="%s"' % b.last_modified)
elif hasattr(bookmark, "real_title"):
bookmark.name = bookmark.real_title
if report_stats:
- sys.stdout.write("Adding %s with title '%s'\n" % (href, bookmark.name))
+ sys.stdout.write("Adding %s with title '%s'\n"
+ % (href, bookmark.name))
del bookmark.parent
root_folder.append(bookmark)
filename = args[0]
else:
- filename = 'bookmarks.html' # good name both for DOS (bookmark.htm) and UNIX
+ # good name both for DOS (bookmark.htm) and UNIX
+ filename = 'bookmarks.html'
if report_stats:
from storage import storage_name
def start_folder(self, f, level):
f.parent = self.parent_stack[-1]
- self.parent_stack.append(f) # Push the folder onto the stack of parents
+ # Push the folder onto the stack of parents
+ self.parent_stack.append(f)
def end_folder(self, f, level):
del self.parent_stack[-1] # Pop off the stack
self.add_object(r)
-# Helper - make linked linear represenatation of the tree, suitable to be stored in sequential storage
+# Helper - make linked linear represenatation of the tree,
+# suitable to be stored in sequential storage.
def make_linear(root_folder):
linker = InverseLinker()
root_folder.walk_depth(linker)
root_folder.walk_depth(linear)
-# Helper, opposite of make_linear - make a tree from the linked linear representation
+# Helper, opposite of make_linear -
+# make a tree from the linked linear representation.
def make_tree(linear):
root_folder = linear[0]
del linear[0]
def unquote_title(title):
if BKMK_FORMAT == "MOZILLA":
from HTMLParser import HTMLParser
- title = HTMLParser().unescape(title.replace("&", '&').decode('utf-8'))
+ title = HTMLParser().unescape(
+ title.replace("&", '&').decode('utf-8'))
title = title.encode('utf-8').replace("'", "'")
return title
def handle_data(self, data):
if data:
if self.charset and default_encoding:
- data = unicode(data, self.charset, "replace").encode(default_encoding, "xmlcharrefreplace")
+ data = unicode(data, self.charset, "replace").\
+ encode(default_encoding, "xmlcharrefreplace")
self.accumulator += data
# Mozilla - get charset
def start_title(self, attrs):
if default_encoding:
- self.accumulator += '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=%s">\n' % default_encoding
+ self.accumulator += '<META HTTP-EQUIV="Content-Type" '
+ 'CONTENT="text/html; charset=%s">\n' % default_encoding
self.accumulator += "<TITLE>"
def end_title(self):
object = root_folder.linear[object_no]
if object.isBookmark:
- if hasattr(object, "moved") or hasattr(object, "error") \
- or object.href.startswith('place:'): # Firefox SmartBookmarks
+ if hasattr(object, "moved") or hasattr(object, "error") or \
+ object.href.startswith('place:'): # Firefox SmartBookmarks
continue
- if hasattr(object, "real_title") and (object.real_title is not None):
+ if hasattr(object, "real_title") \
+ and (object.real_title is not None):
unquoted_title = unquote_title(quote_title(object.real_title))
unquoted_name = unquote_title(object.name)
if unquoted_name != unquoted_title:
LastModified: %s
IconURI: %s
Icon: %s
- """ % (bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon_href, bookmark.icon))
+ """ % (
+ bookmark.href, getattr(bookmark, 'real_title', ''),
+ strftime(bookmark.last_modified), bookmark.icon_href,
+ bookmark.icon))
robot.stop()
log.close()
"last_tested", "test_time", "icon", "charset",
):
if hasattr(old_object, attr_name):
- setattr(object, attr_name, getattr(old_object, attr_name))
+ setattr(object, attr_name,
+ getattr(old_object, attr_name))
else:
log("Checking %s" % href)
rcode = robot.check_url(object)
#! /usr/bin/env python
-"""Convert a bkmk database back to bookmarks.html (or other format defined by writer)
+"""Convert a bkmk database back to bookmarks.html
+(or other format defined by writer)
This file is a part of Bookmarks database and Internet robot.
"""
if args:
sys.stderr.write("db2bkmk: too many arguments\n")
- sys.stderr.write("Usage: db2bkmk [-s] [-p prune_folder] [-o filename] [-t trans] [-r]\n")
+ sys.stderr.write("Usage: db2bkmk [-s] [-p prune_folder]"
+ " [-o filename] [-t trans] [-r]\n")
sys.exit(1)
from storage import storage
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 ^
+ transl_db = fladm.load_from_file(
+ transl_name, fladm.check_record, ["URL1", "URL2"], [""])
+ # This prevents any other key to appear in transl_db ^
# Generate translation dictionary (hash table)
if transl == 1:
else:
sys.exit("Usage: main filename [charset]")
- parser = parse_filename(filename, charset, log=lambda s: sys.stdout.write(s + '\n'))
+ parser = parse_filename(filename, charset,
+ log=lambda s: sys.stdout.write(s + '\n'))
print(" refresh:", parser.refresh)
print(" icon :", parser.icon)
if log: log(" title : %s" % title)
if parser.charset != universal_charset:
try:
- converted_title = unicode(title, parser.charset).encode(universal_charset)
+ converted_title = unicode(title, parser.charset).\
+ encode(universal_charset)
except UnicodeError:
- if log: log(" incorrect conversion from %s, converting from %s" % (parser.charset, DEFAULT_CHARSET))
- converted_title = unicode(title, DEFAULT_CHARSET, "replace").encode(universal_charset, "replace")
+ if log:
+ log(" incorrect conversion from %s,"
+ "converting from %s"
+ % (parser.charset, DEFAULT_CHARSET))
+ converted_title = \
+ unicode(title, DEFAULT_CHARSET, "replace").\
+ encode(universal_charset, "replace")
parser.charset = DEFAULT_CHARSET
- if log and (converted_title != title): log(" converted title: %s" % converted_title)
+ if log and (converted_title != title):
+ log(" converted title: %s" % converted_title)
except LookupError:
if log: log(" unknown charset: '%s'" % parser.charset)
else:
final_title = recode_entities(converted_title, universal_charset)
parts = [s.strip() for s in final_title.replace('\r', '').split('\n')]
final_title = ' '.join([s for s in parts if s])
- if log and (final_title != converted_title): log(" final title : %s" % final_title)
+ if log and (final_title != converted_title):
+ log(" final title : %s" % final_title)
parser.title = final_title
icon = parser.icon
return None
_charset = root.originalEncoding
- if _charset in ("ISO-8859-2", "windows-1252", "MacCyrillic"): # Replace default
+ if _charset in ("ISO-8859-2", "windows-1252", "MacCyrillic"):
+ # Replace with default and re-parse
_charset = DEFAULT_CHARSET
root = _parse_html(html_text, _charset)
if root is None:
try:
meta_content = meta.get("content")
if meta_content:
- __charset = meta_content.lower().split('charset=')[1].split(';')[0]
+ __charset = meta_content.lower().split('charset=')[1].\
+ split(';')[0]
else:
__charset = False
except IndexError: # No charset in the META Content-Type
try:
meta_content = meta.get("content")
if meta_content:
- __charset = meta_content.lower().split('charset=')[1].split(';')[0]
+ __charset = meta_content.lower().split('charset=')[1].\
+ split(';')[0]
else:
__charset = False
except IndexError: # No charset in the META Content-Type
def _find_icon(Tag):
return (Tag.name == "link") and \
- (Tag.get_attribute_list("rel", '')[0].lower() in ('icon', 'shortcut icon'))
+ (Tag.get_attribute_list("rel", '')[0].lower()
+ in ('icon', 'shortcut icon'))
def parse_html(html_text, charset=None, log=None):
parser = HTML5Parser()
- html_tree = parser.parse(html_text, encoding=charset, parseMeta=bool(charset))
+ html_tree = parser.parse(
+ html_text, encoding=charset, parseMeta=bool(charset))
html = None
if hasattr(html_tree, 'childNodes'):
if meta_content:
try:
meta_charset = \
- meta_content.lower().split('charset=')[1].split(';')[0]
+ meta_content.lower().split('charset=')[1].\
+ split(';')[0]
except IndexError:
meta_charset = False
else:
if (not self.charset) and (http_equiv == "content-type"):
try:
- # extract charset from "text/html; foo; charset=UTF-8, bar; baz;"
- self.charset = content.lower().split('charset=')[1].split(';')[0].split(',')[0]
+ # extract charset from
+ # "text/html; foo; charset=UTF-8, bar; baz;"
+ self.charset = content.lower().split('charset=')[1].\
+ split(';')[0].split(',')[0]
# Remember that the charset was retrieved from
# META tag, not from the Content-Type header
self.meta_charset = 1
for attrname, value in attrs:
if value:
value = value.strip()
- if (attrname == 'rel') and (value.lower() in ('icon', 'shortcut icon')):
+ if (attrname == 'rel') and (
+ value.lower() in ('icon', 'shortcut icon')
+ ):
has_icon = True
elif attrname == 'href':
href = value
except (HTMLParseError, HTMLHeadDone):
pass
- if (parser.title is None) and (parser.refresh is None) and (parser.icon is None):
+ if (parser.title is None) and (parser.refresh is None) \
+ and (parser.icon is None):
return None
return parser
pass
if report_stats:
- print("Broytman set-real_title, Copyright (C) 2003-2023 PhiloSoft Design")
-
+ print("Broytman set-real_title, Copyright (C)"
+ " 2003-2023 PhiloSoft Design")
if args:
sys.stderr.write("set-real_title: too many arguments\n")
sys.stderr.write("Usage: set-real_title [-s]\n")
#! /usr/bin/env python
-"""Run through the bookmarks database and set names to titles from an external file
+"""Run through the bookmarks database and set names to titles
+from an external file
This file is a part of Bookmarks database and Internet robot.
"""
pass
if report_stats:
- print("Broytman set-title-list, Copyright (C) 2003-2023 PhiloSoft Design")
+ print("Broytman set-title-list, Copyright (C)"
+ " 2003-2023 PhiloSoft Design")
if len(args) != 1:
sys.stderr.write("Usage: set-title-list [-s] title_list_file\n")
title = line
elif line: # the third line in every 3 lines must be empty
- raise ValueError("line is not empty for URL `%s', title `%s': line `%s'" % (URL, title, line))
+ raise ValueError(
+ "line is not empty for URL `%s', title `%s': line `%s'"
+ % (URL, title, line)
+ )
else: # We've got 3 lines - add new entry to the mapping
if titles_dict.has_key(URL):
if title != titles_dict[URL]:
- raise ValueError("titles are not identical for URL `%s': `%s' != `%s'" % (URL, title, titles_dict[URL]))
+ raise ValueError(
+ "titles are not identical for URL `%s': `%s' != `%s'"
+ % (URL, title, titles_dict[URL])
+ )
else:
titles_dict[URL] = title
from os import environ
from bkmk_objects import parse_params, set_params
-storage_name, storage_params = parse_params(environ.get("BKMK_STORAGE", "pickle"))
+storage_name, storage_params = parse_params(
+ environ.get("BKMK_STORAGE", "pickle"))
def import_storage(storage_name):