Skip to content

Commit

Permalink
Only import numpy when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Mar 11, 2021
1 parent 21da5b1 commit 346b4f2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/PIL/ImageFilter.py
Expand Up @@ -16,11 +16,6 @@
#
import functools

try:
import numpy
except ImportError: # pragma: no cover
numpy = None


class Filter:
pass
Expand Down Expand Up @@ -369,6 +364,11 @@ def __init__(self, size, table, channels=3, target_mode=None, **kwargs):
items = size[0] * size[1] * size[2]
wrong_size = False

try:
import numpy
except ImportError: # pragma: no cover
numpy = None

if numpy and isinstance(table, numpy.ndarray):
if copy_table:
table = table.copy()
Expand Down

0 comments on commit 346b4f2

Please sign in to comment.