Пример #1
0
	def _contains(self, rule, value, dataset):
		# if model contains the values, then the current seed should be generated using sibling-matches 
		subset = helpers.subset_from_superset(rule.values, [value])
		if len(subset) > 0: # subset will never be larger then 1
			m = rule.matches
			if m:
				return set([dataset.matches(m)])
		return None
Пример #2
0
	def contains(self, possible_values, pick_random=True, strict=False):
		if self._is_list():
			subset = helpers.subset_from_superset(possible_values, self.raw_data)
			if pick_random:
				return self.random(subset)
			else:
				return list(subset)
		return list()
Пример #3
0
	def excludes(self, possible_values, pick_random=True, strict=False):
		if self._is_list():
			# filter array
			dataset = set(self.raw_data)
			subset = helpers.subset_from_superset(possible_values, self.raw_data)
			new_dataset = dataset.difference(subset)
			if pick_random:
				return self.random(new_dataset)
			else:
				return list(new_dataset)

		return list()
Пример #4
0
	def _missing(self, rule, value, dataset):
		# if model contains the values, then the current seed should be generated using sibling-matches 
		# print "Missing Checking Value: " + value
		# print "Missing Checking Against: " 
		# print rule.values

		subset = helpers.subset_from_superset(rule.values, [value])
		# value matches check values
		if len(subset) is 0: # subset will never be larger then 1
			# then generate based on the maches algo
			m = rule.matches
			if m:
				return set([dataset.matches(m)])
		return None