Merge pull request #804 from nucleogenic/fix-python-3.7-compat

Fix Python 3.7 compatibility (#800)
This commit is contained in:
Daniel Markstedt 2022-08-23 22:14:25 -07:00 committed by GitHub
commit 72c9f1c6ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -79,7 +79,8 @@ def extract_archive(file_path, **kwargs):
extracted_members = []
for line in lines[1:-1]:
if line_matches := match(unar_file_extracted, line):
line_matches = match(unar_file_extracted, line)
if line_matches:
matches = line_matches.groupdict()
member = {
"name": str(pathlib.PurePath(matches["path"]).name),
@ -90,7 +91,11 @@ def extract_archive(file_path, **kwargs):
"absolute_path": str(pathlib.PurePath(tmp_dir).joinpath(matches["path"])),
}
member_types = matches.get("types", "").removeprefix(", ").split(", ")
member_types = matches.get("types", "")
if member_types.startswith(", "):
member_types = member_types[2:].split(", ")
else:
member_types = member_types.split(", ")
if "dir" in member_types:
member["is_dir"] = True