1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515
16- from __future__ import absolute_import
17- from jsonpath_rw import parse
16+ from jsonpath_ng import parse
1817import re
1918
2019# A simple expression is defined as a series of letters [a-zA-Z], numbers [0-9],
@@ -65,8 +64,7 @@ def _get_value_complex(doc, key):
6564 """
6665 Extracts a value from a nested set of dictionaries 'doc' based on
6766 a 'key' string.
68- The key is expected to be a jsonpath_rw expression:
69- http://jsonpath-rw.readthedocs.io/en/stable/
67+ The key is expected to be a jsonpath_ng expression:
7068
7169 Returns the extracted value from the key specified (if found)
7270 Returns None if the key can not be found
@@ -85,10 +83,10 @@ def get_value(doc, key):
8583 raise ValueError (
8684 "doc is not an instance of dict: type={} value='{}'" .format (type (doc ), doc )
8785 )
88- # jsonpath_rw can be very slow when processing expressions.
86+ # jsonpath_ng can be very slow when processing expressions.
8987 # In the case of a simple expression we've created a "fast path" that avoids
90- # the complexity introduced by running jsonpath_rw code.
91- # For more complex expressions we fall back to using jsonpath_rw .
88+ # the complexity introduced by running jsonpath_ng code.
89+ # For more complex expressions we fall back to using jsonpath_ng .
9290 # This provides flexibility and increases performance in the base case.
9391 match = SIMPLE_EXPRESSION_REGEX_CMPL .match (key )
9492 if match :
0 commit comments