Skip to content

Commit

Permalink
Merge pull request nolze#63 from nolze/fix/use-absolute-imports
Browse files Browse the repository at this point in the history
Use absolute imports
  • Loading branch information
nolze committed Jul 4, 2021
2 parents fdd2a0c + 270a447 commit 7737e03
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
12 changes: 6 additions & 6 deletions msoffcrypto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import zipfile
import pkg_resources

from . import exceptions
from msoffcrypto import exceptions

__version__ = pkg_resources.get_distribution("msoffcrypto-tool").version

Expand Down Expand Up @@ -46,7 +46,7 @@ def OfficeFile(file):
if olefile.isOleFile(file):
ole = olefile.OleFileIO(file)
elif zipfile.is_zipfile(file): # Heuristic
from .format.ooxml import OOXMLFile
from msoffcrypto.format.ooxml import OOXMLFile

return OOXMLFile(file)
else:
Expand All @@ -55,25 +55,25 @@ def OfficeFile(file):
# TODO: Make format specifiable by option in case of obstruction
# Try this first; see https://github.com/nolze/msoffcrypto-tool/issues/17
if ole.exists("EncryptionInfo"):
from .format.ooxml import OOXMLFile
from msoffcrypto.format.ooxml import OOXMLFile

return OOXMLFile(file)
# MS-DOC: The WordDocument stream MUST be present in the file.
# https://msdn.microsoft.com/en-us/library/dd926131(v=office.12).aspx
elif ole.exists("wordDocument"):
from .format.doc97 import Doc97File
from msoffcrypto.format.doc97 import Doc97File

return Doc97File(file)
# MS-XLS: A file MUST contain exactly one Workbook Stream, ...
# https://msdn.microsoft.com/en-us/library/dd911009(v=office.12).aspx
elif ole.exists("Workbook"):
from .format.xls97 import Xls97File
from msoffcrypto.format.xls97 import Xls97File

return Xls97File(file)
# MS-PPT: A required stream whose name MUST be "PowerPoint Document".
# https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-ppt/1fc22d56-28f9-4818-bd45-67c2bf721ccf
elif ole.exists("PowerPoint Document"):
from .format.ppt97 import Ppt97File
from msoffcrypto.format.ppt97 import Ppt97File

return Ppt97File(file)
else:
Expand Down
6 changes: 3 additions & 3 deletions msoffcrypto/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import olefile

from . import __version__
from . import OfficeFile
from . import exceptions
from msoffcrypto import __version__
from msoffcrypto import OfficeFile
from msoffcrypto import exceptions

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
Expand Down
10 changes: 5 additions & 5 deletions msoffcrypto/format/doc97.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import olefile

from .. import exceptions
from . import base
from .common import _parse_encryptionheader, _parse_encryptionverifier
from ..method.rc4 import DocumentRC4
from ..method.rc4_cryptoapi import DocumentRC4CryptoAPI
from msoffcrypto import exceptions
from msoffcrypto.format import base
from msoffcrypto.format.common import _parse_encryptionheader, _parse_encryptionverifier
from msoffcrypto.method.rc4 import DocumentRC4
from msoffcrypto.method.rc4_cryptoapi import DocumentRC4CryptoAPI

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
Expand Down
10 changes: 5 additions & 5 deletions msoffcrypto/format/ooxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import olefile

from .. import exceptions
from . import base
from .common import _parse_encryptionheader, _parse_encryptionverifier
from ..method.ecma376_agile import ECMA376Agile
from ..method.ecma376_standard import ECMA376Standard
from msoffcrypto import exceptions
from msoffcrypto.format import base
from msoffcrypto.format.common import _parse_encryptionheader, _parse_encryptionverifier
from msoffcrypto.method.ecma376_agile import ECMA376Agile
from msoffcrypto.method.ecma376_standard import ECMA376Standard

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
Expand Down
8 changes: 4 additions & 4 deletions msoffcrypto/format/ppt97.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import olefile

from .. import exceptions
from . import base
from .common import _parse_encryptionheader, _parse_encryptionverifier
from ..method.rc4_cryptoapi import DocumentRC4CryptoAPI
from msoffcrypto import exceptions
from msoffcrypto.format import base
from msoffcrypto.format.common import _parse_encryptionheader, _parse_encryptionverifier
from msoffcrypto.method.rc4_cryptoapi import DocumentRC4CryptoAPI

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
Expand Down
10 changes: 5 additions & 5 deletions msoffcrypto/format/xls97.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import olefile

from .. import exceptions
from . import base
from .common import _parse_encryptionheader, _parse_encryptionverifier
from ..method.rc4 import DocumentRC4
from ..method.rc4_cryptoapi import DocumentRC4CryptoAPI
from msoffcrypto import exceptions
from msoffcrypto.format import base
from msoffcrypto.format.common import _parse_encryptionheader, _parse_encryptionverifier
from msoffcrypto.method.rc4 import DocumentRC4
from msoffcrypto.method.rc4_cryptoapi import DocumentRC4CryptoAPI

logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
Expand Down

0 comments on commit 7737e03

Please sign in to comment.