Skip to content

Commit 962c9dc

Browse files
authored
fix: Python 3.7 typing imports (#108)
Per issue #57 , fix typing imports in Python 3.7.
1 parent de4d0d4 commit 962c9dc

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.3.4
2+
3+
* Python-3.7 compat
4+
15
## 0.3.3
26

37
* Removes BasicConfig from logger configuration

unstructured/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.3" # pragma: no cover
1+
__version__ = "0.3.4" # pragma: no cover

unstructured/partition/email.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import email
2-
from typing import Dict, Final, IO, List, Optional
2+
import sys
3+
from typing import Dict, IO, List, Optional
4+
5+
if sys.version_info < (3, 8):
6+
from typing_extensions import Final
7+
else:
8+
from typing import Final
39

410
from unstructured.cleaners.core import replace_mime_encodings
511
from unstructured.documents.elements import Element, Text

unstructured/partition/pdf.py

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
import requests # type: ignore
2-
3-
import sys
4-
5-
if sys.version_info < (3, 8):
6-
from typing_extensions import (
7-
List,
8-
Optional,
9-
Union,
10-
Tuple,
11-
Mapping,
12-
BinaryIO,
13-
) # pragma: no cover
14-
else:
15-
from typing import List, Optional, Union, Tuple, Mapping, BinaryIO # pragma: no cover
2+
from typing import BinaryIO, List, Optional, Union, Tuple, Mapping
163

174
from unstructured.documents.elements import Element
185

unstructured/partition/text_type.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
"""partition.py implements logic for partitioning plain text documents into sections."""
22
import sys
33

4+
from typing import List, Optional
5+
46
if sys.version_info < (3, 8):
5-
from typing_extensions import Final, List, Optional
7+
from typing_extensions import Final
68
else:
7-
from typing import Final, List, Optional
9+
from typing import Final
810

911
from unstructured.cleaners.core import remove_punctuation
1012
from unstructured.nlp.patterns import UNICODE_BULLETS_RE

0 commit comments

Comments
 (0)