Prepares an object map of variables of the correct type based on the provided variable definitions and arbitrary input.
    If the input cannot be parsed to match the variable definitions, a GraphQLError will be thrown.
482651
def get_variable_values(
    schema,  # type: GraphQLSchema
    definition_asts,  # type: List[VariableDefinition]
    inputs,  # type: Any
):
    # type: (...) -> Dict[str, Any]
    """"""
    if inputs is None:
        inputs = {}

    values = {}
    for def_ast in definition_asts:
        var_name = def_ast.variable.name.value
        var_type = type_from_ast(schema, def_ast.type)
        value = inputs.get(var_name)

        if not is_input_type(var_type):
            raise GraphQLError(
                'Variable "${var_name}" expected value of type "{var_type}" which cannot be used as an input type.'.format(
                    var_name=var_name, var_type=print_ast(def_ast.type)
                ),
                [def_ast],
            )
        elif value is None:
            if def_ast.default_value is not None:
                values[var_name] = value_from_ast(
                    def_ast.default_value, var_type
                )  # type: ignore
            if isinstance(var_type, GraphQLNonNull):
                raise GraphQLError(
                    'Variable "${var_name}" of required type "{var_type}" was not provided.'.format(
                        var_name=var_name, var_type=var_type
                    ),
                    [def_ast],
                )
        else:
            errors = is_valid_value(value, var_type)
            if errors:
                message = u"\n" + u"\n".join(errors)
                raise GraphQLError(
                    'Variable "${}" got invalid value {}.{}'.format(
                        var_name, json.dumps(value, sort_keys=True), message
                    ),
                    [def_ast],
                )
            coerced_value = coerce_value(var_type, value)
            if coerced_value is None:
                raise Exception("Should have reported error.")

            values[var_name] = coerced_value

    return values
39310
@SuppressWarnings("rawtypes")
    public static Map<TypeVariable, Type> getTypeVariableMap(Class<?> clazz) {
        Map<TypeVariable, Type> typeVariableMap = new HashMap<TypeVariable, Type>();
        buildTypeVariableMap(ResolvableType.forClass(clazz), typeVariableMap);

        return typeVariableMap;
    }
1025402
private Map<String, JSType> buildTypeVariables(
      Map<TemplateType, JSType> inferredTypes) {
    Map<String, JSType> typeVars = new LinkedHashMap<>();
    for (Entry<TemplateType, JSType> e : inferredTypes.entrySet()) {
      // Only add the template type that do not have a type transformation
      if (!e.getKey().isTypeTransformation()) {
        typeVars.put(e.getKey().getReferenceName(), e.getValue());
      }
    }
    return typeVars;
  }
200836
function processInputObjectType(object: GraphQLInputObjectType) {
  return reduce(object._typeConfig, (def, value, key) => {
    if (value !== undefined) {
      switch (key) {
        case 'fields':
          def.fields = reduce(object.getFields(), (fields, field, name) => {
            fields[name] = processArg(field).arg;
            return fields;
          }, Object.create(null));
          break;
        case 'description':
          set(def, key, value, (value !== ''));
          break;
        case 'astNode':
          const directives = extractDirectives(get(object, [ 'astNode' ]));
          set(def, '@directives', directives, Boolean(directives));
          break;
        default:
          break;
      }
    }
    return def;
  }, {
    type: 'Input'
  });
}
534082
private static Type[] extractTypeArgumentsFrom(final Map<TypeVariable<?>, Type> mappings, final TypeVariable<?>[] variables) {
        final Type[] result = new Type[variables.length];
        int index = 0;
        for (final TypeVariable<?> var : variables) {
            Validate.isTrue(mappings.containsKey(var), "missing argument mapping for %s", toString(var));
            result[index++] = mappings.get(var);
        }
        return result;
    }
1297001
def _expect_vars(vs=None):
        """"""
        if vs is None:
            return list()
        elif isinstance(vs, Variable):
            return [vs]
        else:
            checked = list()
            # Will raise TypeError if vs is not iterable
            for v in vs:
                if isinstance(v, Variable):
                    checked.append(v)
                else:
                    fstr = "expected Variable, got {0.__name__}"
                    raise TypeError(fstr.format(type(v)))
            return checked
