Skip to content

Commit

Permalink
fix: Python 3.7 typing imports (#108)
Browse files Browse the repository at this point in the history
Per issue #57 , fix typing imports in Python 3.7.
  • Loading branch information
cragwolfe authored Dec 21, 2022
1 parent de4d0d4 commit 962c9dc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.4

* Python-3.7 compat

## 0.3.3

* Removes BasicConfig from logger configuration
Expand Down
2 changes: 1 addition & 1 deletion unstructured/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.3" # pragma: no cover
__version__ = "0.3.4" # pragma: no cover
8 changes: 7 additions & 1 deletion unstructured/partition/email.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import email
from typing import Dict, Final, IO, List, Optional
import sys
from typing import Dict, IO, List, Optional

if sys.version_info < (3, 8):
from typing_extensions import Final
else:
from typing import Final

from unstructured.cleaners.core import replace_mime_encodings
from unstructured.documents.elements import Element, Text
Expand Down
15 changes: 1 addition & 14 deletions unstructured/partition/pdf.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
import requests # type: ignore

import sys

if sys.version_info < (3, 8):
from typing_extensions import (
List,
Optional,
Union,
Tuple,
Mapping,
BinaryIO,
) # pragma: no cover
else:
from typing import List, Optional, Union, Tuple, Mapping, BinaryIO # pragma: no cover
from typing import BinaryIO, List, Optional, Union, Tuple, Mapping

from unstructured.documents.elements import Element

Expand Down
6 changes: 4 additions & 2 deletions unstructured/partition/text_type.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""partition.py implements logic for partitioning plain text documents into sections."""
import sys

from typing import List, Optional

if sys.version_info < (3, 8):
from typing_extensions import Final, List, Optional
from typing_extensions import Final
else:
from typing import Final, List, Optional
from typing import Final

from unstructured.cleaners.core import remove_punctuation
from unstructured.nlp.patterns import UNICODE_BULLETS_RE
Expand Down

0 comments on commit 962c9dc

Please sign in to comment.