Only expose some of the attributes when using as a dictionary
558023
def keys(self):
        """"""
        keys = Struct.keys(self)
        for key in (
                '_cloud_provider',
                '_naming_policy',
                '_setup_provider',
                'known_hosts_file',
                'repository',
        ):
            if key in keys:
                keys.remove(key)
        return keys
1043271
def dict_to_cognito(attributes, attr_map=None):
    
    if attr_map is None:
        attr_map = {}
    for k,v in attr_map.items():
        if v in attributes.keys():
            attributes[k] = attributes.pop(v)

    return [{'Name': key, 'Value': value} for key, value in attributes.items()]
208834
def _filter_attrs(self, feature, request):
        
        if 'attrs' in request.params:
            attrs = request.params['attrs'].split(',')
            props = feature.properties
            new_props = {}
            for name in attrs:
                if name in props:
                    new_props[name] = props[name]
            feature.properties = new_props
        if asbool(request.params.get('no_geom', False)):
            feature.geometry = None
        return feature
1055708
def as_dict(self):
        
        self.clean()
        d = OrderedDict()
        all_props = self.__class__.CONFIG_PROPERTIES
        for attr_name, attr_config in six.iteritems(all_props):
            value = self._config[attr_name]
            attr_type = attr_config.attr_type
            if attr_type:
                if value:
                    if issubclass(attr_type, list):
                        if issubclass(attr_type, NamedTupleList):
                            d[attr_name] = [i._asdict() for i in value]
                        else:
                            d[attr_name] = value[:]
                    elif attr_type is dict:
                        d[attr_name] = dict(value)
            elif value is not NotSet:
                d[attr_name] = value
        return d
1075001
def override_attributes!(attrs={})
      @column_keys = attrs.keys
      @attrs = HashWithIndifferentAccess.new(Hash[attrs.map { |k, v| [ to_key(k), v ] }])
      @attrs.map { |k, v| define_accessor(k) }
    end
868895
def _clean_dict(target_dict, whitelist=None):
    
    assert isinstance(target_dict, dict)
    return {
        ustr(k).strip(): ustr(v).strip()
        for k, v in target_dict.items()
        if v not in (None, Ellipsis, [], (), "")
        and (not whitelist or k in whitelist)
    }
955362
def structure_attrs_fromdict(self, obj, cl):
        # type: (Mapping[str, Any], Type[T]) -> T
        """"""
        # For public use.
        conv_obj = {}  # Start with a fresh dict, to ignore extra keys.
        dispatch = self._structure_func.dispatch
        for a in cl.__attrs_attrs__:  # type: ignore
            # We detect the type by metadata.
            type_ = a.type
            name = a.name

            try:
                val = obj[name]
            except KeyError:
                continue

            if name[0] == "_":
                name = name[1:]

            conv_obj[name] = (
                dispatch(type_)(val, type_) if type_ is not None else val
            )

        return cl(**conv_obj)
255622
def strip_leading_underscores_from_keys(d: Dict) -> Dict:
    
    newdict = {}
    for k, v in d.items():
        if k.startswith('_'):
            k = k[1:]
            if k in newdict:
                raise ValueError("Attribute conflict: _{k}, {k}".format(k=k))
        newdict[k] = v
    return newdict
166492
def _wrap_attr(self, attrs, context=None):
        """"""
        for attr in attrs:
            if isinstance(attr, UnboundMethod):
                if _is_property(attr):
                    yield from attr.infer_call_result(self, context)
                else:
                    yield BoundMethod(attr, self)
            elif hasattr(attr, "name") and attr.name == "<lambda>":
                if attr.args.args and attr.args.args[0].name == "self":
                    yield BoundMethod(attr, self)
                    continue
                yield attr
            else:
                yield attr
61836
def remove_all_attributes(element, exclude=None):
    
    if exclude is None:
        exclude = []
    for k in element.attrib.keys():
        if k not in exclude:
            element.attrib.pop(k)
260804
def _set_attr(self, name, doc=None, preload=False):
        ""

        if doc is None:
            doc = 'The {name} attribute.'.format(name=name)

        if not hasattr(self._attr_func_, name):
            attr_prop = property(
                functools.partial(self._setable_get_, name),
                functools.partial(self._setable_set_, name),
                doc=doc
            )

        elif preload:
            func = getattr(self._attr_func_, name)
            setattr(self._attr_data_, name, func())
            delattr(self._attr_func_, name)
            attr_prop = property(
                functools.partial(self._simple_get_, name),
                doc=doc
            )

        else:
            attr_prop = property(
                functools.partial(self._loadable_get_, name),
                doc=doc
            )

        setattr(type(self), name, attr_prop)
3684
def attr(self, *args, **kwargs):
        """"""
        kwargs.update({k: bool for k in args})
        for key, value in kwargs.items():
            if key == "klass":
                self.attrs["klass"].update(value.split())
            elif key == "style":
                if isinstance(value, str):
                    splitted = iter(re.split(";|:", value))
                    value = dict(zip(splitted, splitted))
                self.attrs["style"].update(value)
            else:
                self.attrs[key] = value
        self._stable = False
        return self
1031474
function filterAttributes(obj) {
    var attribute;
    for (attribute in obj) {
        if (obj.hasOwnProperty(attribute)) {
            if (obj[attribute] === undefined || obj[attribute] === null) {
                delete obj[attribute];
            } else if (lodash.isString(obj[attribute])) {
                obj[attribute] = obj[attribute].quote();    // DO NOT quote type string. It is a JS variable.
            }
        }
    }
    return obj;
}
1164051
def _serialize_attributes(attributes):
    """"""
    result = ''
    for name, value in attributes.items():
        if not value:
            continue
        result += ' ' + _unmangle_attribute_name(name)
        result += '="' + escape(value, True) + '"'
    return result
192836
def attributes(cls):
        

        for k in dir(cls):
            v = getattr(cls, k)
            if isinstance(v, Attribute):
                yield k,v
718751
def dumb_property_dict(style):
    """"""
    return dict([(x.strip(), y.strip()) for x, y in [z.split(':', 1) for z in style.split(';') if ':' in z]]);
1332554
def get_attrs(obj):
    """"""
    if not hasattr(obj, '__dict__'):
        return []  # slots only
    proxy_type = types.MappingProxyType if six.PY3 else types.DictProxyType
    if not isinstance(obj.__dict__, (dict, proxy_type)):
        print(type(obj.__dict__), obj)
        raise TypeError("%s.__dict__ is not a dictionary" % obj.__name__)
    return obj.__dict__.keys()