Utility method to find the overridden setter function for a given property, or generate a new one

    :param object_type:
    :param property_name:
    :param property_type:
    :param private_property_name:
    :return:
175334
def _get_setter_fun(object_type,           # type: Type
                    parameter,             # type: Parameter
                    private_property_name  # type: str
                    ):
    
    # the property will have the same name than the constructor argument
    property_name = parameter.name

    overridden_setters = getmembers(object_type, _has_annotation(__SETTER_OVERRIDE_ANNOTATION, property_name))

    if len(overridden_setters) > 0:
        # --check that we only have one
        if len(overridden_setters) > 1:
            raise DuplicateOverrideError('Setter is overridden more than once for attribute name : %s' % property_name)

        # --use the overridden setter
        setter_fun = overridden_setters[0][1]

        try:
            # python 2
            setter_fun = setter_fun.im_func
        except AttributeError:
            pass

        # --find the parameter name and check the signature
        s = signature(setter_fun)
        p = [attribute_name for attribute_name, param in s.parameters.items() if attribute_name is not 'self']
        if len(p) != 1:
            try:
                qname = setter_fun.__qualname__
            except AttributeError:
                qname = setter_fun.__name__
            raise IllegalSetterSignatureException('overridden setter must have only 1 non-self argument, found ' +
                                                  '%s for function %s'
                                                  '' % (len(s.parameters.items()) - 1, qname))
        var_name = p[0]

    else:
        # --create the setter, equivalent of:
        # ** Dynamically compile a wrapper with correct argument name **
        sig = Signature(parameters=[Parameter('self', kind=Parameter.POSITIONAL_OR_KEYWORD), parameter])

        @with_signature(sig)
        def autoprops_generated_setter(self, **kwargs):
            setattr(self, private_property_name, kwargs.popitem()[1])

        setter_fun = autoprops_generated_setter
        var_name = property_name

    return setter_fun, var_name
778010
function findPrototypeForProperty(object,property){
    while(false==object.hasOwnProperty(property)){
        object = Object.getPrototypeOf(object);
    }
    return object;
}
38311
function(bool_return_object) {
                    var obj = { __joii_type: this.__joii__.name };

                    for (var key in this.__joii__.metadata) {
                        var val = this.__joii__.metadata[key];

                        if (val.serializable) {
                            
                            var getter_name = JOII.GenerateGetterName(val);
                            var currentValue = null;
                            if (typeof (this[getter_name]) === 'function') {
                                // use getter if it exists. This allows custom getters to translate the data properly if needed.
                                currentValue = this[getter_name]();
                            } else {
                                currentValue = this[val.name];
                            }

                            if (!val.is_enum && typeof (currentValue) === 'object' && currentValue !== null) {
                                if ('serialize' in currentValue) {
                                    obj[val.name] = currentValue.serialize(true);
                                } else {
                                    obj[val.name] = JOII.Compat.flattenObject(currentValue);
                                }
                            } else {
                                obj[val.name] = currentValue;
                            }
                        }
                    }

                    return obj;
                }
369073
function simple_setters (setters) {
        // loop over the setter keys and make a mutation for each
        return Object.keys(setters).reduce(function (mutations, name) {

            // attach our new mutation to result
            return Object.assign({}, mutations, defineProperty({}, name, function (state, value) {

                // if the setter name has a dot, then resolve the
                // state path before feeding our value into it.
                if (setters[name].indexOf('.') > -1) {
                    var obj = setters[name].split('.');
                    var key = obj.pop();

                    resolveObjectPath(state, obj)[key] = value;
                }

                // otherwise, just set the state to our value
                else state[setters[name]] = value;
            }));
        }, {});
    }
