Commit ae5ff5e46666d6e4deac209b1a39c2e0ae16a4c6

Authored by Christian Herdtweck
1 parent d3127879

various: adjust import of io_encoding functions

oletools/msodde.py
@@ -74,7 +74,7 @@ from oletools import xls_parser @@ -74,7 +74,7 @@ from oletools import xls_parser
74 from oletools import rtfobj 74 from oletools import rtfobj
75 from oletools.ppt_record_parser import is_ppt 75 from oletools.ppt_record_parser import is_ppt
76 from oletools import crypto 76 from oletools import crypto
77 -from oletools.common import ensure_stdout_handles_unicode 77 +from oletools.common.io_encoding import ensure_stdout_handles_unicode
78 from oletools.common.log_helper import log_helper 78 from oletools.common.log_helper import log_helper
79 79
80 # ----------------------------------------------------------------------------- 80 # -----------------------------------------------------------------------------
oletools/olemeta.py
@@ -79,7 +79,7 @@ if not _parent_dir in sys.path: @@ -79,7 +79,7 @@ if not _parent_dir in sys.path:
79 import olefile 79 import olefile
80 from oletools.thirdparty import xglob 80 from oletools.thirdparty import xglob
81 from oletools.thirdparty.tablestream import tablestream 81 from oletools.thirdparty.tablestream import tablestream
82 -from oletools.common import ensure_stdout_handles_unicode 82 +from oletools.common.io_encoding import ensure_stdout_handles_unicode
83 83
84 84
85 #=== MAIN ================================================================= 85 #=== MAIN =================================================================
oletools/oleobj.py
@@ -73,7 +73,7 @@ except ImportError: @@ -73,7 +73,7 @@ except ImportError:
73 from oletools.ppt_record_parser import (is_ppt, PptFile, 73 from oletools.ppt_record_parser import (is_ppt, PptFile,
74 PptRecordExOleVbaActiveXAtom) 74 PptRecordExOleVbaActiveXAtom)
75 from oletools.ooxml import XmlParser 75 from oletools.ooxml import XmlParser
76 -from oletools.common import ensure_stdout_handles_unicode 76 +from oletools.common.io_encoding import ensure_stdout_handles_unicode
77 77
78 # ----------------------------------------------------------------------------- 78 # -----------------------------------------------------------------------------
79 # CHANGELOG: 79 # CHANGELOG:
oletools/olevba.py
@@ -317,7 +317,7 @@ from oletools import ppt_parser @@ -317,7 +317,7 @@ from oletools import ppt_parser
317 from oletools import oleform 317 from oletools import oleform
318 from oletools import rtfobj 318 from oletools import rtfobj
319 from oletools import crypto 319 from oletools import crypto
320 -from oletools.common import ensure_stdout_handles_unicode 320 +from oletools.common.io_encoding import ensure_stdout_handles_unicode
321 from oletools.common import codepages 321 from oletools.common import codepages
322 322
323 # monkeypatch email to fix issue #32: 323 # monkeypatch email to fix issue #32:
oletools/ooxml.py
@@ -17,7 +17,7 @@ TODO: "xml2003" == "flatopc"? @@ -17,7 +17,7 @@ TODO: "xml2003" == "flatopc"?
17 17
18 import sys 18 import sys
19 from oletools.common.log_helper import log_helper 19 from oletools.common.log_helper import log_helper
20 -from oletools.common import uopen 20 +from oletools.common.io_encoding import uopen
21 from zipfile import ZipFile, BadZipfile, is_zipfile 21 from zipfile import ZipFile, BadZipfile, is_zipfile
22 from os.path import splitext 22 from os.path import splitext
23 import io 23 import io
@@ -650,7 +650,7 @@ def test(): @@ -650,7 +650,7 @@ def test():
650 650
651 see module doc for more info 651 see module doc for more info
652 """ 652 """
653 - from oletools.common import ensure_stdout_handles_unicode 653 + from oletools.common.io_encoding import ensure_stdout_handles_unicode
654 ensure_stdout_handles_unicode() 654 ensure_stdout_handles_unicode()
655 log_helper.enable_logging(False, 'debug') 655 log_helper.enable_logging(False, 'debug')
656 if len(sys.argv) != 2: 656 if len(sys.argv) != 2:
tests/common/test_encoding_handler.py
@@ -131,7 +131,7 @@ class TestEncodingHandler(unittest.TestCase): @@ -131,7 +131,7 @@ class TestEncodingHandler(unittest.TestCase):
131 131
132 def run_read(filename): 132 def run_read(filename):
133 """This is called from test_uopen* tests as script. Reads text, compares""" 133 """This is called from test_uopen* tests as script. Reads text, compares"""
134 - from oletools.common import uopen 134 + from oletools.common.io_encoding import uopen
135 # open file 135 # open file
136 with uopen(filename, 'rt') as reader: 136 with uopen(filename, 'rt') as reader:
137 # a few tests 137 # a few tests
@@ -168,7 +168,7 @@ def run_read(filename): @@ -168,7 +168,7 @@ def run_read(filename):
168 168
169 def run_print(): 169 def run_print():
170 """This is called from test_read* tests as script. Prints & logs unicode""" 170 """This is called from test_read* tests as script. Prints & logs unicode"""
171 - from oletools.common import ensure_stdout_handles_unicode 171 + from oletools.common.io_encoding import ensure_stdout_handles_unicode
172 from oletools.common.log_helper import log_helper 172 from oletools.common.log_helper import log_helper
173 ensure_stdout_handles_unicode() 173 ensure_stdout_handles_unicode()
174 print(u'Check: \u2713') # print check mark 174 print(u'Check: \u2713') # print check mark