]> git.phdru.name Git - bookmarks_db.git/blobdiff - parse_html/bkmk_parse_html.py
Feat(Python3): `<>` -> `!=`
[bookmarks_db.git] / parse_html / bkmk_parse_html.py
index e951cdc19509bb7fbf6658961fa61e39dd682ead..2e412ad84dc69756662c215e287e120dad66f72a 100644 (file)
@@ -5,7 +5,7 @@ This file is a part of Bookmarks database and Internet robot.
 """
 
 __author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 1997-2014 PhiloSoft Design"
+__copyright__ = "Copyright (C) 1997-2017 PhiloSoft Design"
 __license__ = "GNU GPL"
 
 __all__ = ['parse_html', 'parse_filename', 'universal_charset']
@@ -147,23 +147,23 @@ def parse_html(html_text, charset=None, log=None):
       parser.charset = parser.charset.lower().replace("windows-", "cp")
 
    if title and parser.charset and (
-         (parser.charset <> universal_charset) or
-         ((not charset) or (charset <> parser.charset))):
+         (parser.charset != universal_charset) or
+         ((not charset) or (charset != parser.charset))):
       try:
          if parser.meta_charset:
             if log: log("   META charset   : %s" % parser.charset)
-         elif (not charset) or (charset <> parser.charset):
+         elif (not charset) or (charset != parser.charset):
             if log: log("   guessed charset: %s" % parser.charset)
          #if log: log("   current charset: %s" % universal_charset)
          if log: log("   title          : %s" % title)
-         if parser.charset <> universal_charset:
+         if parser.charset != universal_charset:
             try:
                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")
                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:
@@ -173,7 +173,7 @@ def parse_html(html_text, charset=None, log=None):
       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