removed unncessary shortcuts

This commit is contained in:
Abubakar Abid 2021-10-13 22:15:30 -05:00
parent e6c982250e
commit 4bdaf4446b

View File

@ -504,12 +504,6 @@ class CheckboxGroup(InputComponent):
final_scores.append(score_set)
return final_scores
@classmethod
def get_shortcut_implementations(cls):
return {
"checkboxgroup": {},
}
def embed(self, x):
if self.type == "value":
return [float(choice in x) for choice in self.choices]
@ -586,12 +580,6 @@ class Radio(InputComponent):
scores.insert(self.choices.index(x), None)
return scores
@classmethod
def get_shortcut_implementations(cls):
return {
"radio": {},
}
def embed(self, x):
if self.type == "value":
return [float(choice == x) for choice in self.choices]
@ -659,12 +647,6 @@ class Dropdown(InputComponent):
scores.insert(self.choices.index(x), None)
return scores
@classmethod
def get_shortcut_implementations(cls):
return {
"dropdown": {},
}
def embed(self, x):
if self.type == "value":
return [float(choice == x) for choice in self.choices]
@ -1289,9 +1271,12 @@ def get_input_instance(iface):
return shortcut[0](**shortcut[1])
elif isinstance(iface, dict): # a dict with `name` as the input component type and other keys as parameters
name = iface.pop('name')
component, params = InputComponent.get_all_shortcut_implementations()[name]
params.update(**iface)
return component(**params)
for component in InputComponent.__subclasses__():
if component.__name__.lower() == name:
break
else:
raise ValueError("No such InputComponent: {}".format(name))
return component(**iface)
elif isinstance(iface, InputComponent):
return iface
else: