From 423aa86fdd6ce2ecb2f055c5514940e46ad0582e Mon Sep 17 00:00:00 2001 From: David Hassell Date: Tue, 29 Mar 2022 13:31:11 +0100 Subject: [PATCH 1/2] __query__ --- cf/data/data.py | 19 ------------------- cf/query.py | 7 ------- 2 files changed, 26 deletions(-) diff --git a/cf/data/data.py b/cf/data/data.py index c93d48f7d4..bc511f786f 100644 --- a/cf/data/data.py +++ b/cf/data/data.py @@ -4272,25 +4272,6 @@ def _binary_operation(self, other, method): return self - def __query_set__(self, values): - """Implements the “member of set” condition.""" - i = iter(values) - v = next(i) - - out = self == v - for v in i: - out |= self == v - - return out - - def __query_wi__(self, value): - """Implements the “within a range” condition.""" - return (self >= value[0]) & (self <= value[1]) - - def __query_wo__(self, value): - """TODO.""" - return (self < value[0]) | (self > value[1]) - @classmethod def concatenate(cls, data, axis=0, _preserve=True): """Join a sequence of data arrays together. diff --git a/cf/query.py b/cf/query.py index 6f80960d1b..67932f9f86 100644 --- a/cf/query.py +++ b/cf/query.py @@ -690,13 +690,6 @@ def _evaluate(self, x, parent_attr): return (x < value[0]) | (x > value[1]) - # if operator == 'contains': - # _contain = getattr(x, '__query_contains__', None) - # if _contain is not None: - # return _contain(value) - # else: - # return x == value - if operator == "set": if isinstance(x, str): for v in value: From e92ae7a184368fc368e21f1ff44214b2ba604738 Mon Sep 17 00:00:00 2001 From: David Hassell Date: Tue, 5 Apr 2022 08:55:41 +0100 Subject: [PATCH 2/2] remove __query_*__ methods --- cf/mixin/propertiesdata.py | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/cf/mixin/propertiesdata.py b/cf/mixin/propertiesdata.py index 27c97fdea2..0459fca05f 100644 --- a/cf/mixin/propertiesdata.py +++ b/cf/mixin/propertiesdata.py @@ -820,40 +820,6 @@ def _equivalent_data(self, other, atol=None, rtol=None, verbose=None): # # return matches - def __query_set__(self, values): - """Implements the “member of set” condition.""" - new = self.copy() - new.set_data(self.data.__query_set__(values), copy=False) - return new - - # def _query_contain(self, value): - # '''TODO# - # - # ''' - # new = self.copy() - # new.set_data(self.data._query_contain(value), copy=False) - # return new - - # def _query_contains(self, value): - # '''TODO - # - # ''' - # new = self.copy() - # new.set_data(self.data._query_contains(value), copy=False) - # return new - - def __query_wi__(self, value): - """Implements the “within a range” condition.""" - new = self.copy() - new.set_data(self.data.__query_wi__(value), copy=False) - return new - - def __query_wo__(self, value): - """Implements the “without a range” condition.""" - new = self.copy() - new.set_data(self.data.__query_wo__(value), copy=False) - return new - def _unary_operation(self, method): """Implement unary arithmetic operations on the data array.