Last updated:
0 purchases
PrivateCode 1.0.0
PrivateCode
PrivateCode is a Python library that provides a decorator to make a function, method, or class private.
This allows the function, method, or class to be accessed only from its own module and raises an exception if called from another module.
WARNING : Functions are not private at the memory level, but only at the call level.
Set up
Install
pip install PrivateCode
Upgrade
pip install --upgrade PrivateCode
Support
If you want to contact me for questions, bugs, or problems or other: [email protected]
Python version
PrivateCode was written for Python 3.
Decorator
Make a function, method, or class private
@private
Decorator Documentation
private
A decorator that makes a function, method, or class private, allowing it to be called only from its own module.
Arguments:
target: The function, method, or class to be decorated.
Returns:
The decorated function, method, or class.
Raises:
ValueError: If the decorated function, method, or class is called from a different module.
Example:
@private
def my_private_function():
# This function can only be called from its own module.
pass
class MyClass:
@private
def my_private_method(self):
# This method can only be called from its own module.
pass
@private
class MyPrivateClass:
# This class can only be instantiated from its own module.
pass
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.