Return a hash of the file with the given name and optional content.
(self, name, content=None)
| 129 | self._patterns.setdefault(extension, []).append((compiled, template)) |
| 130 | |
| 131 | def file_hash(self, name, content=None): |
| 132 | """ |
| 133 | Return a hash of the file with the given name and optional content. |
| 134 | """ |
| 135 | if content is None: |
| 136 | return None |
| 137 | hasher = md5(usedforsecurity=False) |
| 138 | for chunk in content.chunks(): |
| 139 | hasher.update(chunk) |
| 140 | return hasher.hexdigest()[:12] |
| 141 | |
| 142 | def hashed_name(self, name, content=None, filename=None): |
| 143 | # `filename` is the name of file to hash if `content` isn't given. |
no test coverage detected