#NEWLINE# @ contextlib . contextmanager #NEWLINE# def temp_umask( umask ) : #NEWLINE# #INDENT# 'Context manager that temporarily sets the process umask.' #NEWLINE# oldmask = os . umask ( umask ) #NEWLINE# try : #NEWLINE# #INDENT# ( yield ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# os . umask ( oldmask )