Skip to content

Commit

Permalink
Change @typing.overload -> @overload for Python stubs
Browse files Browse the repository at this point in the history
This fixes a problem with pytype where it checks hardcoded decorators
and only includes `@overload` and not `@typing.overload`.
  • Loading branch information
JesseFarebro committed Apr 19, 2023
1 parent 6b784d2 commit 259f249
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions src/python/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import typing
from typing import List, Optional
from typing import List, Optional, overload

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -84,11 +83,11 @@ class Action:
class ALEState:
def __eq__(self, other: ALEState) -> bool: ...
def __getstate__(self) -> tuple: ...
@typing.overload
@overload
def __init__(self) -> None: ...
@typing.overload
@overload
def __init__(self, state: ALEState, serialized: str) -> None: ...
@typing.overload
@overload
def __init__(self, serialized: str) -> None: ...
def __setstate__(self, state: tuple) -> None: ...
def equals(self, other: ALEState) -> bool: ...
Expand All @@ -102,9 +101,9 @@ class ALEState:

class ALEInterface:
def __init__(self) -> None: ...
@typing.overload
@overload
def act(self, action: Action) -> int: ...
@typing.overload
@overload
def act(self, action: int) -> int: ...
def cloneState(self, *, include_rng: bool = False) -> ALEState: ...
def cloneSystemState(self) -> ALEState: ...
Expand All @@ -119,35 +118,35 @@ class ALEInterface:
def getInt(self, key: str) -> int: ...
def getLegalActionSet(self) -> List[Action]: ...
def getMinimalActionSet(self) -> List[Action]: ...
@typing.overload
@overload
def getRAM(self) -> npt.NDArray[np.uint8]: ...
@typing.overload
@overload
def getRAM(self, arg0: npt.NDArray[np.uint8]) -> None: ...
def getRAMSize(self) -> int: ...
@typing.overload
@overload
def getScreen(self) -> npt.NDArray[np.uint8]: ...
@typing.overload
@overload
def getScreen(self, array: npt.NDArray[np.uint8]) -> None: ...
def getScreenDims(self) -> tuple: ...
@typing.overload
@overload
def getScreenGrayscale(self) -> npt.NDArray[np.uint8]: ...
@typing.overload
@overload
def getScreenGrayscale(self, array: npt.NDArray[np.uint8]) -> None: ...
@typing.overload
@overload
def getScreenRGB(self) -> npt.NDArray[np.uint8]: ...
@typing.overload
@overload
def getScreenRGB(self, array: npt.NDArray[np.uint8]) -> None: ...
def getString(self, key: str) -> str: ...
@staticmethod
@typing.overload
@overload
def isSupportedROM(rom: os.PathLike) -> Optional[str]: ...
@staticmethod
@typing.overload
@overload
def isSupportedROM(rom: str) -> Optional[str]: ...
def lives(self) -> int: ...
@typing.overload
@overload
def loadROM(self, rom: os.PathLike) -> None: ...
@typing.overload
@overload
def loadROM(self, rom: str) -> None: ...
def reset_game(self) -> None: ...
def restoreState(self, state: ALEState) -> None: ...
Expand Down

0 comments on commit 259f249

Please sign in to comment.