'
Called by a proxy to lookup single object reference. The proxy knows
the schema name so the hold does not need to bother storing it.
775456
public Object getObjectReference(String field, String schemaName) {
        List<String> instanceIds = references.get(field);
        if(instanceIds == null || instanceIds.size() == 0) {
            return null;
        }
        String instanceId = instanceIds.get(0);
        if(instanceId == null) {
            return null;
        }
        BeanId id = BeanId.create(instanceId, schemaName);
        Object instance = instances.get(id);
        if(instance != null) {
            return instance;
        }
        instance = cache.get(id);
        instances.put(id, instance);
        return instance;
    }
9177
public final Object handleGetObject(String key) {
        // lazily load the lookup hashtable.
        if (lookup == null) {
            loadLookup();
        }
        if (key == null) {
            throw new NullPointerException();
        }
        return lookup.get(key); // this class ignores locales
    }
133583
function lookup(name){
  utils.assertType(name, 'string', 'name');
  var node = this.lookup(name.val);
  if (!node) return nodes.null;
  return this.visit(node);
}
946576
public S getSchemaByKey(K key) throws SchemaRegistryException {
    try {
      return cachedSchemasByKeys.get(key);
    } catch (ExecutionException e) {
      throw new SchemaRegistryException(String.format("Schema with key %s cannot be retrieved", key), e);
    }
  }
82922
def _load_referenced_schema_from_properties(val, a_scheme, a_property):
    
    scheme = copy.copy(a_scheme)
    if _value_properties_are_referenced(val):
        ref_schema_uri = val['properties']['$ref']
        sub_schema = load_ref_schema(ref_schema_uri)
        ## dereference the sub schema
        sub_schema_copy_level_0 = copy.deepcopy(sub_schema)

        # nesting level 1
        # @TODO: NEEDS REFACTOR
        for prop_0 in sub_schema_copy_level_0['properties']:
            val_0 = sub_schema_copy_level_0['properties'][prop_0]
            # arrays may contain the nesting
            is_type_array_0 = (val_0['type'] == 'array')
            is_type_object_0 = (val_0['type'] == 'object')
            if ((is_type_array_0 or is_type_object_0)
                and (_value_properties_are_referenced(val_0))):
                # found a nested  thingy
                sub_schema_copy_level_1 = _load_referenced_schema_from_properties(val_0, sub_schema_copy_level_0,
                                                                                  prop_0)
                ###
                # one more loop level
                ###
                for prop_1 in sub_schema_copy_level_1['properties']:
                    val_1 = sub_schema_copy_level_1['properties'][prop_1]
                    is_type_array_1 = (val_1['type'] == 'array')
                    is_type_object_1 = (val_1['type'] == 'object')
                    if ((is_type_array_1 or is_type_object_1) and
                            (_value_properties_are_referenced(val_1))):
                        ### need to figure out a better way for loading
                        # the referenced stuff
                        # found a nested  thingy
                        # sub_schema_copy_level_2 = _load_referenced_schema_from_properties(val_1, sub_schema_copy_level_1, prop_1)
                        raise SalesKingException("too much nesting in the schemes")

            if _value_is_required(val_0):
                # remove required
                sub_schema_copy_level_0['properties'][prop_0]['required'] = False
            # hack to bypass text format valitation to string
            if _value_is_type_text(val_0):
                log.debug("patched text to string")
                sub_schema_copy_level_0['properties'][prop_0]['type'] = u"string"


        # outer scheme
        scheme['properties'][a_property]['properties'] = sub_schema_copy_level_0['properties']

    return scheme
587345
def get_object(conn, binding_name, object_cls):
        
        try:
            obj = conn.rootContext.resolve(binding_name)
            narrowed = obj._narrow(object_cls)
        except CORBA.TRANSIENT:
            raise IOError('Attempt to retrieve object failed')

        if narrowed is None:
            raise IOError('Attempt to retrieve object got a different class of object')

        return narrowed
494414
function ReferencedIdentifier(node, parent, scope, state) {
    // we can't guarantee the purity of arguments
    if (node.name === "arguments") {
      state.deopted = true;
    }

    // is this a referenced identifier and is it referencing the rest parameter?
    if (node.name !== state.name) return;

    if (state.noOptimise) {
      state.deopted = true;
    } else {
      if (this.parentPath.isMemberExpression({ computed: true, object: node })) {
        // if we know that this member expression is referencing a number then we can safely
        // optimise it
        var prop = this.parentPath.get("property");
        if (prop.isBaseType("number")) {
          state.candidates.push(this);
          return;
        }
      }

      // optimise single spread args in calls
      if (this.parentPath.isSpreadElement() && state.offset === 0) {
        var call = this.parentPath.parentPath;
        if (call.isCallExpression() && call.node.arguments.length === 1) {
          state.candidates.push(this);
          return;
        }
      }

      state.references.push(this);
    }
  }
