|
GnuCash c935c2f+
|
Library for making python classes from a set of functions. More...
Go to the source code of this file.
Data Structures | |
| class | python.function_class.ClassFromFunctions |
Functions | |
| python.function_class.method_function_returns_instance (method_function, cls) | |
| python.function_class.method_function_returns_instance_list (method_function, cls) | |
| python.function_class.methods_return_instance_lists (cls, function_dict) | |
| python.function_class.default_arguments_decorator (function, *args, **kargs) | |
| Decorates a function to give it default, positional and keyword arguments. | |
| python.function_class.return_instance_if_value_has_it (value) | |
| python.function_class.process_list_convert_to_instance (value_list) | |
| python.function_class.process_dict_convert_to_instance (value_dict) | |
| python.function_class.extract_attributes_with_prefix (obj, prefix) | |
| python.function_class.methods_return_instance (cls, function_dict) | |
Variables | |
| str | python.function_class.INSTANCE_ARGUMENT = "instance" |
Library for making python classes from a set of functions.
Definition in file function_class.py.
| python.function_class.default_arguments_decorator | ( | function, | |
| * | args, | ||
| ** | kargs | ||
| ) |
Decorates a function to give it default, positional and keyword arguments.
mimics python behavior when setting defaults in function/method arguments. arguments can be set for positional or keyword arguments.
kargs_pos contains positions of the keyword arguments.
| A | TypeError will be raised if an argument is set as a positional and keyword argument at the same time. |
a keyword argument default will be overwritten by a positional argument at the actual function call
this function modifies the docstring of the wrapped function to reflect the defaults.
You can't use this decorator with @, because this function has more than one argument.
arguments:
| *args | optional positional defaults |
| kargs_pos | dict with keyword arguments as key and their position in the argument list as value |
| **kargs | optional keyword defaults |
Definition at line 262 of file function_class.py.
| python.function_class.extract_attributes_with_prefix | ( | obj, | |
| prefix | |||
| ) |
Generator that iterates through the attributes of an object and for any attribute that matches a prefix, this yields the attribute name, the attribute value, and the text that appears after the prefix in the name
Definition at line 380 of file function_class.py.
| python.function_class.method_function_returns_instance | ( | method_function, | |
| cls | |||
| ) |
A function decorator that is used to decorate method functions that return instance data, to return instances instead. You can't use this decorator with @, because this function has a second argument.
Definition at line 233 of file function_class.py.
| python.function_class.method_function_returns_instance_list | ( | method_function, | |
| cls | |||
| ) |
Definition at line 250 of file function_class.py.
| python.function_class.methods_return_instance | ( | cls, | |
| function_dict | |||
| ) |
Iterates through a dictionary of function name strings and instance names and sets the function to return the associated instance
Definition at line 391 of file function_class.py.
| python.function_class.methods_return_instance_lists | ( | cls, | |
| function_dict | |||
| ) |
Definition at line 256 of file function_class.py.
| python.function_class.process_dict_convert_to_instance | ( | value_dict | ) |
Return a dict built from value_dict, where if a value is in an instance of ClassFromFunctions, we put value.instance in the dict instead. Things that are not instances of ClassFromFunctions are returned to the new dict unchanged.
Definition at line 368 of file function_class.py.
| python.function_class.process_list_convert_to_instance | ( | value_list | ) |
Return a list built from value_list, where if a value is in an instance of ClassFromFunctions, we put value.instance in the list instead. Things that are not instances of ClassFromFunctions are returned to the new list unchanged.
Definition at line 358 of file function_class.py.
| python.function_class.return_instance_if_value_has_it | ( | value | ) |
Return value.instance if value is an instance of ClassFromFunctions, else return value
Definition at line 349 of file function_class.py.
| str python.function_class.INSTANCE_ARGUMENT = "instance" |
Definition at line 29 of file function_class.py.