Get [(value, text),...] list
        :param condition:
        :param value_field: default is primary_key
        :param text_field: default is unicode(obj)
        :return:
195260
def get_choices(cls, condition=None, order_by=None, query=None, value_field=None, text_field=None):
        
        result = []
        if query is None:
            query = cls.filter(condition).order_by(order_by)
        for row in query:
            if not value_field:
                value = row._key
            else:
                value = getattr(row, value_field)
            if not text_field:
                text = unicode(row)
            else:
                text = getattr(row, text_field)
            result.append((value, text))
        return result
409873
def getlist(self, key, delimiter=',', **kwargs):
        

        value = self.get(key, **kwargs)
        if value is None: return value
        if isinstance(value, str):
            value = value.strip()
            if value.startswith('[') and value.endswith(']'):
                return self.getserialized(key)

            return [p.strip(' ') for p in value.split(delimiter)]
        #end if

        return list(value)
1322134
def field_value(self, value):
        
        if not self.is_array:
            return self.field_type(value)

        if isinstance(value, (list, tuple, set)):
            return [self.field_type(item) for item in value]
        return self.field_type(value)
922283
def get_condition_filter(condition, field_map={}):
    
    field_name = condition.get("field")
    field_name = field_map.get(field_name, field_name)
    operation = condition["type"]
    values = condition["values"]

    condition_filter = MatchAll()

    if values:
        values = [v["value"] for v in values]
        if operation == "all":
            for value in values:
                if "." in field_name:
                    path = field_name.split(".")[0]
                    condition_filter &= Nested(path=path, filter=Term(**{field_name: value}))
                else:
                    condition_filter &= Term(**{field_name: value})
        elif operation == "any":
            if "." in field_name:
                path = field_name.split(".")[0]
                condition_filter &= Nested(path=path, filter=Terms(**{field_name: values}))
            else:
                condition_filter &= Terms(**{field_name: values})
        elif operation == "none":
            if "." in field_name:
                path = field_name.split(".")[0]
                condition_filter &= ~Nested(path=path, filter=Terms(**{field_name: values}))
            else:
                condition_filter &= ~Terms(**{field_name: values})
        else:
            raise ValueError(
                """ES conditions must be one of the following values: ['all', 'any', 'none']"""
            )
    return condition_filter
637292
def normalize_field(self, value):
        
        if self.default is not None:
            if value is None or value == '':
                value = self.default
        return value
310601
def get_field_value(self, key, default=None):
    
    if key in self._fields:
      payload_field = self._fields[key]
      if payload_field:
        return payload_field.value
    return default
910273
def get_field(field, default = nil)
      value = fields[field]
      value = default if !default.nil? && (value.nil? || (value.respond_to?(:empty?) && value.empty?))
      value
    end
430835
def f(field: str, kwargs: Dict[str, Any],
      default: Optional[Any] = None) -> str:
    
    if default is not None:
        return str(kwargs.get(field, default))
    return str(kwargs[field])
477997
def _get_info_singlevalue_subfield(info, field):
        
        search = re.search(pattern=field + " (?P<value>\d+)", string=info)
        return {field: int(search.group("value"))}
951831
def _extract_optional_list_field(blob, name):
    ''''''
    value = _optional_list(typesafe_pop(blob, name, []))
    if value is None:
        raise ParserError(
            '"{}" field must be a string or a list.'.format(name))
    return value
963145
def get_attribute_value(item, field, context, force=False, skip_autofield=True):
    
    # Find the value of the field, catching any database issues
    try:
        value = getattr(item, field.name)
    except ObjectDoesNotExist:
        raise SkipValue('Could not find object for %s.%s, ignoring.\n' % (item.__class__.__name__, field.name))

    # AutoField: We don't include the auto fields, they'll be automatically recreated
    if skip_autofield and isinstance(field, AutoField):
        raise SkipValue()

    # Some databases (eg MySQL) might store boolean values as 0/1, this needs to be cast as a bool
    elif isinstance(field, BooleanField) and value is not None:
        return repr(bool(value))

    # Post file-storage-refactor, repr() on File/ImageFields no longer returns the path
    elif isinstance(field, FileField):
        return repr(force_text(value))

    # ForeignKey fields, link directly using our stored python variable name
    elif isinstance(field, ForeignKey) and value is not None:

        # Special case for contenttype foreign keys: no need to output any
        # content types in this script, as they can be generated again
        # automatically.
        # NB: Not sure if "is" will always work
        if field.remote_field.model is ContentType:
            return 'ContentType.objects.get(app_label="%s", model="%s")' % (value.app_label, value.model)

        # Generate an identifier (key) for this foreign object
        pk_name = value._meta.pk.name
        key = '%s_%s' % (value.__class__.__name__, getattr(value, pk_name))

        if key in context:
            variable_name = context[key]
            # If the context value is set to None, this should be skipped.
            # This identifies models that have been skipped (inheritance)
            if variable_name is None:
                raise SkipValue()
            # Return the variable name listed in the context
            return "%s" % variable_name
        elif value.__class__ not in context["__avaliable_models"] or force:
            context["__extra_imports"][value._meta.object_name] = value.__module__
            item_locator = orm_item_locator(value)
            return item_locator
        else:
            raise DoLater('(FK) %s.%s\n' % (item.__class__.__name__, field.name))

    elif isinstance(field, (DateField, DateTimeField)) and value is not None:
        return "dateutil.parser.parse(\"%s\")" % value.isoformat()

    # A normal field (e.g. a python built-in)
    else:
        return repr(value)
1092660
def set_python(self, value):
        """"""
        if not isinstance(value, (list, type(None))):
            raise ValidationError(
                self.record,
                "Field '{}' must be set to a list, not '{}'".format(
                    self.name,
                    value.__class__
                )
            )
        value = value or []
        self.cursor._validate_list(value)
        return super(ListField, self).set_python(value)
398209
def text(self, value, default=''):
        
        for key, val in self.items():
            if val == value:
                return key
        return default
779092
def default_value_setter(field):
    

    def default_value_func_setter(self, value):
        localized_field = utils.build_localized_field_name(
            field, self._linguist.active_language
        )

        setattr(self, localized_field, value)

    return default_value_func_setter
468048
def getVals(self):
        
        return [(name, self._fieldValDict.get(name)) 
                for name in self._fieldNameList]
532960
def get_key_by_value(dictionary, search_value):
    
    for key, value in dictionary.iteritems():
        if value == search_value:
            return ugettext(key)
357774
def convert_value(value, field):
        
        clz = field.field_type

        if clz is Boolean:
            if not isinstance(value, bool):
                return bool(value)

        elif clz is Date:
            if not isinstance(value, str):
                value = str(value)
            return parser.parse(value)

        elif clz is Number:
            if not isinstance(value, int):
                return int(value)

        elif clz is Object:
            if not isinstance(value, dict):
                return ast.literal_eval(value)

        elif clz is Text or clz is Symbol:
            if not isinstance(value, str):
                return str(value)

        elif clz is List or clz is MultipleAssets or clz is MultipleEntries:
            if not isinstance(value, list):
                return [value]

        # No need to convert :class:`.fields.Link` types as the expected value
        # should be of type :class:`.resources.ResourceLink` for links.

        return value