Skip to content

Commit

Permalink
Update main.py: Fix BLACK
Browse files Browse the repository at this point in the history
  • Loading branch information
NebularNerd authored May 6, 2024
1 parent b086324 commit 273d475
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions puremagic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,19 @@ def _identify_all(header: bytes, footer: bytes, ext=None) -> List[PureMagicWithC
import re

if not magic_row.offset == 0:
scan_bytes = header[0 : magic_row.offset] # We use .offset as amount of bytes from 0 to scan, saves opening whole file
# We use .offset as amount of bytes from 0 to scan, saves opening whole file
scan_bytes = header[0 : magic_row.offset]
else:
scan_bytes = header # We have no way to know where it will be in the file
# We have no way to know where it will be in the file
scan_bytes = header
if re.search(magic_row.byte_match, scan_bytes):
new_matches.add(
PureMagic(
byte_match=matched.byte_match + magic_row.byte_match,
offset=magic_row.offset,
extension=magic_row.extension,
mime_type=magic_row.mime_type,
name=magic_row.name.split("###REGEX### ")[1], # Strips ###REGEX### trigger from name
name=magic_row.name.split("###REGEX### ")[1],
)
)

Expand Down

0 comments on commit 273d475

Please sign in to comment.