def delta(self, other): '''return the difference between the data''' if hasattr(other, 'data'): data = other.data else: data = other diffs = [ namespace.locate_ns_item(self.data, key, building=True) for key in \ filter( \ lambda key: namespace.locate_ns_item(data, key) != namespace.locate_ns_item(self.data, key), \ [key for key in self.relevant_data_keys if namespace.in_ns(self.data, key)] ) \ ] delta = namespace.Namespace() for diff in diffs: delta.update(diff) return delta
def delta(self, other): """return the difference between the data""" if hasattr(other, "data"): data = other.data else: data = other diffs = [ namespace.locate_ns_item(self.data, key, building=True) for key in filter( lambda key: namespace.locate_ns_item(data, key) != namespace.locate_ns_item(self.data, key), [key for key in self.relevant_data_keys if namespace.in_ns(self.data, key)], ) ] delta = namespace.Namespace() for diff in diffs: delta.update(diff) return delta
def assert_data(self, data): for key in self.required_data_keys: assert namespace.in_ns(data, key) and namespace.locate_ns_item(data, key) is not None, \ "no %s key in data %s" % (key, data)
def assert_data(self, data): for key in self.required_data_keys: assert ( namespace.in_ns(data, key) and namespace.locate_ns_item(data, key) is not None ), "no %s key in data %s" % (key, data)