vine.funtools¶
-
vine.funtools.
transform
(filter_, callback, *filter_args, **filter_kwargs)[source]¶ Filter final argument to a promise.
E.g. to coerce callback argument to
int
:transform(int, callback)
or a more complex example extracting something from a dict and coercing the value to
float
:def filter_key_value(key, filter_, mapping): return filter_(mapping[key]) def get_page_expires(self, url, callback=None): return self.request( 'GET', url, callback=transform(get_key, callback, 'PageExpireValue', int), )