<s> import os <EOL> import tempfile <EOL> from django . core . files . storage import FileSystemStorage <EOL> class TempFileSystemStorage ( FileSystemStorage ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> super ( TempFileSystemStorage , self ) . __init__ ( <EOL> location = tempfile . gettempdir ( ) , base_url = None ) <EOL> def url ( self , name ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> def get_available_name ( self , name , max_length = None ) : <EOL> """<STR_LIT>""" <EOL> tempdir = tempfile . mkdtemp ( dir = self . base_location ) <EOL> name = os . path . join ( <EOL> os . path . basename ( tempdir ) , <EOL> os . path . basename ( name ) , <EOL> ) <EOL> method = super ( TempFileSystemStorage , self ) . get_available_name <EOL> try : <EOL> return method ( name , max_length = max_length ) <EOL> except TypeError : <EOL> return method ( name ) </s>
