def __save_shadow_copy(self):
if not self.shadow_directory:<EOL><INDENT>return<EOL><DEDENT>destination_filename = os.path.join(self.shadow_directory, self._routine_name) + '<STR_LIT>'<EOL>if os.path.realpath(destination_filename) == os.path.realpath(self._source_filename):<EOL><INDENT>raise LoaderException("<STR_LIT>".format(self._source_filename))<EOL><DEDENT>if os.path.exists(destination_filename):<EOL><INDENT>os.remove(destination_filename)<EOL><DEDENT>with open(destination_filename, '<STR_LIT>', encoding=self._routine_file_encoding) as handle:<EOL><INDENT>handle.write(self._routine_source_code)<EOL><DEDENT>mode = os.stat(self._source_filename)[stat.ST_MODE]<EOL>os.chmod(destination_filename, mode & ~stat.S_IWUSR & ~stat.S_IWGRP & ~stat.S_IWOTH)<EOL>
Saves a copy of the stored routine source with pure SQL (if shadow directory is set).