From 5f3b6250ab9b3a67e6746fec219c0e82bccba569 Mon Sep 17 00:00:00 2001 From: Chris Griffith Date: Thu, 8 Aug 2024 14:03:07 -0500 Subject: [PATCH] pre-commit fixes --- .pre-commit-config.yaml | 15 ++++++++++----- puremagic/magic_data.json | 34 ++++++++++++++-------------------- puremagic/main.py | 3 +-- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ceddd41..cddb731 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,28 +24,33 @@ repos: exclude: ^test/resources/ - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - exclude: ^test/resources/ + exclude: | + (?x)^( + ^test/resources/.+| + ^puremagic/magic_data.json + )$ - id: check-executables-have-shebangs - id: end-of-file-fixer exclude: ^test/resources/.+ + - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.6 + rev: v0.5.7 hooks: - id: ruff - repo: https://github.com/ambv/black - rev: 24.4.2 + rev: 24.8.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.10.0' + rev: 'v1.11.1' hooks: - id: mypy - repo: https://github.com/tox-dev/pyproject-fmt - rev: 2.1.3 + rev: 2.2.1 hooks: - id: pyproject-fmt diff --git a/puremagic/magic_data.json b/puremagic/magic_data.json index 6e044d4..3d8aa40 100644 --- a/puremagic/magic_data.json +++ b/puremagic/magic_data.json @@ -65,18 +65,12 @@ ["", 0, ".cl2", "", "Adaptec Easy CD/DVD Creator image file"], ["", 0, ".cl3", "", "Adaptec Easy CD/DVD Creator image file"], ["", 0, ".cl4", "", "Adaptec Easy CD/DVD Creator image file"], - ["", 0, ".vba", "", "Visual Basic Script"], - ["", 0, "README", "text/plain", "README File" ] - - + ["", 0, ".vba", "", "Visual Basic Script"], + ["", 0, "README", "text/plain", "README File"] ], "multi-part": { - "7b22": [ - ["227d", -2, ".json", "application/json", "JSON File"] - ], - "7b": [ - ["22", -1, ".json", "application/json", "JSON File"] - ], + "7b22": [["227d", -2, ".json", "application/json", "JSON File"]], + "7b": [["22", -1, ".json", "application/json", "JSON File"]], "464f524d": [ ["494c424d", 8, ".iff", "image/x-ilbm", "IFF Interleaved Bitmap Image"], ["38535658", 8, ".iff", "audio/x-8svx", "IFF 8-Bit Sampled Voice"], @@ -539,17 +533,17 @@ ["4e455235", -12, ".nrg", "", "Nero Disk Image (Version 2)"] ], "headers": [ - ["595556344d504547",0, ".y4m", "video/x-yuv4mpeg", "YUV4MPEG2 video file"], - ["3c68746d6c", 0, ".html", "text/html", "HTML File"], - ["424c5545", 0, ".bvr", "", "Blue Iris Video File"], - ["2d2d2d2d2d424547494e20504b4353372d2d2d2d2d", 0, ".p7b", "", "PKCS 7 Certificate File" ], - ["7b22", 0, ".json", "application/json", "JSON File"], - ["7b", 0, ".json", "application/json", "JSON File"], - ["50755454592d557365722d4b65792d46696c65", 0, ".ppk", "", "PuTTY User Key File"], + ["595556344d504547",0, ".y4m", "video/x-yuv4mpeg", "YUV4MPEG2 video file"], + ["3c68746d6c", 0, ".html", "text/html", "HTML File"], + ["424c5545", 0, ".bvr", "", "Blue Iris Video File"], + ["2d2d2d2d2d424547494e20504b4353372d2d2d2d2d", 0, ".p7b", "", "PKCS 7 Certificate File" ], + ["7b22", 0, ".json", "application/json", "JSON File"], + ["7b", 0, ".json", "application/json", "JSON File"], + ["50755454592d557365722d4b65792d46696c65", 0, ".ppk", "", "PuTTY User Key File"], ["2d2d2d2d20424547494e2053534832205055424c4943204b4559202d2d2d2d", 0, "", "", "SSH Public Key"], - ["2d2d2d2d424547494e", 0, "", "", "Key or Cert File"], - ["2d2d2d2d20424547494e", 0, "", "", "Key or Cert File"], - ["30313233343536373839", 0, ".puremagic_multi_footer", "text/ascii", "TESTFILE"], + ["2d2d2d2d424547494e", 0, "", "", "Key or Cert File"], + ["2d2d2d2d20424547494e", 0, "", "", "Key or Cert File"], + ["30313233343536373839", 0, ".puremagic_multi_footer", "text/ascii", "TESTFILE"], ["ff0a", 0, ".jxl", "image/jxl", "JPEG XL image (Raw stream)"], ["0000000c4a584c200d0a870a", 0, ".jxl", "image/jxl", "JPEG XL image (ISOBMFF container)"], ["3c3f786d6c", 0, ".xml", "application/xml", "XML Document"], diff --git a/puremagic/main.py b/puremagic/main.py index 6c30028..df4cae6 100644 --- a/puremagic/main.py +++ b/puremagic/main.py @@ -404,8 +404,7 @@ def command_line_entry(*args): print(f"\tExtension: {result.extension}") print(f"\tMime Type: {result.mime_type}") print(f"\tByte Match: {result.byte_match}") - print(f"\tOffset: {result.offset}") - print("") + print(f"\tOffset: {result.offset}\n") imghdr_bug_for_bug = { # Special cases where imghdr is probably incorrect.