From: Oleg Broytman Date: Tue, 5 Sep 2023 15:53:07 +0000 (+0300) Subject: Style: Fix flake8 E402 module level import not at top of file X-Git-Tag: 5.0.0~81 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=b9c8d112b8d8d0f7c726ee7dd07a89b6569c90a1;p=bookmarks_db.git Style: Fix flake8 E402 module level import not at top of file --- diff --git a/Robots/bkmk_rforking_sub.py b/Robots/bkmk_rforking_sub.py index 4190f28..f0bb912 100755 --- a/Robots/bkmk_rforking_sub.py +++ b/Robots/bkmk_rforking_sub.py @@ -15,9 +15,6 @@ __all__ = [] import os import sys -lib_dir = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), os.pardir)) -sys.path.append(lib_dir) # for bkmk_objects.py - try: import cPickle pickle = cPickle @@ -26,6 +23,9 @@ except ImportError: from subproc import RecordFile +lib_dir = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), os.pardir)) +sys.path.append(lib_dir) # for bkmk_objects.py + def run(): bkmk_in = RecordFile(sys.stdin) diff --git a/check_url.py b/check_url.py index 0d40ba9..618ae64 100755 --- a/check_url.py +++ b/check_url.py @@ -11,6 +11,9 @@ __license__ = "GNU GPL" import sys import httplib +from bkmk_objects import Bookmark +from Writers.bkmk_wflad import strftime + HTTP = httplib.HTTP @@ -22,9 +25,6 @@ class MyHTTP(HTTP): httplib.HTTP = MyHTTP -from bkmk_objects import Bookmark -from Writers.bkmk_wflad import strftime - def run(): print("Broytman check_url, Copyright (C) 2010-2023 PhiloSoft Design") diff --git a/parse_html/bkmk_parse_html.py b/parse_html/bkmk_parse_html.py index 07fe32e..c14d055 100644 --- a/parse_html/bkmk_parse_html.py +++ b/parse_html/bkmk_parse_html.py @@ -12,11 +12,7 @@ __all__ = ['parse_html', 'parse_filename', 'universal_charset'] import codecs - -universal_charset = "utf-8" -DEFAULT_CHARSET = "cp1251" # Stupid default for Russian Cyrillic - -parsers = [] +import os try: from . import bkmk_ph_beautifulsoup4 @@ -66,6 +62,11 @@ else: import re from htmlentitydefs import name2codepoint +universal_charset = "utf-8" +DEFAULT_CHARSET = "cp1251" # Stupid default for Russian Cyrillic + +parsers = [] + entity_re = re.compile("(&\w+;)") num_entity_re = re.compile("(&#[0-9]+;)") @@ -93,7 +94,6 @@ def recode_entities(title, charset): return ''.join(output) -import os BKMK_DEBUG_HTML_PARSERS = os.environ.get("BKMK_DEBUG_HTML_PARSERS")