Retrieve given property from class/instance, ensuring it is a list.
        Also determine whether the list contains simple text/numeric values or
        nested dictionaries (a "complex" list)
435213
def getlist(self, name):
        
        value = self.getvalue(name)
        complex = {}

        def str_value(val):
            # TODO: nonlocal complex
            if isinstance(val, dict):
                complex['complex'] = True
                return val
            else:
                return str(val)

        if value is None:
            pass
        else:
            value = [str_value(val) for val in as_list(value)]

        return value, bool(complex)
1373731
function detect_class_members_from_array(cls, ast) {
  cls["members"] = [];
  return _.each(ast["elements"], function(el) {
    detect_method_or_property(cls, key_value(el), el, el);
  });
}
610700
public static Object getPropertyIfExists(Object instance, String property) {
        return getPropertyIfExists(instance, property, Object.class);
    }
1060128
def _deserialize(cls, json_body, get_value_and_type):
        

        instance = cls()
        is_set = False
        properties = cls._get_property_names(instance)

        def get_property_detail(name):
            p = [p for p in instance._property_details if p.name == name or p.field_name == name]
            return None if len(p) == 0 else p[0]

        for k in json_body:
            field = json_body[k]
            pd = get_property_detail(k)
            pn = k if not pd else pd.to_property_name(k)
            if pn in properties:
                v, t = get_value_and_type(field)
                initial_value = getattr(instance, pn)
                value = instance._field_to_property(v, t, pd, initial_value)
                setattr(instance, pn, value)
                is_set = True

        return instance if is_set else None
207470
def from_list(cls, database, key, data, clear=False):
        
        lst = cls(database, key)
        if clear:
            lst.clear()
        lst.extend(data)
        return lst
1035963
def wrap(cls, value):
        ''' 

        '''
        if isinstance(value, list):
            if isinstance(value, PropertyValueList):
                return value
            else:
                return PropertyValueList(value)
        else:
            return value
1125411
def [](property_name)
      if get_property(property_name).is_a?(::OData::ComplexType)
        get_property(property_name)
      else
        get_property(property_name).value
      end
    rescue NoMethodError
      raise ArgumentError, "Unknown property: #{property_name}"
    end
126210
function getKeyFromList(list, key, value) {
    for (var i = list.length - 1; i >= 0; i--) {
        if (list[i][key] == value) {
            return list[i];
        }
    }
    return false;
}
534514
def _get_properties(self, rule, p_selectors, p_parents, p_children, scope, media, c_lineno, c_property, c_codestr):
        
        prop, value = (_prop_split_re.split(c_property, 1) + [None])[:2]
        try:
            is_var = (c_property[len(prop)] == '=')
        except IndexError:
            is_var = False
        prop = prop.strip()
        prop = self.do_glob_math(
            prop, rule[CONTEXT], rule[OPTIONS], rule, True)
        if prop:
            if value:
                value = value.strip()
                value = self.calculate(
                    value, rule[CONTEXT], rule[OPTIONS], rule)
            _prop = (scope or '') + prop
            if is_var or prop.startswith('$') and value is not None:
                if isinstance(value, basestring):
                    if '!default' in value:
                        if _prop in rule[CONTEXT]:
                            value = None
                        else:
                            value = value.replace(
                                '!default', '').replace('  ', ' ').strip()
                elif isinstance(value, ListValue):
                    value = ListValue(value)
                    for k, v in value.value.items():
                        if v == '!default':
                            if _prop in rule[CONTEXT]:
                                value = None
                            else:
                                del value.value[k]
                                value = value.first(
                                ) if len(value) == 1 else value
                            break
                if value is not None:
                    rule[CONTEXT][_prop] = value
            else:
                _prop = self.apply_vars(
                    _prop, rule[CONTEXT], rule[OPTIONS], rule, True)
                rule[PROPERTIES].append((c_lineno, _prop,
                                         to_str(value) if value is not None else None))
1237483
def read_dict_from_properties(desired_type: Type[dict], file_object: TextIOBase,
                              logger: Logger, conversion_finder: ConversionFinder, **kwargs) -> Dict[str, Any]:
    

    # right now jprops relies on a byte stream. So we convert back our nicely decoded Text stream to a unicode
    # byte stream ! (urgh)
    class Unicoder:
        def __init__(self, file_object):
            self.f = file_object

        def __iter__(self):
            return self

        def __next__(self):
            line = self.f.__next__()
            return line.encode(encoding='utf-8')

    res = jprops.load_properties(Unicoder(file_object))

    # first automatic conversion of strings > numbers
    res = {key: try_parse_num_and_booleans(val) for key, val in res.items()}

    # further convert if required
    return ConversionFinder.convert_collection_values_according_to_pep(res, desired_type, conversion_finder, logger, 
                                                                       **kwargs)
1262610
def get_keys_from_class(cc):
    
    return [prop.name for prop in cc.properties.values() \
            if 'key' in prop.qualifiers]
1209980
def is_list_of_dict_like(obj, attr=('keys', 'items')):
    
    try:
        if len(obj) == 0:
            return False
        return all([is_dict_like(i, attr) for i in obj])
    except Exception:
        return False
1095771
def get_value(self, attributes,key = None):
        

        value = attributes
        if key is None:
            key = self._splitted_key

        # A splitted key like 'a.b.c' goes into nested properties
        # and the value is retrieved recursively
        for i,elem in enumerate(key):
            if isinstance(value, (list,tuple)):
                #if this is a list, we return all matching values for the given list items
                return [self.get_value(v,key[i:]) for v in value]
            else:
                value = value[elem]

        return value
598637
def get_instance(attr, value):
        
        for i in list(BrowserView.instances.values()):
            try:
                if getattr(i, attr) == value:
                    return i
            except AttributeError:
                break

        return None
614543
def get_attr_from_dict(inspected_obj: Any, attr_name: str) -> Any:
    
    if inspect.isclass(inspected_obj):
        obj_list = [inspected_obj] + list(inspected_obj.__mro__)
    else:
        obj_list = [inspected_obj] + list(inspected_obj.__class__.__mro__)
    for obj in obj_list:
        if hasattr(obj, '__dict__') and attr_name in obj.__dict__:
            return obj.__dict__[attr_name]
    # This happens when user-defined __dir__ returns something that's not
    # in any __dict__. See test_override_dir.
    # Returns attr_name so that it's treated as a normal property.
    return attr_name
1203197
def parse_list(cls, data):
        """"""
        results = ResultSet()
        data = data or []
        for obj in data:
            if obj:
                results.append(cls.parse(obj))
        return results
892734
def __find_object_children(self, obj) -> dict:
        
        if hasattr(obj, 'items') and \
                isinstance(obj.items, types.BuiltinFunctionType):
            return self.__construct_object(obj)
        elif isinstance(obj, (list, tuple, set)):
            return self.__construct_list(obj)
        else:
            exclude_list = []
            if hasattr(obj, '_sa_instance_state'):
                # load only deferred objects
                if len(orm.attributes.instance_state(obj).unloaded) > 0:
                    mapper = inspect(obj)
                    for column in mapper.attrs:
                        column.key
                        column.value
            if hasattr(obj, 'json_exclude_list'):
                # do not serialize any values in this list
                exclude_list = obj.json_exclude_list
            return self.__construct_object(vars(obj), exclude_list)
        return None