Skip to content

Commit

Permalink
Use an underscore to keep stubtest happy
Browse files Browse the repository at this point in the history
  • Loading branch information
DMRobertson committed Jan 6, 2023
1 parent 7f646a6 commit e75bd7c
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/EpsImagePlugin.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, ClassVar
from typing_extensions import Literal

from ._imaging import PixelAccess
from ._imaging import _PixelAccess
from .ImageFile import ImageFile
from .PyAccess import PyAccess

Expand All @@ -26,5 +26,5 @@ class EpsImageFile(ImageFile):
im: Any
mode: Any
tile: Any
def load(self, scale: int = ..., transparency: bool = ...) -> PixelAccess | PyAccess: ...
def load(self, scale: int = ..., transparency: bool = ...) -> _PixelAccess | PyAccess: ...
def load_seek(self, *args, **kwargs) -> None: ...
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/GbrImagePlugin.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Any, ClassVar
from typing_extensions import Literal

from ._imaging import PixelAccess
from ._imaging import _PixelAccess
from .ImageFile import ImageFile
from .PyAccess import PyAccess

class GbrImageFile(ImageFile):
format: ClassVar[Literal["GBR"]]
format_description: ClassVar[str]
im: Any
def load(self) -> PixelAccess | PyAccess: ...
def load(self) -> _PixelAccess | PyAccess: ...
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/IcnsImagePlugin.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, ClassVar
from typing_extensions import Literal

from ._imaging import PixelAccess
from ._imaging import _PixelAccess
from .ImageFile import ImageFile
from .PyAccess import PyAccess

Expand Down Expand Up @@ -34,4 +34,4 @@ class IcnsImageFile(ImageFile):
best_size: Any
im: Any
mode: Any
def load(self) -> PixelAccess | PyAccess: ...
def load(self) -> _PixelAccess | PyAccess: ...
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/IcoImagePlugin.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any, ClassVar
from typing_extensions import Literal

from ._imaging import PixelAccess
from ._imaging import _PixelAccess
from .ImageFile import ImageFile
from .PyAccess import PyAccess

Expand All @@ -24,5 +24,5 @@ class IcoImageFile(ImageFile):
def size(self, value) -> None: ...
im: Any
mode: Any
def load(self) -> PixelAccess | PyAccess: ...
def load(self) -> _PixelAccess | PyAccess: ...
def load_seek(self) -> None: ...
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/Image.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from ._imaging import (
FIXED as FIXED,
HUFFMAN_ONLY as HUFFMAN_ONLY,
RLE as RLE,
PixelAccess,
_PixelAccess,
)
from .ImageFilter import Filter
from .ImagePalette import ImagePalette
Expand Down Expand Up @@ -181,7 +181,7 @@ class Image:
def tobytes(self, encoder_name: str = ..., *args) -> bytes: ...
def tobitmap(self, name: str = ...) -> bytes: ...
def frombytes(self, data: bytes, decoder_name: str = ..., *args) -> None: ...
def load(self) -> PixelAccess | PyAccess: ...
def load(self) -> _PixelAccess | PyAccess: ...
def verify(self) -> None: ...
def convert(
self,
Expand Down
6 changes: 3 additions & 3 deletions stubs/Pillow/PIL/ImageFile.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from _typeshed import Incomplete, Self
from typing import Any, NoReturn

from ._imaging import PixelAccess
from ._imaging import _PixelAccess
from .Image import Image
from .PyAccess import PyAccess

Expand All @@ -25,12 +25,12 @@ class ImageFile(Image):
def verify(self) -> None: ...
map: Any
im: Any
def load(self) -> PixelAccess | PyAccess: ...
def load(self) -> _PixelAccess | PyAccess: ...
def load_prepare(self) -> None: ...
def load_end(self) -> None: ...

class StubImageFile(ImageFile):
def load(self) -> PixelAccess | PyAccess: ...
def load(self) -> _PixelAccess | PyAccess: ...

class Parser:
incremental: Any | None
Expand Down
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/WalImageFile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ from typing import ClassVar
from typing_extensions import Literal

from . import ImageFile
from ._imaging import PixelAccess
from ._imaging import _PixelAccess
from .PyAccess import PyAccess

class WalImageFile(ImageFile.ImageFile):
format: ClassVar[Literal["WAL"]]
format_description: ClassVar[str]
def load(self) -> PixelAccess | PyAccess: ...
def load(self) -> _PixelAccess | PyAccess: ...

def open(filename): ...

Expand Down
4 changes: 2 additions & 2 deletions stubs/Pillow/PIL/WmfImagePlugin.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sys
from typing import Any, ClassVar
from typing_extensions import Literal

from ._imaging import PixelAccess
from ._imaging import _PixelAccess
from .ImageFile import StubImageFile
from .PyAccess import PyAccess

Expand All @@ -17,4 +17,4 @@ if sys.platform == "win32":
class WmfStubImageFile(StubImageFile):
format: ClassVar[Literal["WMF"]]
format_description: ClassVar[str]
def load(self, dpi: Any | None = ...) -> PixelAccess | PyAccess: ...
def load(self, dpi: Any | None = ...) -> _PixelAccess | PyAccess: ...
4 changes: 3 additions & 1 deletion stubs/Pillow/PIL/_imaging.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ HUFFMAN_ONLY: Literal[2]
RLE: Literal[3]
FIXED: Literal[4]

class PixelAccess:
class _PixelAccess:
# As well as the C extension source, this is also documented at
# Pillow's docs/reference/PixelAccess.rst, e.g.
# https://github.com/python-pillow/Pillow/blob/main/docs/reference/PixelAccess.rst
# The name is prefixed here with an underscore as PixelAccess is not
# runtime-importable.
def __getattr__(self, item: str) -> Incomplete: ...

class _Path:
Expand Down

0 comments on commit e75bd7c

Please sign in to comment.