def _get_signature(self, entry):
if self._sha1_sigs:<EOL><INDENT>if not os.path.exists(entry.filename):<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>with open(entry.filename, "<STR_LIT:r>") as f:<EOL><INDENT>data = f.read()<EOL>return hashlib.sha1(data.encode("<STR_LIT:utf-8>")).digest()<EOL><DEDENT><DEDENT>except IOError as e:<EOL><INDENT>print("<STR_LIT>", e)<EOL>return None<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>return os.path.getmtime(entry.filename)<EOL><DEDENT>except OSError:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>
Return the signature of the file stored in entry.