Beispiel #1
0
def _open(file_name, mode):
  import os
  file_name = os.path.expanduser(file_name)
  from libtbx.str_utils import show_string
  from libtbx import smart_open
  try: return smart_open.file(file_name=file_name, mode=mode)
  except IOError, e:
    raise IOError("Cannot open pickle file %s (%s)" % (
      show_string(file_name), str(e)))
Beispiel #2
0
def _open(file_name, mode):
    import os
    file_name = os.path.expanduser(file_name)
    from libtbx.str_utils import show_string
    from libtbx import smart_open
    try:
        return smart_open.file(file_name=file_name, mode=mode)
    except IOError, e:
        raise IOError("Cannot open pickle file %s (%s)" %
                      (show_string(file_name), str(e)))
Beispiel #3
0
def _open(file_name, mode):
  """
  Wraps libtbx.smart_open.

  Parameters
  ----------
  file_name : str
  mode : str

  Returns
  -------
  file
  """
  file_name = os.path.expanduser(file_name)
  try: return smart_open.file(file_name=file_name, mode=mode)
  except IOError as e:
    raise IOError("Cannot open pickle file %s (%s)" % (
      show_string(file_name), str(e)))
Beispiel #4
0
def _open(file_name, mode):
  """
  Wraps libtbx.smart_open.

  Parameters
  ----------
  file_name : str
  mode : str

  Returns
  -------
  file
  """
  import os
  file_name = os.path.expanduser(file_name)
  from libtbx.str_utils import show_string
  from libtbx import smart_open
  try: return smart_open.file(file_name=file_name, mode=mode)
  except IOError as e:
    raise IOError("Cannot open pickle file %s (%s)" % (
      show_string(file_name), str(e)))