Do not create cache folder if no-cache option

This commit is contained in:
David-Wobrock committed 2019-02-24 18:18:45 +01:00
1 parent c3c1af113c
commit 36e7dfaa0e
3 files changed
+48 -42

No files matched your search

+21 -12
View File
@@ -1,12 +1,21 @@
from django_migration_linter.utils import split_migration_path
class Migration(object):
def __init__(self, abs_path):
self.abs_path = abs_path
self.app_name, self.name = split_migration_path(self.abs_path)
def __lt__(self, other):
if not isinstance(other, Migration):
return NotImplemented
return self.abs_path < other.abs_path
import hashlib
from django_migration_linter.utils import split_migration_path
class Migration(object):
def __init__(self, abs_path):
self.abs_path = abs_path
self.app_name, self.name = split_migration_path(self.abs_path)
def __lt__(self, other):
if not isinstance(other, Migration):
return NotImplemented
return self.abs_path < other.abs_path
def get_md5hash(self):
hash_md5 = hashlib.md5()
with open(self.abs_path, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()