Skip to content

Commit

Permalink
Version 1.25 (#84)
Browse files Browse the repository at this point in the history
- Changing to support Python 3.7 again
  • Loading branch information
cdgriffith authored Jun 19, 2024
1 parent 3cfe093 commit 096bc33
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
include:
- os: macos-latest
python-version: '3.13'
Expand All @@ -36,10 +36,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
pip install coveralls black==24.4.2 flake8 setuptools wheel twine
pip install coveralls flake8 setuptools wheel twine
- name: Verify Code with Black
if: ${{ matrix.python-version != '3.7' }}
run: |
pip install black==24.4.2
black --check puremagic test
- name: Lint with flake8
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

Version 1.25
------------

- Changing to support Python 3.7 again

Version 1.24
------------

Expand Down
8 changes: 5 additions & 3 deletions puremagic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from itertools import chain

__author__ = "Chris Griffith"
__version__ = "1.24"
__version__ = "1.25"
__all__ = [
"magic_file",
"magic_string",
Expand Down Expand Up @@ -433,8 +433,10 @@ def what(file: os.PathLike | str | None, h: bytes | None = None, imghdr_strict:
"""
if isinstance(h, str):
raise TypeError("h must be bytes, not str. Consider using bytes.fromhex(h)")
if h and imghdr_strict and (ext := imghdr_bug_for_bug.get(h)):
return ext
if h and imghdr_strict:
ext = imghdr_bug_for_bug.get(h)
if ext:
return ext
try:
ext = (from_string(h) if h else from_file(file or "")).lstrip(".")
except PureError:
Expand Down

0 comments on commit 096bc33

Please sign in to comment.