本文整理匯總了Python中jmespath.ast.identity方法的典型用法代碼示例。如果您正苦於以下問題:Python ast.identity方法的具體用法?Python ast.identity怎麽用?Python ast.identity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jmespath.ast
的用法示例。
在下文中一共展示了ast.identity方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _token_nud_lbracket
# 需要導入模塊: from jmespath import ast [as 別名]
# 或者: from jmespath.ast import identity [as 別名]
def _token_nud_lbracket(self, token):
if self._current_token() in ['number', 'colon']:
right = self._parse_index_expression()
# We could optimize this and remove the identity() node.
# We don't really need an index_expression node, we can
# just use emit an index node here if we're not dealing
# with a slice.
return self._project_if_slice(ast.identity(), right)
elif self._current_token() == 'star' and \
self._lookahead(1) == 'rbracket':
self._advance()
self._advance()
right = self._parse_projection_rhs(self.BINDING_POWER['star'])
return ast.projection(ast.identity(), right)
else:
return self._parse_multi_select_list()
示例2: _token_nud_star
# 需要導入模塊: from jmespath import ast [as 別名]
# 或者: from jmespath.ast import identity [as 別名]
def _token_nud_star(self, token):
left = ast.identity()
if self._current_token() == 'rbracket':
right = ast.identity()
else:
right = self._parse_projection_rhs(self.BINDING_POWER['star'])
return ast.value_projection(left, right)
示例3: _token_nud_filter
# 需要導入模塊: from jmespath import ast [as 別名]
# 或者: from jmespath.ast import identity [as 別名]
def _token_nud_filter(self, token):
return self._token_led_filter(ast.identity())
示例4: _token_nud_flatten
# 需要導入模塊: from jmespath import ast [as 別名]
# 或者: from jmespath.ast import identity [as 別名]
def _token_nud_flatten(self, token):
left = ast.flatten(ast.identity())
right = self._parse_projection_rhs(
self.BINDING_POWER['flatten'])
return ast.projection(left, right)
示例5: _token_led_filter
# 需要導入模塊: from jmespath import ast [as 別名]
# 或者: from jmespath.ast import identity [as 別名]
def _token_led_filter(self, left):
# Filters are projections.
condition = self._expression(0)
self._match('rbracket')
if self._current_token() == 'flatten':
right = ast.identity()
else:
right = self._parse_projection_rhs(self.BINDING_POWER['filter'])
return ast.filter_projection(left, right, condition)