Coverage for dataflake/fakeldap/queryparser.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2012 Jens Vagelpohl and Contributors. All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ##############################################################################
# From http://www.ietf.org/rfc/rfc2254.txt, Section 4 # with references to http://www.ietf.org/rfc/rfc2251.txt # # filter = "(" filtercomp ")" # filtercomp = and / or / not / item # and = "&" filterlist # or = "|" filterlist # not = "!" filter # filterlist = 1*filter # item = simple / present / substring / extensible # simple = attr filtertype value # filtertype = equal / approx / greater / less # equal = "=" # approx = "~=" # greater = ">=" # less = "<=" # extensible = attr [":dn"] [":" matchingrule] ":=" value # / [":dn"] ":" matchingrule ":=" value # present = attr "=*" # substring = attr "=" [initial] any [final] # initial = value # any = "*" *(value "*") # final = value # attr = AttributeDescription from Section 4.1.5 of RFC 2251 # matchingrule = MatchingRuleId from Section 4.1.9 of RFC 2251 # value = AttributeValue from Section 4.1.6 of RFC 2251
br'(?P<value>[\*\w\s=,\\\'@\-\+_\.^\W\d_]*?)\)' + b'(?P<fltr>.*)')
""" Parse a query string into a series of Ops and Filters """ # Match outermost operations else:
# Under Python 3, our regular expression is type <str>, which # does not handle <bytes>. Doing a temporary decode.
# Match internal filter.
# Revert the previous temporary decode
""" Flatten a sequence of Ops/Filters leaving only ``klass`` instances """
""" Separate a parsed query into operations """
else:
# A simple filter with no operands # Very likely a single operand around a group of filters.
""" Compare parsed queries and return common query elements """
|