From 89d7566a30b131ae49d7bbb1b389a6eab2da168a Mon Sep 17 00:00:00 2001 From: Piper Merriam Date: Fri, 2 Sep 2016 16:33:58 -0600 Subject: [PATCH] mucking with formatters still --- web3/formatters.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/web3/formatters.py b/web3/formatters.py index 5ea8386..b7d0cc8 100644 --- a/web3/formatters.py +++ b/web3/formatters.py @@ -39,6 +39,10 @@ from web3.utils.functional import ( def apply_if_passes_test(test_fn): + """ + Constructs a decorator that will cause the underlying function to only be + applied to the given value if the `test_fn` returns true for that value. + """ def outer_fn(fn): @functools.wraps(fn) def inner(value): @@ -148,6 +152,11 @@ apply_if_array_of_dicts = apply_if_passes_test(compose( )) +filter_output_formatter = apply_if_not_null(apply_if_array_of_dicts( + log_array_formatter +)) + + @coerce_args_to_text @coerce_return_to_text def output_transaction_receipt_formatter(receipt): @@ -195,9 +204,6 @@ def output_block_formatter(block): } -filter_output_formatter = apply_if_array_of_dicts(log_array_formatter) - - @coerce_return_to_text def inputPostFormatter(post): """