579204
function (schema, refResolver) {

                logger.debug("Creating reader for schema", schema);

                if (!refResolver) {
                    refResolver = new AmdResolver({path: "", altSeparator: "\\.", synchronous: true}).resolver;
                }

                this.smd = schema;

                //finds all $ref instances and replaces with the actual object
                //similar to dojox.json.ref.resolveJson, but doesn't get hung up on circular references
                //TODO: should we assume all schemas have been resolved prior, and remove this step?
                function resolveRef(subobj, parent, parentKey) {
                    if (!subobj.resolved) {
                        Object.keys(subobj).forEach(function (key) {
                            var Ref, value = subobj[key];
                            if (key === "$ref") {
                                logger.debug("Resolving $ref: " + value);
                                Ref = refResolver(value);
                                value = typeof Ref === 'function' ? new Ref() : Ref;
                                if (!util.isUndefined(value) && !value.resolved) {
                                    subobj.resolved = true;
                                    resolveRef(value, subobj, key);
                                }
                                parent[parentKey] = value;
                            } else if (typeof value === "object") {
                                resolveRef(value, subobj, key);
                            }
                        });
                    }
                }

                function getExtendedProperties(obj, props) {
                    var parent = (obj && obj["extends"]), propsObj = [], items = [], itemProps;

                    if (typeof parent !== "undefined") {

                        items = util.isArray(parent) ? parent : [parent]; //can be multiple-inheritance

                        items.forEach(function (item) {
                            itemProps = item.properties || {};
                            Object.keys(itemProps).forEach(function (key) {
                                var value = item.properties[key];
                                if (key !== "__parent") {
                                    propsObj.push({
                                        parentId: item.id,
                                        key: key,
                                        value: value
                                    });
                                }
                            });

                        }, this); // jshint ignore:line

                        props.push(propsObj);
                        props = getExtendedProperties(parent, props);
                    }

                    return props;

                }

                //looks in JSONSchema objects for "extends" and copies properties to children
            function resolveExtensions(schema) {

                var xprops, props;

                xprops = getExtendedProperties(schema, []);

                //unwind the property stack so that the earliest gets inheritance link
                schema.properties = schema.properties || {};
                function copyprop(item) { //util to get around jslint complaints about doing this directly in loop
                    schema.properties[item.key] = item.val;
                }

                while (xprops.length > 0) {
                    props = xprops.pop();
                    props.forEach(copyprop);
                }
            }

            // mix-in parameters for extended schemas
            function resolveExtendedParameters(obj) {

                // assume all references are resolved, just copy parameters down the
                // inheritence chain. If I am derived check base first.
                if (obj["extends"]) {
                    resolveExtendedParameters(obj["extends"]);
                    obj.parameters = obj.parameters || [];
                    obj.parameters = obj.parameters.concat(obj["extends"].parameters);
                }
            }

            //copies properties from parent as defaults, as well as extensions for params
            function resolveProperties(schema) {

                logger.debug("Resolving sub-properties for " + schema.id);

                // resolve inherited global parameters
                resolveExtendedParameters(schema);

                Object.keys(schema.services || {}).forEach(function (key) {
                    var value = schema.services[key];
                    //value.target = value.target ? schema.target + value.target : schema.target; //TODO: should this build concat paths? that is currently handled in getServiceUrl function
                    value.returns = value.returns || schema.returns;
                    value.transport = value.transport || schema.transport;
                    value.contentType = value.contentType || schema.contentType;
                    value.envelope = value.envelope || schema.envelope || "URL";
                    value.description = value.description || "";

                    if (value.returns) {
                        resolveExtensions(value.returns);
                    }

                    if (value.parameters) {
                        value.parameters.forEach(function (item) {
                            item.envelope = item.envelope || value.envelope;
                            item.description = item.description || "";
                        });
                    }


                    var ext = value["extends"];

                    if (ext) {

                        //resolution hasn't been completed or extends object isn't proper JSONSchema
                        if (!ext.id) {
                            throw new Error("Parent schema for method [" + key + "] in schema " + schema.id + " is invalid.");
                        }

                        //TODO: resolveExtensions for params object properties? not really needed yet (the name is fine for now...)
                        if (!value.parameters) {
                            value.parameters = ext.parameters;
                        } else {
                            value.parameters = value.parameters.concat(ext.parameters);
                        }
                    }
                });

                if (!schema.tag) {
                    schema.tag = {};
                }
                schema.tag.resolved = true;
                schema.resolvedProperties = true;
            }

            //if a schema has already been resolved, don't do it again - we can get into endless recursion
            if (!schema.resolved) {
                resolveRef(schema, null, null);
                schema.resolved = true;
            }

            //only resolve these once, or else our concats will be a problem
            if (!schema.resolvedProperties) {
                resolveProperties(schema);
            }

            var hash = {};

            //index params array by name for lookup
            hash.parameters = {};
            this.getMethodNames().forEach(function (methodName) {
                var service = this.smd.services[methodName];
                if (service.parameters) {
                    service.parameters.forEach(function (parameter) {
                        hash[methodName + "-" + parameter.name] = parameter;
                    });
                }
            }, this);

            this.findParameter = function (methodName, parameterName) {
                return hash[methodName + "-" + parameterName];
            };

        }
