Skip to content

Commit

Permalink
Remove pillow as a dependency (#1891)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Aug 31, 2024
1 parent 196194a commit 91b5c27
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
additional_dependencies:
- tomli; python_version<'3.11'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.2"
rev: "v0.6.3"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
6 changes: 2 additions & 4 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ backports-tarfile==1.2.0
# via jaraco-context
beautifulsoup4==4.12.3
# via furo
certifi==2024.7.4
certifi==2024.8.30
# via requests
cffi==1.17.0
# via cryptography
Expand Down Expand Up @@ -106,8 +106,6 @@ parso==0.8.4
# via jedi
pexpect==4.9.0
# via ipython
pillow==10.4.0
# via jira (pyproject.toml)
pluggy==1.5.0
# via pytest
prompt-toolkit==3.0.47
Expand Down Expand Up @@ -232,5 +230,5 @@ wheel==0.44.0
# via jira (pyproject.toml)
yanc==0.3.3
# via jira (pyproject.toml)
zipp==3.20.0
zipp==3.20.1
# via importlib-metadata
7 changes: 5 additions & 2 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import os
import re
import sys
import tempfile
import time
import urllib
import warnings
Expand All @@ -40,7 +41,6 @@

import requests
from packaging.version import parse as parse_version
from PIL import Image
from requests import Response
from requests.auth import AuthBase
from requests.structures import CaseInsensitiveDict
Expand Down Expand Up @@ -4422,7 +4422,10 @@ def _get_mime_type(self, buff: bytes) -> str | None:
if self._magic is not None:
return self._magic.id_buffer(buff)
try:
return mimetypes.guess_type("f." + Image.open(buff).format)[0]
with tempfile.TemporaryFile() as f:
f.write(buff)
return mimetypes.guess_type(f.name)[0]
return mimetypes.guess_type(f.name)[0]
except (OSError, TypeError):
self.log.warning(
"Couldn't detect content type of avatar image"
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ keywords = ["api", "atlassian", "jira", "rest", "web"]
dependencies = [
"defusedxml",
"packaging",
"Pillow>=2.1.0",
"requests-oauthlib>=1.1.0",
"requests>=2.10.0",
"requests_toolbelt",
Expand Down

0 comments on commit 91b5c27

Please sign in to comment.