979040
def complete_object_value(
        self,
        return_type: GraphQLObjectType,
        field_nodes: List[FieldNode],
        info: GraphQLResolveInfo,
        path: ResponsePath,
        result: Any,
    ) -> AwaitableOrValue[Dict[str, Any]]:
        """"""
        # If there is an `is_type_of()` predicate function, call it with the current
        # result. If `is_type_of()` returns False, then raise an error rather than
        #  continuing execution.
        if return_type.is_type_of:
            is_type_of = return_type.is_type_of(result, info)

            if isawaitable(is_type_of):

                async def collect_and_execute_subfields_async():
                    if not await is_type_of:
                        raise invalid_return_type_error(
                            return_type, result, field_nodes
                        )
                    return self.collect_and_execute_subfields(
                        return_type, field_nodes, path, result
                    )

                return collect_and_execute_subfields_async()

            if not is_type_of:
                raise invalid_return_type_error(return_type, result, field_nodes)

        return self.collect_and_execute_subfields(
            return_type, field_nodes, path, result
        )
1263206
def allowed_variable_usage(
    schema: GraphQLSchema,
    var_type: GraphQLType,
    var_default_value: Optional[ValueNode],
    location_type: GraphQLType,
    location_default_value: Any,
) -> bool:
    
    if is_non_null_type(location_type) and not is_non_null_type(var_type):
        has_non_null_variable_default_value = var_default_value and not isinstance(
            var_default_value, NullValueNode
        )
        has_location_default_value = location_default_value is not INVALID
        if not has_non_null_variable_default_value and not has_location_default_value:
            return False
        location_type = cast(GraphQLNonNull, location_type)
        nullable_location_type = location_type.of_type
        return is_type_sub_type_of(schema, var_type, nullable_location_type)
    return is_type_sub_type_of(schema, var_type, location_type)
88878
def collect_variables(self, g_scope='gen', d_scope='discrim'):
        
        self.g_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, g_scope)
        assert self.g_vars
        self.d_vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, d_scope)
        assert self.d_vars
697325
public Assignment mapVariables(Map<Integer, Integer> varMap) {
    int[] newVarNums = new int[vars.length];
    Object[] newValues = new Object[vars.length];

    int numFilled = 0;
    for (int i = 0; i < vars.length; i++) {
      if (varMap.containsKey(vars[i])) {
        newVarNums[numFilled] = varMap.get(vars[i]);
        newValues[numFilled] = values[i];
        numFilled++;
      }
    }
    
    if (numFilled < newVarNums.length) {
      newVarNums = Arrays.copyOf(newVarNums, numFilled);
      newValues = Arrays.copyOf(newValues, numFilled);
    }
    return Assignment.fromUnsortedArrays(newVarNums, newValues);
  }
1348760
def _defineVariables(self):
        
        logger.info('Catalog contains %i objects'%(len(self.data)))

        mc_source_id_field = self.config['catalog']['mc_source_id_field']
        if mc_source_id_field is not None:
            if mc_source_id_field not in self.data.dtype.names:
                array = np.zeros(len(self.data),dtype='>i8') # FITS byte-order convention
                self.data = mlab.rec_append_fields(self.data,
                                                   names=mc_source_id_field,
                                                   arrs=array)
            logger.info('Found %i simulated objects'%(np.sum(self.mc_source_id>0)))
376894
function MapObjectRW(ktype, vtype) {
    this.ktype = ktype;
    this.vtype = vtype;

    if (this.vtype.rw.width) {
        this.poolByteLength = this.mapVarFixbyteLength;
    }

    bufrw.Base.call(this);
}
332376
private static void validateReservedVariableNames( Graph graph, List<String> errors ){
        for( Node node : graph.getNodes() ){
            if( node instanceof BeanAsyncCallActivity ){
                validateReservedVariablesFromMapping( ((BeanAsyncCallActivity)node).getResultMapping(), graph, node, errors );
            }
            else if( node instanceof BeanCallActivity ){
                validateReservedVariablesFromMapping( ((BeanCallActivity)node).getResultMapping(), graph, node, errors );
            }
            else if( node instanceof CreateNewInstanceActivity ){
                MapMapping mapMapping = ((CreateNewInstanceActivity)node).getArgumentsMapping();
                if( mapMapping != null && mapMapping.getEntryMappings() != null ){
                    for( String key : mapMapping.getEntryMappings().keySet() ){
                        validateReservedVariable( key, graph, node, errors );
                    }
                }
            }
            else if( node instanceof HumanTaskActivity ){
                validateReservedVariablesFromMapping( ((HumanTaskActivity)node).getResultMapping(), graph, node, errors );
            }
            else if( node instanceof ObjectCallActivity ){
                validateReservedVariablesFromMapping( ((ObjectCallActivity)node).getResultMapping(), graph, node, errors );
            }
            else if( node instanceof SetAttributeActivity ){
                validateReservedVariable( ((SetAttributeActivity)node).getAttribute(), graph, node, errors );
            }
            else if( node instanceof CatchSignal ){
                validateReservedVariablesFromMapping( ((CatchSignal)node).getResultMapping(), graph, node, errors );
            }
        }
    }
