From 30236682bfe220c79c4fdc0bea66f2f0e06f1fd4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 27 Mar 2014 14:58:02 +0000 Subject: Rename raw_output to text_output --- README.md | 4 ++-- jq.pyx | 4 ++-- tests/jq_tests.py | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 16bfe8b..d1d51e6 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,10 @@ If the value is unparsed JSON text, pass it in using the `text` argument: jq(".").transform(text="42") == 42 ``` -The `raw_output` argument can be used to serialise the output into a JSON string: +The `text_output` argument can be used to serialise the output into JSON text: ```python -jq(".").transform("42", raw_output=True) == '"42"' +jq(".").transform("42", text_output=True) == '"42"' ``` The `multiple_output` argument can be used for cases when multiple output elements are expected: diff --git a/jq.pyx b/jq.pyx index cec6e69..08f1e2b 100644 --- a/jq.pyx +++ b/jq.pyx @@ -112,7 +112,7 @@ cdef class _Program(object): def __dealloc__(self): jq_teardown(&self._jq) - def transform(self, value=_NO_VALUE, text=_NO_VALUE, raw_output=False, multiple_output=False): + def transform(self, value=_NO_VALUE, text=_NO_VALUE, text_output=False, multiple_output=False): if (value is _NO_VALUE) == (text is _NO_VALUE): raise ValueError("Either the value or text argument should be set") string_input = text if text is not _NO_VALUE else json.dumps(value) @@ -126,7 +126,7 @@ cdef class _Program(object): raise ValueError(self._error_store.error_string()) result_strings = map(lambda s: s.decode("utf8"), result_bytes) - if raw_output: + if text_output: return "\n".join(result_strings) elif multiple_output: return [json.loads(s) for s in result_strings] diff --git a/tests/jq_tests.py b/tests/jq_tests.py index daa7f85..c7ffd01 100644 --- a/tests/jq_tests.py +++ b/tests/jq_tests.py @@ -30,18 +30,18 @@ def input_string_is_parsed_to_json_if_raw_input_is_true(): @istest -def output_is_serialised_to_json_string_if_raw_output_is_true(): +def output_is_serialised_to_json_string_if_text_output_is_true(): assert_equal( '"42"', - jq(".").transform("42", raw_output=True) + jq(".").transform("42", text_output=True) ) @istest -def elements_in_raw_output_are_separated_by_newlines(): +def elements_in_text_output_are_separated_by_newlines(): assert_equal( "1\n2\n3", - jq(".[]").transform([1, 2, 3], raw_output=True) + jq(".[]").transform([1, 2, 3], text_output=True) ) -- cgit v1.2.3