original_docstring: Parse, check validity and format user supplied filters.
docstring: Parse, check validity and format user supplied filters.
docstring_tokens: Parse check validity and format user supplied filters .
code: def _formatFilters(self, filters):
          """Parse, check validity and format user supplied filters."""
          formatted_filters = []
          inequality_field = None
  
          for f in filters:
              filtr = {field.name: getattr(f, field.name) for field in f.all_fields()}
  
              try:
                  filtr["field"] = FIELDS[filtr["field"]]
                  filtr["operator"] = OPERATORS[filtr["operator"]]
              except KeyError:
                  raise endpoints.BadRequestException("Filter contains invalid field or operator.")
  
              # Every operation except "=" is an inequality
              if filtr["operator"] != "=":
                  # check if inequality operation has been used in previous filters
                  # disallow the filter if inequality was performed on a different field before
                  # track the field on which the inequality operation is performed
                  if inequality_field and inequality_field != filtr["field"]:
                      raise endpoints.BadRequestException("Inequality filter is allowed on only one field.")
                  else:
                      inequality_field = filtr["field"]
  
              formatted_filters.append(filtr)
          return (inequality_field, formatted_filters)
code_tokens: def _formatFilters ( self , filters ) : formatted_filters = [ ] inequality_field = None for f in filters : filtr = { field . name : getattr ( f , field . name ) for field in f . all_fields ( ) } try : filtr [ "field" ] = FIELDS [ filtr [ "field" ] ] filtr [ "operator" ] = OPERATORS [ filtr [ "operator" ] ] except KeyError : raise endpoints . BadRequestException ( "Filter contains invalid field or operator." ) if filtr [ "operator" ] != "=" : if inequality_field and inequality_field != filtr [ "field" ] : raise endpoints . BadRequestException ( "Inequality filter is allowed on only one field." ) else : inequality_field = filtr [ "field" ] formatted_filters . append ( filtr ) return ( inequality_field , formatted_filters )
short_docstring: Parse, check validity and format user supplied filters.
short_docstring_tokens: Parse check validity and format user supplied filters .
comment: """Parse, check validity and format user supplied filters."""$SEP$# Every operation except "=" is an inequality
  $SEP$# check if inequality operation has been used in previous filters
  $SEP$# disallow the filter if inequality was performed on a different field before
  $SEP$# track the field on which the inequality operation is performed
  