Skip to content

Commit

Permalink
Update core.py stub with sentinel parameter types
Browse files Browse the repository at this point in the history
  • Loading branch information
rayzchen committed Jul 27, 2023
1 parent e482f46 commit 13b0a4b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyunity/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class SavesProjectID:
class GameObject(SavesProjectID):
"""
Class to create a GameObject, which is an object containing
:class:`Component`\s.
:class:`Component`\\s.
Parameters
----------
Expand Down
12 changes: 8 additions & 4 deletions stubs/pyunity/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,20 @@ class GameObject(SavesProjectID):
def __repr__(self) -> str: ...
def __str__(self) -> str: ...

class SavedAttribute(Generic[_T]): ...
class SavedAttribute(Generic[_T]):
class _Sentinel: ...
Sentinel: _Sentinel = ...


class HideInInspector(SavedAttribute[_T]):
type: Type[_T]
default: Union[_T, None]
name: Union[str, None]
def __init__(self, type_: Union[Type[_T], str], default: Union[_T, None] = ...) -> None: ...
def __init__(self, type_: Union[Type[_T], str], default: Union[_T, SavedAttribute._Sentinel, None] = ...) -> None: ...
def __set_name__(self, owner: Component, name: str) -> None: ...

class ShowInInspector(HideInInspector[_T]):
name: Union[str, None]
def __init__(self, type: Union[Type[_T], str], default: Union[_T, None] = ..., name: Union[str, None] = ...) -> None: ...
def __init__(self, type: Union[Type[_T], str], default: Union[_T, SavedAttribute._Sentinel, None] = ..., name: Union[str, None] = ...) -> None: ...
def __set_name__(self, owner: Component, name: str) -> None: ...

class _AddFields(IncludeInstanceMixin):
Expand All @@ -118,6 +120,8 @@ addFields: _AddFields
class ComponentType(ABCMeta):
@classmethod
def __prepare__(cls, name: str, bases: Tuple[type, ...], **kwds: Any) -> Mapping[str, object]: ... # type: ignore # positional-only parameters not in python < 3.8
def __getattr__(self, name: str) -> object: ...
def __setattr__(self, name: str, value: object) -> None: ...

class Component(SavesProjectID, metaclass=ComponentType):
_shown: Dict[str, HideInInspector] = ...
Expand Down

0 comments on commit 13b0a4b

Please sign in to comment.