Updated openstack/openstack
Project: openstack/python-ceilometerclient  2a2e2dd2732240a08d7f0e1288229a39ae380d1c

Refactor split_by_op and split_by_datatype

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