Get values from input data.

    Args:
      js_dict (dict): dictionary containing dataset data and metadata.
      value (string, optional): name of the value column. Defaults to 'value'.

    Returns:
      values (list): list of dataset values.
965029
def get_values(js_dict, value='value'):
    

    values = js_dict[value]
    if type(values) is list:
        if type(values[0]) is not dict or tuple:
            return values
    # being not a list of dicts or tuples leaves us with a dict...
    values = {int(key): value for (key, value) in values.items()}

    if js_dict.get('size'):
        max_val = np.prod(np.array((js_dict['size'])))
    else:
        max_val = np.prod(np.array((js_dict['dimension']['size'])))
    vals = max_val * [None]
    for (key, value) in values.items():
        vals[key] = value

    values = vals
    return values
694721
def flatten_dict_vals(dict_):
    
    if isinstance(dict_, dict):
        return dict([
            ((key, augkey), augval)
            for key, val in dict_.items()
            for augkey, augval in flatten_dict_vals(val).items()
        ])
    else:
        return {None: dict_}
599660
def _set_value(value):
    '''
    
    '''
    #don't continue if already an acceptable data-type
    if isinstance(value, bool) or isinstance(value, dict) or isinstance(value, list):
        return value

    #check if json
    if value.startswith('j{') and value.endswith('}j'):

        value = value.replace('j{', '{')
        value = value.replace('}j', '}')

        try:
            return salt.utils.json.loads(value)
        except Exception:
            raise salt.exceptions.CommandExecutionError

    #detect list of dictionaries
    if '|' in value and r'\|' not in value:
        values = value.split('|')
        items = []
        for value in values:
            items.append(_set_value(value))
        return items

    #parse out dictionary if detected
    if ':' in value and r'\:' not in value:
        options = {}
        #split out pairs
        key_pairs = value.split(',')
        for key_pair in key_pairs:
            k = key_pair.split(':')[0]
            v = key_pair.split(':')[1]
            options[k] = v
        return options

    #try making a list
    elif ',' in value and r'\,' not in value:
        value_items = value.split(',')
        return value_items

    #just return a string
    else:

        #remove escape chars if added
        if r'\|' in value:
            value = value.replace(r'\|', '|')

        if r'\:' in value:
            value = value.replace(r'\:', ':')

        if r'\,' in value:
            value = value.replace(r'\,', ',')

        return value
676925
def get_prep_value(self, value):
        """"""

        if value == "":
            return None

        if isinstance(value, dict):
            value = json.dumps(value, cls=DjangoJSONEncoder)

        return value
96614
def _from_dict(cls, values, value_filter, dictionary, allow_unset=True):
        """"""
        if not isinstance(dictionary, Mapping):
            raise TypeError('dictionary should be mapping')
        obj = cls(values, value_filter)
        values = obj.__values
        for name, value in dictionary.items():
            if not isinstance(name, string_types):
                raise TypeError('Key %s is not a string' % str(name))
            setattr(values, name, value)
        if obj.missing and not allow_unset:
            raise ValueError('%d value(s) are unset' % len(obj.missing))
        return obj
154087
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        return value or default
1009413
def get_value(self):
        
        try:
            self.raw_value
        except (AttributeError, KeyError) as err:
            self._reraise_if_required(err)
            default_value = self.default_value
            if self.transform_default:
                return self.transform(default_value)
            return default_value
        else:
            # If setting is defined, load values of all subsettings.
            value = {}
            for key, subsetting in self.settings.items():
                value[key] = subsetting.get_value()
            return value
16988
def extract_value(self, data):
        
        if self.name not in data and not self.allow_missing:
            raise exceptions.FieldNotFound('Field {} is missing from request'.format(self.name))
        
        if self.multiple_inputs:
            self.value = []
            for value in data.getlist(self.name):
                if self.strip_value:
                    value = value.strip()
                if value == '' and self.convert_empty_to_none:
                    value = None

                self.value.append(value)
        else:
            self.value = data.get(self.name)
            if self.value is not None:
                if self.strip_value:
                    self.value = self.value.strip()
                if self.value == '' and self.convert_empty_to_none:
                    self.value = None

        # Convert the value to the correct data type
        self.convert_value()
844076
def _extract_values(values_list):
        
        values = []
        # check if file or list of values to iterate
        if isinstance(values_list, str):
            with open(values_list) as ff:
                reading = csv.reader(ff)
                for j in reading:
                    values.append(j[0])
        elif isinstance(values_list, list):
            values = values_list
        else:
            raise Exception("input datatype not supported.")
        return values
271414
def values(self):
        
        return dict((k, getattr(self, k)) for k in self._keys)
527669
def value_from_datadict(self, data, files, name):
        """"""
        upload = super(StickyUploadWidget, self).value_from_datadict(data, files, name)
        if upload is not None:
            # File was posted or cleared as normal
            return upload
        else:
            # Try the hidden input
            hidden_name = self.get_hidden_name(name)
            value = data.get(hidden_name, None)
            if value is not None:
                upload = open_stored_file(value, self.url)
                if upload is not None:
                    setattr(upload, '_seralized_location', value)
        return upload
777475
def get_values(self):
        

        results = requests.get(self.url).json()
        values = {}
        for entry in results:
            values[entry['visualProperty']] = entry['value']
        return values
1233287
def normalize_dictionary(data_dict):
    
    for key, value in data_dict.items():
        if not isinstance(key, str):
            del data_dict[key]
            data_dict[str(key)] = value
    return data_dict
900953
def get_value(self, dictionary):
        
        # We override the default field access in order to support
        # lists in HTML forms.
        if html.is_html_input(dictionary):
            return html.parse_html_list(dictionary, prefix=self.field_name)
        return dictionary.get(self.field_name, empty)
911842
def values(self):
        
        dtypes = [col.dtype for col in self.columns]
        if len(set(dtypes)) > 1:
            dtype = object
        else:
            dtype = None
        return np.array(self.columns, dtype=dtype).T
132914
def _as_dict(self):
        
        values = self._dynamic_columns or {}
        for name, col in self._columns.items():
            values[name] = col.to_database(getattr(self, name, None))
        return values
1354140
def fromJSON(value):
        
        j = json.loads(value)
        v = GPRecordSet()
        if "defaultValue" in j:
            v.value = j['defaultValue']
        else:
            v.value = j['value']
        if 'paramName' in j:
            v.paramName = j['paramName']
        elif 'name' in j:
            v.paramName = j['name']
        return v