Features: ;

Fixes: 1) Fix indentation issue in handling zip file stream for proper file processing;

Extra: ;
This commit is contained in:
Egor Pavlovich Gorbunov 2025-05-16 02:05:02 +03:00
parent 97b877c943
commit ec4fa17d72

View file

@ -214,18 +214,18 @@ class Command(BaseCommand):
filepath = os.path.join(self.data_dir, filename) filepath = os.path.join(self.data_dir, filename)
with zipfile.ZipFile(str(filepath)).open(name + ".txt", "r") as f: with zipfile.ZipFile(str(filepath)).open(name + ".txt", "r") as f:
zip_member = f zip_member = f
file_obj = io.TextIOWrapper(zip_member, encoding="utf-8") file_obj = io.TextIOWrapper(zip_member, encoding="utf-8")
for row in file_obj: for row in file_obj:
if not row.startswith("#"): if not row.startswith("#"):
yield dict( yield dict(
list( list(
zip( zip(
settings.files[filekey]["fields"], settings.files[filekey]["fields"],
row.rstrip("\n").split("\t"), row.rstrip("\n").split("\t"),
)
) )
) )
)
else: else:
with open(os.path.join(self.data_dir, filename), encoding="utf-8") as f: with open(os.path.join(self.data_dir, filename), encoding="utf-8") as f:
file_obj = f file_obj = f