Reference
privates.__about__
__author__ = 'ZeroIntensity'
module-attribute
__authors__ = (__author__)
module-attribute
__license__ = 'MIT'
module-attribute
__version__ = '0.2.0'
module-attribute
privates.exceptions
__all__ = ('PrivatesError', 'AccessError', 'FrameError')
module-attribute
AccessError
Bases: PrivatesError
Caller does not have access to the target.
FrameError
Bases: PrivatesError
Failed to get the frame.
PrivatesError
Bases: Exception
Base exception for all privates.py errors.
privates.modifiers
A = TypeVar('A', bound=Union[type, Callable])
module-attribute
P = ParamSpec('P')
module-attribute
T = TypeVar('T')
module-attribute
__all__ = ('supports_private', 'class_modifier', 'function_modifier', 'private', 'friend')
module-attribute
class_modifier(target: type[T]) -> type[T]
friend(tp: type[Any]) -> Callable[[A], A]
Allow the type or function to touch private attributes of the type.
function_modifier(func: Callable[P, T]) -> Callable[P, T]
Apply a private modifier to a function.
private(func_or_type: A) -> A
Apply class_modifier
if the object is a class, otherwise apply function_modifier
.
supports_private(tp: type[T]) -> type[T]
Enable checking of attributes on the target type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tp |
type[T]
|
Type to enable checking on. |
required |
privates._util
__all__ = ('get_back_frame')
module-attribute
get_back_frame() -> Frame
Get the last frame outside of privates.py