223050
def record_set_properties(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/setProperties' % object_id, input_params, always_retry=always_retry, **kwargs)
254298
def _field_property_generator(self, public_properties):
        
        # Local variable, to avoid messing with "self"
        stored_instance = self._ipopo_instance

        # Choose public or hidden properties
        # and select the method to call to notify about the property update
        if public_properties:
            properties = stored_instance.context.properties
            update_notifier = stored_instance.update_property
        else:
            # Copy Hidden properties and remove them from the context
            properties = stored_instance.context.grab_hidden_properties()
            update_notifier = stored_instance.update_hidden_property

        def get_value(_, name):
            """
            Retrieves the property value, from the iPOPO dictionaries

            :param name: The property name
            :return: The property value
            """
            return properties.get(name)

        def set_value(_, name, new_value):
            """
            Sets the property value and trigger an update event

            :param name: The property name
            :param new_value: The new property value
            """
            assert stored_instance.context is not None

            # Get the previous value
            old_value = properties.get(name)
            if new_value != old_value:
                # Change the property
                properties[name] = new_value

                # New value is different of the old one, trigger an event
                update_notifier(name, old_value, new_value)

            return new_value

        return get_value, set_value
1038929
def get_property(self):
        """"""
        scope = self

        def fget(self):
            """Call dynamic function then validate output"""
            scope.display_warning()
            return getattr(self, scope.new_name)

        def fset(self, value):
            """Validate and call setter"""
            scope.display_warning()
            setattr(self, scope.new_name, value)

        def fdel(self):
            """call deleter"""
            scope.display_warning()
            delattr(self, scope.new_name)

        return property(fget=fget, fset=fset, fdel=fdel, doc=scope.sphinx())
632518
def class_for_type(self, object_type):
        
        if object_type not in self.class_mapping:
            raise ZenpyException("Unknown object_type: " + str(object_type))
        else:
            return self.class_mapping[object_type]
547803
def get_setter(cls, prop_name,  # @NoSelf
                   user_setter=None, setter_takes_name=False,
                   user_getter=None, getter_takes_name=False):
        """"""

        _inner_setter = ObservablePropertyMeta.get_setter(cls, prop_name,
                                            user_setter, setter_takes_name,
                                            user_getter, getter_takes_name)

        def _setter(self, val):
            self._prop_lock.acquire()
            _inner_setter(self, val)
            self._prop_lock.release()
        return _setter
31993
private boolean isPropertyDeclaredConstant(
      ObjectType objectType, String prop) {
    if (enforceCodingConventions
        && compiler.getCodingConvention().isConstant(prop)) {
      return true;
    }
    for (; objectType != null; objectType = objectType.getImplicitPrototype()) {
      JSDocInfo docInfo = objectType.getOwnPropertyJSDocInfo(prop);
      if (docInfo != null && docInfo.isConstant()) {
        return true;
      }
    }
    return false;
  }
74405
def resettable_cached_property(func):
    

    def wrapper(self):
        if not hasattr(self, '_resettable_cached_properties'):
            self._resettable_cached_properties = {}
        if func.__name__ not in self._resettable_cached_properties:
            self._resettable_cached_properties[func.__name__] = func(self)
        return self._resettable_cached_properties[func.__name__]

    # Returns a property whose getter is the 'wrapper' function
    return property(wrapper)
964213
def _get_object_owner(name,
        object_type,
        prepend='public',
        maintenance_db=None,
        user=None,
        host=None,
        port=None,
        password=None,
        runas=None):
    '''
    
    '''
    if object_type == 'table':
        query = (' '.join([
            'SELECT tableowner AS name',
            'FROM pg_tables',
            "WHERE schemaname = '{0}'",
            "AND tablename = '{1}'"
        ])).format(prepend, name)
    elif object_type == 'sequence':
        query = (' '.join([
            'SELECT rolname AS name',
            'FROM pg_catalog.pg_class c',
            'JOIN pg_roles r',
            'ON c.relowner = r.oid',
            'JOIN pg_catalog.pg_namespace n',
            'ON n.oid = c.relnamespace',
            "WHERE relkind='S'",
            "AND nspname='{0}'",
            "AND relname = '{1}'",
        ])).format(prepend, name)
    elif object_type == 'schema':
        query = (' '.join([
            'SELECT rolname AS name',
            'FROM pg_namespace n',
            'JOIN pg_roles r',
            'ON n.nspowner = r.oid',
            "WHERE nspname = '{0}'",
        ])).format(name)
    elif object_type == 'function':
        query = (' '.join([
            'SELECT proname AS name',
            'FROM pg_catalog.pg_proc p',
            'JOIN pg_catalog.pg_namespace n',
            'ON n.oid = p.pronamespace',
            "WHERE nspname = '{0}'",
            "AND p.oid::regprocedure::text = '{1}'",
            'ORDER BY proname, proargtypes',
        ])).format(prepend, name)
    elif object_type == 'tablespace':
        query = (' '.join([
            'SELECT rolname AS name',
            'FROM pg_tablespace t',
            'JOIN pg_roles r',
            'ON t.spcowner = r.oid',
            "WHERE spcname = '{0}'",
        ])).format(name)
    elif object_type == 'language':
        query = (' '.join([
            'SELECT rolname AS name',
            'FROM pg_language l',
            'JOIN pg_roles r',
            'ON l.lanowner = r.oid',
            "WHERE lanname = '{0}'",
        ])).format(name)
    elif object_type == 'database':
        query = (' '.join([
            'SELECT rolname AS name',
            'FROM pg_database d',
            'JOIN pg_roles r',
            'ON d.datdba = r.oid',
            "WHERE datname = '{0}'",
        ])).format(name)

    rows = psql_query(
        query,
        runas=runas,
        host=host,
        user=user,
        port=port,
        maintenance_db=maintenance_db,
        password=password)
    try:
        ret = rows[0]['name']
    except IndexError:
        ret = None

    return ret
925066
def get_object_name(object):
    

    if type(object) is property:
        return object.fget.__name__
    elif hasattr(object, "__name__"):
        return object.__name__
    elif hasattr(object, "__class__"):
        return object.__class__.__name__
    else:
        return NULL_OBJECT_NAME
463487
def add_property(attribute, type):
    
    def decorator(cls):
        """Decorator
        """
        private = "_" + attribute

        def getAttr(self):
            """Property getter
            """
            if getattr(self, private) is None:
                setattr(self, private, type())
            return getattr(self, private)

        def setAttr(self, value):
            """Property setter
            """
            setattr(self, private, value)

        setattr(cls, attribute, property(getAttr, setAttr))
        setattr(cls, private, None)
        return cls

    return decorator
1357342
function (localConfig, propertyName, propertyObject) {
    var presetCheck = defaultConfig.presets[propertyName][propertyObject];
    if (presetCheck) return $.extend(true, {}, presetCheck, localConfig);
    return localConfig
  }
1083043
def object_type_repr(obj):
    
    if obj is None:
        return 'None'
    elif obj is Ellipsis:
        return 'Ellipsis'
    if obj.__class__.__module__ == '__builtin__':
        name = obj.__class__.__name__
    else:
        name = obj.__class__.__module__ + '.' + obj.__class__.__name__
    return '%s object' % name
1317467
function (obj) {
    return {
        getOwnPropertyDescriptor: function (name) {
            var desc = Object.getOwnPropertyDescriptor(obj, name);
            // a trapping proxy's properties must always be configurable
            if (desc !== undefined) {
                desc.configurable = true;
            }
            return desc;
        },
        getPropertyDescriptor: function (name) {
            var desc = Object.getPropertyDescriptor(obj, name); // not in ES5
            // a trapping proxy's properties must always be configurable
            if (desc !== undefined) {
                desc.configurable = true;
            }
            return desc;
        },
        getOwnPropertyNames: function () {
            return Object.getOwnPropertyNames(obj);
        },
        getPropertyNames: function () {
            return Object.getPropertyNames(obj);                // not in ES5
        },
        defineProperty: function (name, desc) {
            Object.defineProperty(obj, name, desc);
        },
        delete: function (name) {
            return delete obj[name];
        },
        fix: function () {
            if (Object.isFrozen(obj)) {
                var result = {};
                Object.getOwnPropertyNames(obj).forEach(function (name) {
                    result[name] = Object.getOwnPropertyDescriptor(obj, name);
                });
                return result;
            }
            // As long as obj is not frozen, the proxy won't allow itself to be fixed
            return undefined; // will cause a TypeError to be thrown
        },

        has: function (name) {
            return name in obj;
        },
        hasOwn: function (name) {
            return ({}).hasOwnProperty.call(obj, name);
        },
        get: function (receiver, name) {
            return obj[name];
        },
        set: function (receiver, name, val) {
            obj[name] = val;
            return true;
        }, // bad behavior when set fails in non-strict mode
        enumerate: function () {
            var result = [];
            for (var name in obj) {
                result.push(name);
            }
            return result;
        },
        keys: function () {
            return Object.keys(obj);
        }

    };
}