Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def instance_key(inst):
return _map[ComparableInstance(inst)]
def instance_key_all(inst):
return _map_all[ComparableInstance(inst)]
if self.useidentifiers:
attr = self.itemsetAttr(key)
if attr is not None:
mask = list(map(match, (inst[attr] for inst in input.table)))
else:
mask = [False] * len(input.table)
def instance_key(inst):
return str(inst[attr])
def instance_key_all(inst):
return str(inst[attr])
else:
mask = [
ComparableInstance(inst) in selected_items for inst in input.table
]
_map = {item: str(i) for i, item in enumerate(selected_items)}
_map_all = {
ComparableInstance(i): hash(ComparableInstance(i))
for i in input.table
}
def instance_key(inst):
return _map[ComparableInstance(inst)]
def instance_key_all(inst):
return _map_all[ComparableInstance(inst)]
mask = numpy.array(mask, dtype=bool)
subset = input.table[mask]
else:
mask = [False] * len(input.table)
def instance_key(inst):
return str(inst[attr])
def instance_key_all(inst):
return str(inst[attr])
else:
mask = [
ComparableInstance(inst) in selected_items for inst in input.table
]
_map = {item: str(i) for i, item in enumerate(selected_items)}
_map_all = {
ComparableInstance(i): hash(ComparableInstance(i))
for i in input.table
}
def instance_key(inst):
return _map[ComparableInstance(inst)]
def instance_key_all(inst):
return _map_all[ComparableInstance(inst)]
mask = numpy.array(mask, dtype=bool)
subset = input.table[mask]
annotated_subset = input.table
id_column = numpy.array(
[[instance_key_all(inst)] for inst in annotated_subset]
)
def __eq__(self, other):
# XXX: comparing NaN with different payload
return (
isinstance(other, ComparableInstance)
and domain_eq(self.domain, other.domain)
and self.inst.x.data.tobytes() == other.inst.x.data.tobytes()
and self.inst.y.data.tobytes() == other.inst.y.data.tobytes()
)