class_docstr: The external storage class implemented by smart_open.
  (https://github.com/RaRe-Technologies/smart_open)
  
  Smart open supports multiple backend with the same APIs.
  
  To use this implementation, you should pre-create the given uri.
  For example, if your uri is a local file path, you should pre-create
  the directory.
  
  Args:
      uri: Storage URI used for smart open.
      prefix: Prefix of objects that are stored.
      override_transport_params: Overriding the default value of
          transport_params for smart-open library.
  
  Raises:
      ModuleNotFoundError: If it fails to setup.
          For example, if smart open library
          is not downloaded, this will fail.
class_docstr_tok: ["The","external","storage","class","implemented","by","smart_open",".","(","https",":","\/\/github.com\/RaRe-Technologies\/smart_open",")","Smart","open","supports","multiple","backend","with","the","same","APIs",".","To","use","this","implementation",",","you","should","pre-create","the","given","uri",".","For","example",",","if","your","uri","is","a","local","file","path",",","you","should","pre-create","the","directory",".","Args",":","uri",":","Storage","URI","used","for","smart","open",".","prefix",":","Prefix","of","objects","that","are","stored",".","override_transport_params",":","Overriding","the","default","value","of","transport_params","for","smart-open","library",".","Raises",":","ModuleNotFoundError",":","If","it","fails","to","setup",".","For","example",",","if","smart","open","library","is","not","downloaded",",","this","will","fail","."]
code: def __init__(
      self,
      uri: str or list,
      prefix: str = DEFAULT_OBJECT_PREFIX,
      override_transport_params: dict = None,
      buffer_size=1024
      * 1024,  # For remote spilling, at least 1MB is recommended.
  ):
      try:
          from smart_open import open  # noqa
      except ModuleNotFoundError as e:
          raise ModuleNotFoundError(
              "Smart open is chosen to be a object spilling "
              "external storage, but smart_open and boto3 "
              f"is not downloaded. Original error: {e}"
          )
  
      # Validation
      assert (
          uri is not None
      ), "uri should be provided to use object spilling."
      if isinstance(uri, str):
          uri = [uri]
      assert isinstance(
          uri, list
      ), "uri must be a single string or list of strings."
      assert isinstance(
          buffer_size, int
      ), "buffer_size must be an integer."
  
      uri_is_s3 = [u.startswith("s3://") for u in uri]
      self.is_for_s3 = all(uri_is_s3)
      if not self.is_for_s3:
          assert not any(
              uri_is_s3
          ), "all uri's must be s3 or none can be s3."
          self._uris = uri
      else:
          self._uris = [u.strip("/") for u in uri]
      assert len(self._uris) == len(uri)
  
      self._current_uri_index = random.randrange(0, len(self._uris))
      self.prefix = prefix
      self.override_transport_params = override_transport_params or {}
  
      if self.is_for_s3:
          import boto3  # noqa
  
          # Setup boto3. It is essential because if we don't create boto
          # session, smart_open will create a new session for every
          # open call.
          self.s3 = boto3.resource(service_name="s3")
  
          # smart_open always seek to 0 if we don't set this argument.
          # This will lead us to call a Object.get when it is not necessary,
          # so defer seek and call seek before reading objects instead.
          self.transport_params = {
              "defer_seek": True,
              "resource": self.s3,
              "buffer_size": buffer_size,
          }
      else:
          self.transport_params = {}
  
      self.transport_params.update(self.override_transport_params)
  
imports: import abc
  import logging
  import os
  import random
  import shutil
  import time
  import urllib
  import uuid
  from collections import namedtuple
  from typing import IO, List, Optional, Tuple
  import ray
  from ray._private.ray_constants import DEFAULT_OBJECT_PREFIX
  from ray._raylet import ObjectRef
label_desc: Use image node_id 1 to create a new ExternalStorageSmartOpenImpl object from inherited base classes: ExternalStorage with example: obj = ExternalStorageSmartOpenImpl(uri, prefix, override_transport_params, buffer_size)