Skip to content

Commit

Permalink
[Private] class names should be CamelCase
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Apr 10, 2022
1 parent d241e38 commit 7fa92c6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def test_deferred_error():
# Arrange

# Act
thing = _util.deferred_error(ValueError("Some error text"))
thing = _util.DeferredError(ValueError("Some error text"))

# Assert
with pytest.raises(ValueError):
Expand Down
6 changes: 3 additions & 3 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# Use __version__ instead.
from . import ImageMode, TiffTags, UnidentifiedImageError, __version__, _plugins
from ._binary import i32le, o32be, o32le
from ._util import deferred_error, is_path
from ._util import DeferredError, is_path


def __getattr__(name):
Expand Down Expand Up @@ -139,7 +139,7 @@ class DecompressionBombError(Exception):
)

except ImportError as v:
core = deferred_error(ImportError("The _imaging C module is not installed."))
core = DeferredError(ImportError("The _imaging C module is not installed."))
# Explanations for ways that we know we might have an import error
if str(v).startswith("Module use of python"):
# The _imaging C module is present, but not compiled for
Expand Down Expand Up @@ -613,7 +613,7 @@ def close(self):
# Instead of simply setting to None, we're setting up a
# deferred error that will better explain that the core image
# object is gone.
self.im = deferred_error(ValueError("Operation on closed image"))
self.im = DeferredError(ValueError("Operation on closed image"))

def _copy(self):
self.load()
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/ImageCms.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
except ImportError as ex:
# Allow error import for doc purposes, but error out when accessing
# anything in core.
from ._util import deferred_error
from ._util import DeferredError

_imagingcms = deferred_error(ex)
_imagingcms = DeferredError(ex)

DESCRIPTION = """
pyCMS
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/ImageFont.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __getattr__(name):
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")


class _imagingft_not_installed:
class _ImagingFtNotInstalled:
# module placeholder
def __getattr__(self, id):
raise ImportError("The _imagingft C module is not installed")
Expand All @@ -73,7 +73,7 @@ def __getattr__(self, id):
try:
from . import _imagingft as core
except ImportError:
core = _imagingft_not_installed()
core = _ImagingFtNotInstalled()


# FIXME: add support for pilfont2 format (see FontFile.py)
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/PyAccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
except ImportError as ex:
# Allow error import for doc purposes, but error out when accessing
# anything in core.
from ._util import deferred_error
from ._util import DeferredError

FFI = ffi = deferred_error(ex)
FFI = ffi = DeferredError(ex)

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/PIL/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def is_directory(f):
return is_path(f) and os.path.isdir(f)


class deferred_error:
class DeferredError:
def __init__(self, ex):
self.ex = ex

Expand Down

0 comments on commit 7fa92c6

Please sign in to comment.