wotpy.utils.utils¶
Some utility functions for the WoT data type wrappers.
Functions
get_main_ipv4_address() | 
Returns the main IPv4 address of the current machine in a portable fashion. | 
handle_observer_finalization(observer) | 
Builds a decorator that yields the wrapped coroutine and calls on_completed or on_error on the observer when the coroutine ends or raises an error. | 
merge_args_kwargs_dict(args, kwargs) | 
Takes a tuple of args and dict of kwargs. | 
to_camel(val) | 
Takes a string and transforms it to camelCase. | 
to_json_obj(obj) | 
Recursive function that attempts to convert any given object to a JSON-serializable object. | 
to_snake(val) | 
Takes a string and transforms it to snake_case. | 
- 
wotpy.utils.utils.get_main_ipv4_address()¶ Returns the main IPv4 address of the current machine in a portable fashion. Attribution to the answer provided by Jamieson Becker on: https://stackoverflow.com/a/28950776
- 
wotpy.utils.utils.handle_observer_finalization(observer)¶ Builds a decorator that yields the wrapped coroutine and calls on_completed or on_error on the observer when the coroutine ends or raises an error.
- 
wotpy.utils.utils.merge_args_kwargs_dict(args, kwargs)¶ Takes a tuple of args and dict of kwargs. Returns a dict that is the result of merging the first item of args (if that item is a dict) and the kwargs dict.
- 
wotpy.utils.utils.to_camel(val)¶ Takes a string and transforms it to camelCase.
- 
wotpy.utils.utils.to_json_obj(obj)¶ Recursive function that attempts to convert any given object to a JSON-serializable object.
- 
wotpy.utils.utils.to_snake(val)¶ Takes a string and transforms it to snake_case.