2a2e2dd2732240a08d7f0e1288229a39ae380d1c
split_by_op was returning data against which further error checking was then required. This change moves that error handling inside the method and simplifies the regular expression so that it splits (greedily) on the first operator it finds. If the split is not possible, it is a ValueError. If the field or value are empty, that is a ValueError. Both split_by_op and split_by_datatype were doing a findall() where a match() and split() do the right job and more efficiently. Regular expression compilation has been moved to the module level to insure they need only be compiled once. Operator keys must be sorted by length to ensure the point at which the split happens is most greedy. Using a split keeps the regex short and removes any statements about the left and right hand sides of the operator. Tests added to cover the method more completely, including testing for corner cases such as single character field or values or operators showing up in unexpected locations. 'string' variable renamed to 'query' and 'query_value' to avoid confusion. Named parameters on string substitution for clarity. Note that the tests which do self.assertRaises could more explicitly check the exception with self.assertRaisesRegexp but that would break compatibility with Python 2.6. Change-Id: Icd815ff65aba9eae3f76afee3bb33e85d85bea72 Closes-Bug: #1314544
Python bindings to the Ceilometer API
This is a client library for Ceilometer built on the Ceilometer API.
It provides a Python API (the ceilometerclient module) and
a command-line tool (ceilometer).
Development takes place via the usual OpenStack processes as outlined in the OpenStack wiki. The master repository is on GitHub.
See release notes and more at http://docs.openstack.org/developer/python-ceilometerclient/.
Description