327370
def schema_exists(cls, cur, schema_name):
        
        cur.execute("SELECT EXISTS (SELECT schema_name FROM information_schema.schemata WHERE schema_name = '{0}');"
                    .format(schema_name))
        return cur.fetchone()[0]
1126410
def get(self, instance, **kwargs):
        
        # The default value
        default = self.getDefault(instance)

        # Retrieve the proxy object
        proxy_object = self.get_proxy(instance)

        # Return None if we could not find a proxied object, e.g. through
        # the proxy expression 'context.getSample()' on an AR
        if proxy_object is None:
            logger.debug("Expression '{}' did not return a valid Proxy Object on {}"
                         .format(self.proxy, instance))
            return default

        # Lookup the proxied field by name
        field_name = self.getName()
        field = proxy_object.getField(field_name)

        # Bail out if the proxy object has no identical named field
        if field is None:
            raise KeyError("Object '{}' with id '{}' has no field named '{}'".format(
                proxy_object.portal_type, proxy_object.getId(), field_name))

        # return the value of the proxy field
        return field.get(proxy_object)
107782
@Override
    public Object lookup(String s) throws NamingException {
        if (s == null)
            throw new InvalidNameException();
        //turn the String into a CompositeName and then use the Name form of the method
        //all necessary parsing etc will be done there
        return lookup(newCompositeName(s));
    }
233331
function lookupDescriptor(proto, key) {
		if (proto.hasOwnProperty(key)) {
			return Object.getOwnPropertyDescriptor(proto, key);
		} else if ((proto = Object.getPrototypeOf(proto))) {
			return lookupDescriptor(proto, key);
		} else {
			return null;
		}
	}
1361586
public void store(Object obj) throws PersistenceBrokerException
    {
        obj = extractObjectToStore(obj);
        // only do something if obj != null
        if(obj == null) return;

        ClassDescriptor cld = getClassDescriptor(obj.getClass());
        /*
        if one of the PK fields was null, we assume the objects
        was new and needs insert
        */
        boolean insert = serviceBrokerHelper().hasNullPKField(cld, obj);
        Identity oid = serviceIdentity().buildIdentity(cld, obj);
        /*
        if PK values are set, lookup cache or db to see whether object
        needs insert or update
        */
        if (!insert)
        {
            insert = objectCache.lookup(oid) == null
                && !serviceBrokerHelper().doesExist(cld, oid, obj);
        }
        store(obj, oid, cld, insert);
    }
1363265
def known(self, node):
        
        ref = node.get('type', Namespace.xsins)
        if ref is None:
            return None
        qref = qualify(ref, node, node.namespace())
        query = BlindQuery(qref)
        return query.execute(self.schema)
1250097
function lookupObject(key) {
	var obj = snapshot.heap[key];
	if (!obj) {
		throw new Error("Missing object with key " + key)
	}
	return obj;
}
66579
def access(self, name: str, rename: Optional[str] = None) -> 'ProxyAttr':
        
        self.getter(name, rename)
        self.setter(name, rename)
        return self
1078201
def lookup_schema(schema_key)
      lookup_time = Time.now.getutc
      if schema_key.is_a?(String)
        schema_key = SchemaKey.parse_key(schema_key)
      end
      failures = []

      cache_result = @cache[schema_key]
      if not cache_result.nil?
        if not @cacheTtl.nil?
          store_time = cache_result[1]
          time_diff = (lookup_time - store_time).round
          if time_diff >= @cacheTtl
            @cache.delete(schema_key)
            cache_result = nil
          else
            return cache_result[0]
          end
        else
          return cache_result[0]
        end
      end

      if cache_result.nil?          # Fetch from every registry
        for registry in prioritize_repos(schema_key, @registries) do
          begin
            lookup_result = registry.lookup_schema(schema_key)
          rescue StandardError => e
            failures.push(Registries::LookupFailure.new(registry.config.name, e))
          else
            if lookup_result.nil?
              failures.push(Registries::NotFound.new(registry.config.name))
            else
              break
            end
          end
        end

        if lookup_result.nil?
          raise Registries::ResolverError.new(failures, schema_key)
        else
          store_time = Time.now.getutc
          @cache[schema_key] = [lookup_result, store_time]
          lookup_result
        end
      end
    end