From 3e5d9ca4d79f859b43f5960d4bb65f540f9445e8 Mon Sep 17 00:00:00 2001 From: dmitriy Date: Sun, 10 Mar 2019 20:28:04 +0300 Subject: [PATCH] treat tuples as lists --- jmespath/visitor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jmespath/visitor.py b/jmespath/visitor.py index 2c783e5e..31f16d8e 100644 --- a/jmespath/visitor.py +++ b/jmespath/visitor.py @@ -202,7 +202,7 @@ def visit_identity(self, node, value): def visit_index(self, node, value): # Even though we can index strings, we don't # want to support that. - if not isinstance(value, list): + if not isinstance(value, (list, tuple)): return None try: return value[node['value']] @@ -216,7 +216,7 @@ def visit_index_expression(self, node, value): return result def visit_slice(self, node, value): - if not isinstance(value, list): + if not isinstance(value, (list, tuple)): return None s = slice(*node['children']) return value[s]