Load a Choice from the database.
192937
def choice_default_loader(self, pk):
        """"""
        try:
            obj = Choice.objects.get(pk=pk)
        except Choice.DoesNotExist:
            return None
        else:
            self.choice_default_add_related_pks(obj)
            return obj
908237
public void loadChoices(String propertyName) {
        if (propertyName == null || propertyName.isEmpty()) {
            loadChoices(DEFAULT_CHOICES);
        } else {
            loadChoices(PropertyUtil.getValues(propertyName, null));
        }
    }
1320038
def get_selected_values(self, selection):
        """"""
        return [v for b, v in self._choices if b & selection]
605465
def _load_info(self):
    """"""
    if self._info is None:
      try:
        self._info = self._api.tables_get(self._name_parts)
      except Exception as e:
        raise e
1040085
def choose(cls, choices, field="Id", qb=None):
        
        return cls.where(build_choose_clause(choices, field), qb=qb)
1078793
protected function loadQuery()
    {
        if( !isset( $this->session[ $this->saveID ] ) ) {
            return;
        }
        $saved        = $this->session[ $this->saveID ];
        $this->inputs = array_merge( $saved[ 'inputs' ], $this->inputs );
        $this->perPage = $saved[ 'perPage' ];
        if( $currPage=$this->getKey($this->pager) ) {
            $this->currPage = $currPage;
        } else{
            $this->currPage = $saved['currPage'];
        }
    }
1369216
def build(c: Union[Text, 'Choice', Dict[Text, Any]]) -> 'Choice':
        """"""

        if isinstance(c, Choice):
            return c
        elif isinstance(c, str):
            return Choice(c, c)
        else:
            return Choice(c.get('name'),
                          c.get('value'),
                          c.get('disabled', None),
                          c.get('checked'),
                          c.get('key'))
472822
protected function autoload()
    {
        if ($this->loaded) {
            return;
        }

        $table = Common::prefixTable('option');
        $sql   = 'SELECT option_value, option_name FROM `' . $table . '` WHERE autoload = 1';
        $all   = Db::fetchAll($sql);

        foreach ($all as $option) {
            $this->all[$option['option_name']] = $option['option_value'];
        }

        $this->loaded = true;
    }
1130138
def _query_select_options(self, query, select_columns=None):
        
        if select_columns:
            _load_options = list()
            for column in select_columns:
                if "." in column:
                    model_relation = self.get_related_model(column.split(".")[0])
                    if not self.is_model_already_joinded(query, model_relation):
                        query = query.join(model_relation)
                    _load_options.append(
                        Load(model_relation).load_only(column.split(".")[1])
                    )
                else:
                    if not self.is_relation(column) and not hasattr(
                        getattr(self.obj, column), "__call__"
                    ):
                        _load_options.append(Load(self.obj).load_only(column))
                    else:
                        _load_options.append(Load(self.obj))
            query = query.options(*tuple(_load_options))
        return query
476685
def _convert_choices(self, choices):
        """"""

        final_choices = []
        for choice in choices:

            if isinstance(choice, ChoiceEntry):
                final_choices.append(choice)
                continue

            original_choice = choice
            choice = list(choice)
            length = len(choice)

            assert 2 <= length <= 4, 'Invalid number of entries in %s' % (original_choice,)

            final_choice = []

            # do we have attributes?
            if length > 2 and isinstance(choice[-1], Mapping):
                final_choice.append(choice.pop())
            elif length == 4:
                attributes = choice.pop()
                assert attributes is None or isinstance(attributes, Mapping), 'Last argument must be a dict-like object in %s' % (original_choice,)
                if attributes:
                    final_choice.append(attributes)

            # the constant
            final_choice.insert(0, choice.pop(0))

            # the db value
            final_choice.insert(1, choice.pop(0))

            if len(choice):
                # we were given a display value
                final_choice.insert(2, choice.pop(0))
            else:
                # no display value, we compute it from the constant
                final_choice.insert(2, self.display_transform(final_choice[0]))

            final_choices.append(final_choice)

        return super(AutoDisplayChoices, self)._convert_choices(final_choices)
1007549
def pickdata(self, data):
        
        """
        attrs = data.get(self.__options['attrkey']) or {}
        values = data.get(self.__options['valuekey']) or ''
        return (attrs, values)
475475
public function load_choices() {
        if (is_array($this->choices)) {
            return true;
        }
        $this->choices = array();
        $days = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
        foreach ($days as $day) {
            $this->choices[$day] = get_string($day, 'calendar');
        }
        return true;
    }
1038636
def choose(self, choose_from):
        

        for choice in self.elements:
            if choice in choose_from:
                return ImplementationChoice(choice, choose_from[choice])
        raise LookupError(self.elements, choose_from.keys())
1005831
private function loadTermsData()
    {
        $select = $this->getConnection()->select();

        $itemIds = array_keys($this->_items);

        $select->from(['exp' => $this->getTable(ThesaurusInterface::EXPANSION_TABLE_NAME)], [])
            ->joinLeft(
                ['ref' => $this->getTable(ThesaurusInterface::REFERENCE_TABLE_NAME)],
                "exp.thesaurus_id = ref.thesaurus_id AND exp.term_id = ref.term_id",
                []
            )
            ->where('exp.thesaurus_id IN (?)', $itemIds)
            ->group(["exp.thesaurus_id", "exp.term_id"])
            ->columns(
                [
                    'thesaurus_id'    => 'exp.thesaurus_id',
                    'expansions_terms' => new \Zend_Db_Expr("GROUP_CONCAT(exp.term)"),
                    'expanded_term'    => 'ref.term',
                ]
            );

        $this->addTermData($this->getConnection()->fetchAll($select));
    }
1271712
def load(klass, client, id, **kwargs):
        """"""
        resource = klass.RESOURCE.format(id=id)
        response = Request(client, 'get', resource, params=kwargs).perform()
        return klass(client).from_response(response.body['data'])
668475
def select(cls, *args, **kwargs):
        """"""
        query = super(Model, cls).select(*args, **kwargs)
        query.database = cls._get_read_database()
        return query
279557
protected void updateFromSelection() {
    DBIDSelection sel = context.getSelection();
    if(sel != null) {
      this.dbids = DBIDUtil.newArray(sel.getSelectedIds());
      this.dbids.sort();
    }
    else {
      this.dbids = DBIDUtil.newArray();
    }
  }