(
        self,
        path: PATH_TYPES,
        contents: Union[str, bytes, IO],
        encoding: Optional[str] = None,
        errors: Optional[str] = None,
    )
return
Write data to the provided path.  If **contents** is a string, the file will
        be opened and written in "r" + "utf-8" mode, if bytes are supplied it will be
        accessed using "rb" mode (i.e. binary write).
Write data to the provided path.  If **contents** is a string, the file will
        be opened and written in "r" + "utf-8" mode, if bytes are supplied it will be
        accessed using "rb" mode (i.e. binary write).
Write data to the provided path . If ** contents ** is a string the file will be opened and written in r + utf - 8 mode if bytes are supplied it will be accessed using rb mode ( i . e . binary write ) .
def write_file(
        self,
        path: PATH_TYPES,
        contents: Union[str, bytes, IO],
        encoding: Optional[str] = None,
        errors: Optional[str] = None,
    ) -> None:
        """Write data to the provided path.  If **contents** is a string, the file will
        be opened and written in "r" + "utf-8" mode, if bytes are supplied it will be
        accessed using "rb" mode (i.e. binary write)."""
        if encoding is not None:
            if errors is None:
                try:
                    errors = sys.getfilesystemencodeerrors()
                except AttributeError:
                    errors = "surrogateescape"
            if isinstance(contents, str):
                contents = contents.encode(encoding=encoding, errors=errors)
            elif isinstance(contents, bytes):
                contents = contents.decode(encoding=encoding, errors=errors)
        with self.connection() as conn:
            conn.put_object(self.default_container, str(path), contents)
        return
def write_file ( self , path : PATH_TYPES , contents : Union [ str , bytes , IO ] , encoding : Optional [ str ] = None , errors : Optional [ str ] = None , ) -> None : if encoding is not None : if errors is None : try : errors = sys . getfilesystemencodeerrors ( ) except AttributeError : errors = "surrogateescape" if isinstance ( contents , str ) : contents = contents . encode ( encoding = encoding , errors = errors ) elif isinstance ( contents , bytes ) : contents = contents . decode ( encoding = encoding , errors = errors ) with self . connection ( ) as conn : conn . put_object ( self . default_container , str ( path ) , contents ) return