def field_or_value(clause): """ For a clause that could be a field or value, create the right one and return it """ if hasattr(clause, 'getName') and clause.getName() != 'field': return Value(resolve(clause)) else: return Field(clause)
def field_or_value(clause): """ For a clause that could be a field or value, create the right one and return it """ if hasattr(clause, 'getName') and clause.getName() != 'field': return Value(resolve(clause)) else: return Field(clause)
def parse_expression(clause): """ For a clause that could be a field, value, or expression """ if isinstance(clause, Expression): return clause elif hasattr(clause, "getName") and clause.getName() != "field": if clause.getName() == "nested": return AttributeSelection.from_statement(clause) elif clause.getName() == "function": return SelectFunction.from_statement(clause) else: return Value(resolve(clause[0])) else: return Field(clause[0])
def field_or_value(clause): """ For a clause that could be a field or value, create the right one and return it """ if hasattr(clause, "getName") and clause.getName() != "field": if clause.getName() == "set_function": return SetFunction.from_clause(clause) else: return Value(resolve(clause)) else: return Field(clause)
def parse_expression(clause): """ For a clause that could be a field, value, or expression """ if isinstance(clause, Expression): return clause elif hasattr(clause, "getName") and clause.getName() != "field": if clause.getName() == "nested": return AttributeSelection.from_statement(clause) elif clause.getName() == "function": return SelectFunction.from_statement(clause) else: return Value(resolve(clause[0])) else: return Field(clause[0])
def field_or_value(clause): """ For a clause that could be a field or value, create the right one and return it """ if hasattr(clause, "getName") and clause.getName() != "field": if clause.getName() == "set_function": return SetFunction.from_clause(clause) else: return Value(resolve(clause)) else: return Field(clause)
def from_clause(cls, clause): """ Factory method """ fn_name = clause[0] if fn_name == 'size': return SizeConstraint.from_clause(clause) elif fn_name == 'attribute_type': return TypeConstraint.from_clause(clause) else: fn_name = clause[0] field = clause[1] if len(clause) > 2: return cls(fn_name, field, resolve(clause[2])) else: return cls(fn_name, field)
def from_clause(cls, clause): """ Factory method """ fn_name = clause[0] if fn_name == 'size': return SizeConstraint.from_clause(clause) elif fn_name == 'attribute_type': return TypeConstraint.from_clause(clause) else: fn_name = clause[0] field = clause[1] if len(clause) > 2: return cls(fn_name, field, resolve(clause[2])) else: return cls(fn_name, field)
def from_clause(cls, clause): """Factory method""" return cls(clause[0], resolve(clause[1]))
def from_clause(cls, clause): """ Factory method """ [field, vals] = clause return cls(field, resolve(vals))
def from_clause(cls, clause): """ Factory method """ [field, low, high] = clause return cls(field, resolve(low), resolve(high))
def from_clause(cls, clause): """ Factory method """ [_, field, operator, val] = clause return cls(field, operator, resolve(val))
def from_clause(cls, clause): """ Factory method """ return cls(clause[0], resolve(clause[1]))
def from_clause(cls, clause): """ Factory method """ [field, vals] = clause return cls(field, resolve(vals))
def from_clause(cls, clause): """ Factory method """ [field, low, high] = clause return cls(field, resolve(low), resolve(high))
def from_clause(cls, clause): """ Factory method """ [_, field, operator, val] = clause return cls(field, operator, resolve(val))