<s> """<STR_LIT>""" <EOL> import os <EOL> import tempfile <EOL> from airy . core . files . utils import FileProxyMixin <EOL> __all__ = ( '<STR_LIT>' , '<STR_LIT>' , ) <EOL> if os . name == '<STR_LIT>' : <EOL> class TemporaryFile ( FileProxyMixin ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , mode = '<STR_LIT>' , bufsize = - <NUM_LIT:1> , suffix = '<STR_LIT>' , prefix = '<STR_LIT>' , <EOL> dir = None ) : <EOL> fd , name = tempfile . mkstemp ( suffix = suffix , prefix = prefix , <EOL> dir = dir ) <EOL> self . name = name <EOL> self . file = os . fdopen ( fd , mode , bufsize ) <EOL> self . close_called = False <EOL> unlink = os . unlink <EOL> def close ( self ) : <EOL> if not self . close_called : <EOL> self . close_called = True <EOL> try : <EOL> self . file . close ( ) <EOL> except ( OSError , IOError ) : <EOL> pass <EOL> try : <EOL> self . unlink ( self . name ) <EOL> except ( OSError ) : <EOL> pass <EOL> def __del__ ( self ) : <EOL> self . close ( ) <EOL> NamedTemporaryFile = TemporaryFile <EOL> else : <EOL> NamedTemporaryFile = tempfile . NamedTemporaryFile <EOL> gettempdir = tempfile . gettempdir </s>
