[Private] class names should be CamelCase

This commit is contained in:
Hugo van Kemenade 2022-04-10 21:21:50 +03:00
parent d241e38120
commit 7fa92c67b1
6 changed files with 11 additions and 11 deletions

View File

@ -65,7 +65,7 @@ def test_deferred_error():
# Arrange # Arrange
# Act # Act
thing = _util.deferred_error(ValueError("Some error text")) thing = _util.DeferredError(ValueError("Some error text"))
# Assert # Assert
with pytest.raises(ValueError): with pytest.raises(ValueError):

View File

@ -50,7 +50,7 @@ except ImportError:
# Use __version__ instead. # Use __version__ instead.
from . import ImageMode, TiffTags, UnidentifiedImageError, __version__, _plugins from . import ImageMode, TiffTags, UnidentifiedImageError, __version__, _plugins
from ._binary import i32le, o32be, o32le from ._binary import i32le, o32be, o32le
from ._util import deferred_error, is_path from ._util import DeferredError, is_path
def __getattr__(name): def __getattr__(name):
@ -139,7 +139,7 @@ try:
) )
except ImportError as v: 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 # Explanations for ways that we know we might have an import error
if str(v).startswith("Module use of python"): if str(v).startswith("Module use of python"):
# The _imaging C module is present, but not compiled for # The _imaging C module is present, but not compiled for
@ -613,7 +613,7 @@ class Image:
# Instead of simply setting to None, we're setting up a # Instead of simply setting to None, we're setting up a
# deferred error that will better explain that the core image # deferred error that will better explain that the core image
# object is gone. # object is gone.
self.im = deferred_error(ValueError("Operation on closed image")) self.im = DeferredError(ValueError("Operation on closed image"))
def _copy(self): def _copy(self):
self.load() self.load()

View File

@ -26,9 +26,9 @@ try:
except ImportError as ex: except ImportError as ex:
# Allow error import for doc purposes, but error out when accessing # Allow error import for doc purposes, but error out when accessing
# anything in core. # anything in core.
from ._util import deferred_error from ._util import DeferredError
_imagingcms = deferred_error(ex) _imagingcms = DeferredError(ex)
DESCRIPTION = """ DESCRIPTION = """
pyCMS pyCMS

View File

@ -64,7 +64,7 @@ def __getattr__(name):
raise AttributeError(f"module '{__name__}' has no attribute '{name}'") raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
class _imagingft_not_installed: class _ImagingFtNotInstalled:
# module placeholder # module placeholder
def __getattr__(self, id): def __getattr__(self, id):
raise ImportError("The _imagingft C module is not installed") raise ImportError("The _imagingft C module is not installed")
@ -73,7 +73,7 @@ class _imagingft_not_installed:
try: try:
from . import _imagingft as core from . import _imagingft as core
except ImportError: except ImportError:
core = _imagingft_not_installed() core = _ImagingFtNotInstalled()
# FIXME: add support for pilfont2 format (see FontFile.py) # FIXME: add support for pilfont2 format (see FontFile.py)

View File

@ -39,9 +39,9 @@ try:
except ImportError as ex: except ImportError as ex:
# Allow error import for doc purposes, but error out when accessing # Allow error import for doc purposes, but error out when accessing
# anything in core. # 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__) logger = logging.getLogger(__name__)

View File

@ -11,7 +11,7 @@ def is_directory(f):
return is_path(f) and os.path.isdir(f) return is_path(f) and os.path.isdir(f)
class deferred_error: class DeferredError:
def __init__(self, ex): def __init__(self, ex):
self.ex = ex self.ex = ex