From: Michael R. Crusoe <crusoe@debian.org>
Subject: Fix circular import loop
Forwarded: https://github.com/piskvorky/smart_open/pull/834

--- smart-open.orig/smart_open/doctools.py
+++ smart-open/smart_open/doctools.py
@@ -18,7 +18,6 @@
 import re
 
 from . import compression
-from . import transport
 
 PLACEHOLDER = '    smart_open/doctools.py magic goes here'
 
@@ -214,6 +213,8 @@
 
 
 def tweak_parse_uri_docstring(f):
+    from . import transport
+
     buf = io.StringIO()
     seen = set()
     schemes = []
--- smart-open.orig/smart_open/smart_open_lib.py
+++ smart-open/smart_open/smart_open_lib.py
@@ -33,7 +33,6 @@
 import smart_open.utils as so_utils
 
 from smart_open import doctools
-from smart_open import transport
 
 #
 # For backwards compatibility and keeping old unit tests happy.
@@ -60,6 +59,8 @@
 
 
 def parse_uri(uri_as_string):
+    from smart_open import transport
+
     """
     Parse the given URI from a string.
 
@@ -332,6 +333,8 @@
     :returns: The opened file
     :rtype: file
     """
+    from smart_open import transport
+   
     if not isinstance(uri, str):
         return None
 
@@ -374,6 +377,8 @@
     :returns: A named file object
     :rtype: file-like object with a .name attribute
     """
+    from smart_open import transport
+   
     if mode not in ('rb', 'rb+', 'wb', 'wb+', 'ab', 'ab+'):
         #
         # This should really be a ValueError, but for the sake of compatibility
