This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, functools | |
def private(member): | |
@functools.wraps(member) | |
def wrapper(*function_args): | |
myself = member.__name__ | |
caller = sys._getframe(1).f_code.co_name | |
if (not caller in dir(function_args[0]) and not caller is myself): | |
raise Exception("%s called by %s is private"%(myself,caller)) | |
return member(*function_args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SwitchIOField(Field): | |
def __init__( | |
self, | |
input_field: Field, | |
output_field: Field, | |
*args, **kwargs | |
): | |
# -- setting up input field | |
self.input_field = input_field | |
self.validators = input_field.validators |