573105
@SafeVarargs
  private final Map<String, FieldSpec> buildConditionFields(Map<String, PluralData>... pluralMaps) {
    Map<String, FieldSpec> index = new LinkedHashMap<>();
    int seq = 0;

    for (Map<String, PluralData> pluralMap : pluralMaps) {
      for (Map.Entry<String, PluralData> entry : pluralMap.entrySet()) {
        PluralData data = entry.getValue();

        // Iterate over the rules, drilling into the OR conditions and
        // building a field to evaluate each AND condition.
        for (Map.Entry<String, PluralData.Rule> rule : data.rules().entrySet()) {
          Node<PluralType> orCondition = rule.getValue().condition;
          if (orCondition == null) {
            continue;
          }

          // Render the representation for each AND condition, using that as a
          // key to map to the corresponding lambda Condition field that
          // computes it.
          for (Node<PluralType> andCondition : orCondition.asStruct().nodes()) {
            String repr = PluralRulePrinter.print(andCondition);
            if (index.containsKey(repr)) {
              continue;
            }

            // Build the field that represents the evaluation of the AND condition.
            FieldSpec field = buildConditionField(seq, andCondition.asStruct());
            index.put(repr, field);
            seq++;
          }
        }
      }
    }
    return index;
  }
193521
function processObjectType(object: GraphQLObjectType) {
  return reduce(
    object._typeConfig,
    (def, value, key) => {
      return setDef(
        def,
        key,
        value,
        [
          'description',
          'interfaces',
          'fields',
          'isTypeOf',
          'astNode',
          'onConflict',
        ],
        object,
      );
    },
    { type: 'Object' },
    true,
  );
}
3727
private static void buildMatchVariables(
      TypeSpec.Builder type, Map<String, Set<String>> territoryData, LanguageMatchingData data) {
    
    Map<String, Set<String>> territories = flatten(territoryData);
    
    CodeBlock.Builder code = CodeBlock.builder();
    code.add("new $T<$T, $T<$T>>() {{\n", HASHMAP, STRING, SET, STRING);
    for (Map.Entry<String, Set<String>> entry : territories.entrySet()) {
      code.add("  put($S, new $T<>(", entry.getKey(), HASHSET);
      List<String> list = new ArrayList<>(entry.getValue());
      Collections.sort(list);
      addStringList(code, list, "    ");
      code.add("));\n");
    }
    code.add("\n}}");
    
    TypeName typeName = ParameterizedTypeName.get(MAP, STRING, SET_STRING);
    type.addField(FieldSpec.builder(typeName, "TERRITORIES", PROTECTED, STATIC, FINAL)
        .initializer(code.build())
        .build());

    // Generate mapping for each variable and its inverse.
    Map<String, Set<String>> variables = new LinkedHashMap<>();
    
    for (Pair<String, String> pair : data.matchVariables) {
      String variable = pair._1;
      
      Set<String> countries = new HashSet<>();
      for (String regionId : pair._2.split("\\+")) {
        Set<String> children = territories.get(regionId);
        if (children != null) {
          countries.addAll(children);
        } else {
          countries.add(regionId);
        }
      }

      variables.put(variable, countries);
    }

    // Build the final variable tables.
    code = CodeBlock.builder();
    code.add("new $T<$T, $T<$T>>() {{\n", HASHMAP, STRING, SET, STRING);
    for (Map.Entry<String, Set<String>> entry : variables.entrySet()) {
      code.add("  put($S, new $T<>(", entry.getKey(), HASHSET);
      List<String> list = new ArrayList<>(entry.getValue());
      Collections.sort(list);
      addStringList(code, list, "    ");
      code.add("));\n");
    }
    code.add("\n}}");
    
    type.addField(FieldSpec.builder(typeName, "VARIABLES", PROTECTED, STATIC, FINAL)
        .initializer(code.build())
        .build());
  }
505570
private boolean checkForVariables(List<Map<String, String>> values) {
    if (values == null || values.isEmpty()) {
      return false;
    } else {
      for (Map<String, String> list : values) {
        if (list.containsKey("type") && list.get("type")
            .equals(MtasParserMapping.PARSER_TYPE_VARIABLE)) {
          return true;
        }
      }
    }
    return false;
  }