The official swagger type spec makes it a little bit of a pain to work with the wrappers around type definitions.
329022
function isSchema(blob) {
    // A schema will have one of these
    return blob.properties !== undefined || blob.enum !== undefined || blob.items
        !== undefined || blob.type !== undefined;
}
908921
function krillPrimValidateTypes(fieldtypes, pred)
{
	var func = function (ent, key) {
	    return (krillPrimValidateFieldType(fieldtypes, ent, key));
	};

	krillPrimWalk(func, pred);
}
1281566
def definition(self, name, tags=None):
        
        def wrapper(obj):
            self.definition_models.append(SwaggerDefinition(name, obj,
                                                            tags=tags))
            return obj
        return wrapper
1358763
function processDefinition(definition) {
    var fields = [];
    var types = {};
    var key;
    var fieldDefinition;
    var type;

    for (key in definition) {
        if (definition.hasOwnProperty(key)) {
            fields.push(key);

            fieldDefinition = definition[key];
            type = determineType(fieldDefinition);

            // Normalize the type definition
            if (value(fieldDefinition).getConstructor() === Object) {
                definition[key].type = type;
            } else {
                definition[key] = {
                    type: type
                };
            }

            if (value(fieldDefinition).getConstructor() === Object) {
                definition[key].writable = fieldDefinition.hasOwnProperty("writable") ? fieldDefinition.writable : true;
            } else {
                definition[key].writable = true;
            }

            if (value(fieldDefinition).getConstructor() === Object) {
                definition[key].readable = fieldDefinition.hasOwnProperty("readable") ? fieldDefinition.readable : true;
            } else {
                definition[key].readable = true;
            }

            types[key] = type;
        }
    }

    return {
        fields: fields,
        types: types
    };
}
1364363
protected void initWithWrapperType() {
     // =========== wrapper type ==============
        transformers.put(Boolean.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.BOOL, value);
            }
        });
        transformers.put(Byte.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.BYTE, value);
            }
        });
        transformers.put(Character.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.BYTE, (byte)((Character)value).charValue());
            }
        });
        transformers.put(Double.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.DOUBLE, value);
            }
        });
        transformers.put(Float.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.FLOAT, value);
            }
        });
        transformers.put(Integer.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.INT, value);
            }
        });
        transformers.put(Long.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.LONG, value);
            }
        });
        transformers.put(Short.class, new Transformer() {
            @Override
            public SFSDataWrapper transform(Object value) {
                return new SFSDataWrapper(SFSDataType.SHORT, value);
            }
        });
    }
510380
def resolve_type_spec(self, name, lineno):
        """"""

        if name in self.type_specs:
            return self.type_specs[name].link(self)

        if '.' in name:
            include_name, component = name.split('.', 1)
            if include_name in self.included_scopes:
                return self.included_scopes[include_name].resolve_type_spec(
                    component, lineno
                )

        raise ThriftCompilerError(
            'Unknown type "%s" referenced at line %d%s' % (
                name, lineno, self.__in_path()
            )
        )
330457
function processServices(swagger, models, options) {
  var param, name, i, j;
  var services = {};
  var minParamsForContainer = options.minParamsForContainer || 2;
  var sortParams = options.sortParams || 'desc';
  for (var url in swagger.paths) {
    var path = swagger.paths[url];
	  var methodParameters = path.parameters;
    for (var method in path || {}) {
      var def = path[method];
      if (!def || method == 'parameters') {
        continue;
      }
      var tags = def.tags || [];
      var tag = tagName(tags.length == 0 ? null : tags[0], options);
      var descriptor = services[tag];
      if (descriptor == null) {
        var serviceClass = toClassName(tag);
        descriptor = {
          serviceName: tag,
          serviceClass: serviceClass + 'Service',
          serviceFile: toFileName(serviceClass) + '.service',
          operationIds: new Set(),
          serviceOperations: [],
        };
        services[tag] = descriptor;
      }

      var id = operationId(
        def.operationId,
        method,
        url,
        descriptor.operationIds
      );

      var parameters = def.parameters || [];

      if (methodParameters) {
        parameters = parameters.concat(methodParameters);
      }

      var paramsClass = null;
      var paramsClassComments = null;
      if (parameters.length >= minParamsForContainer) {
        paramsClass = id.charAt(0).toUpperCase() + id.substr(1) + 'Params';
        paramsClassComments = toComments('Parameters for ' + id, 1);
      }

      var operationParameters = [];
      for (var p = 0; p < parameters.length; p++) {
        param = parameters[p];
        if (param.$ref) {
          param = resolveRef(swagger, param.$ref);
        }
        var paramType;
        if (param.schema) {
          paramType = propertyType(param.schema);
        } else {
          paramType = propertyType(param);
        }
        var paramTypeNoNull = removeBrackets(paramType, true);
        var paramVar = toIdentifier(param.name);
        var paramDescriptor = {
          paramName: param.name,
          paramIn: param.in,
          paramVar: paramVar,
          paramFullVar: (paramsClass == null ? '' : 'params.') + paramVar,
          paramRequired: param.required === true || param.in === 'path',
          paramIsQuery: param.in === 'query',
          paramIsPath: param.in === 'path',
          paramIsHeader: param.in === 'header',
          paramIsBody: param.in === 'body',
          paramIsFormData: param.in === 'formData',
          paramIsArray: param.type === 'array',
          paramToJson: param.in === 'formData' && paramTypeNoNull !== 'Blob' &&
            paramTypeNoNull !== 'string',
          paramDescription: param.description,
          paramComments: toComments(param.description, 2),
          paramType: paramType,
          paramCollectionFormat: param.collectionFormat,
        };
        operationParameters.push(paramDescriptor);
      }
      operationParameters.sort((a, b) => {
        if (a.paramRequired && !b.paramRequired) return -1;
        if (!a.paramRequired && b.paramRequired) return 1;
        switch (sortParams) {
          case 'asc':
            return a.paramName > b.paramName ? 1 :
              a.paramName < b.paramName ? -1 : 0;
          case 'desc':
            return a.paramName > b.paramName ? -1 :
              a.paramName < b.paramName ? 1 : 0;
          default:
            return 0;
        }
      });
      if (operationParameters.length > 0) {
        operationParameters[operationParameters.length - 1].paramIsLast = true;
      }
      var operationResponses = processResponses(swagger, def, path, models);
      var resultType = operationResponses.resultType;
      var isMultipart = false;
      for (i = 0; i < operationParameters.length; i++) {
        if (operationParameters[i].paramIsFormData) {
          isMultipart = true;
          break;
        }
      }
      var docString = (def.description || '').trim();
      if (paramsClass == null) {
        for (i = 0; i < operationParameters.length; i++) {
          param = operationParameters[i];
          docString +=
            '\n@param ' + param.paramName + ' ' + param.paramDescription;
        }
      } else {
        docString +=
          '\n@param params The `' +
          descriptor.serviceClass +
          '.' +
          paramsClass +
          '` containing the following parameters:\n';
        for (i = 0; i < operationParameters.length; i++) {
          param = operationParameters[i];
          docString += '\n- `' + param.paramName + '`: ';
          var lines = (param.paramDescription || '').trim().split('\n');
          for (var l = 0; l < lines.length; l++) {
            var line = lines[l];
            if (line === '') {
              docString += '\n';
            } else {
              docString += (l == 0 ? '' : '  ') + line + '\n';
            }
          }
        }
      }
      if (operationResponses.resultDescription) {
        docString += '\n@return ' + operationResponses.resultDescription;
      }
      function getOperationName(string) {
        if (options.camelCase) return string.charAt(0).toLowerCase() + string.slice(1);
        else return string;
      }
      var operation = {
        operationName: getOperationName(id),
        operationParamsClass: paramsClass,
        operationParamsClassComments: paramsClassComments,
        operationMethod: method.toLocaleUpperCase(),
        operationPath: url,
        operationPathExpression:
          toPathExpression(operationParameters, paramsClass, url),
        operationResultType: resultType,
        operationHttpResponseType: '__StrictHttpResponse<' + resultType + '>',
        operationComments: toComments(docString, 1),
        operationParameters: operationParameters,
        operationResponses: operationResponses,
      };
      var modelResult = models[removeBrackets(resultType)];
      var actualType = resultType;
      if (modelResult && modelResult.modelIsSimple) {
        actualType = modelResult.modelSimpleType;
      }
      operation.operationIsMultipart = isMultipart;
      operation.operationIsVoid = actualType === 'void';
      operation.operationIsString = actualType === 'string';
      operation.operationIsNumber = actualType === 'number';
      operation.operationIsOther =
        !['void', 'number', 'boolean'].includes(actualType);
      operation.operationIsBoolean = actualType === 'boolean';
      operation.operationIsEnum = modelResult && modelResult.modelIsEnum;
      operation.operationIsObject = modelResult && modelResult.modelIsObject;
      operation.operationIsPrimitiveArray =
        !modelResult && (resultType.toString().includes('Array<') ||
          resultType.toString().includes('[]'));
      operation.operationIsFile = actualType === 'Blob';
      operation.operationResponseType =
        operation.operationIsFile ? 'blob' :
        operation.operationIsVoid ||
        operation.operationIsString ||
        operation.operationIsNumber ||
        operation.operationIsBoolean ||
        operation.operationIsEnum ?
          'text' : 'json';
      operation.operationIsUnknown = !(
        operation.operationIsVoid ||
        operation.operationIsString ||
        operation.operationIsNumber ||
        operation.operationIsBoolean ||
        operation.operationIsEnum ||
        operation.operationIsObject ||
        operation.operationIsFile ||
        operation.operationIsPrimitiveArray
      );
      descriptor.serviceOperations.push(operation);
    }
  }

  // Read the comments of each tag to use for service comments
  if (swagger.tags && swagger.tags.length > 0) {
    for (i = 0; i < swagger.tags.length; i++) {
      const tag = swagger.tags[i];
      const name = tagName(tag.name);
      const service = services[name];
      if (service && tag.description) {
        service.serviceComments = toComments(tag.description);
      }
    }
  }

  // Resolve the models used by each service
  for (name in services) {
    var service = services[name];
    var dependencies = new DependenciesResolver(models);
    var errorDependencies = new DependenciesResolver(models);
    for (i = 0; i < service.serviceOperations.length; i++) {
      var op = service.serviceOperations[i];
      for (var code in op.operationResponses) {
        var status = Number(code);
        var actualDeps = (status < 200 || status >= 300)
          ? errorDependencies : dependencies;
        var response = op.operationResponses[code];
        if (response.type) {
          var type = response.type;
          if (type && type.allTypes) {
            // This is an inline object. Append all types
            type.allTypes.forEach(t => actualDeps.add(t));
          } else {
            actualDeps.add(type);
          }
        }
      }
      for (j = 0; j < op.operationParameters.length; j++) {
        param = op.operationParameters[j];
        dependencies.add(param.paramType);
      }
    }
    service.serviceDependencies = dependencies.get();
    service.serviceErrorDependencies = errorDependencies.get();
  }

  return services;
}
128984
def shorten_type(typ):
    
    offset = 0
    for prefix in SHORTEN_TYPE_PREFIXES:
        if typ.startswith(prefix):
            if len(prefix) > offset:
                offset = len(prefix)
    return typ[offset:]
139085
private static Wrapper resolveAmbiguousWrapper(Set<Wrapper> candidates,
            Class<?>[] paramTypes) {
        // Identify which parameter isn't an exact match
        Wrapper w = candidates.iterator().next();

        int nonMatchIndex = 0;
        Class<?> nonMatchClass = null;

        for (int i = 0; i < paramTypes.length; i++) {
            if (w.getParameterTypes()[i] != paramTypes[i]) {
                nonMatchIndex = i;
                nonMatchClass = paramTypes[i];
                break;
            }
        }

        if (nonMatchClass == null) {
            // Null will always be ambiguous
            return null;
        }

        for (Wrapper c : candidates) {
           if (c.getParameterTypes()[nonMatchIndex] ==
                   paramTypes[nonMatchIndex]) {
               // Methods have different non-matching parameters
               // Result is ambiguous
               return null;
           }
        }

        // Can't be null
        Class<?> superClass = nonMatchClass.getSuperclass();
        while (superClass != null) {
            for (Wrapper c : candidates) {
                if (c.getParameterTypes()[nonMatchIndex].equals(superClass)) {
                    // Found a match
                    return c;
                }
            }
            superClass = superClass.getSuperclass();
        }

        // Treat instances of Number as a special case
        Wrapper match = null;
        if (Number.class.isAssignableFrom(nonMatchClass)) {
            for (Wrapper c : candidates) {
                Class<?> candidateType = c.getParameterTypes()[nonMatchIndex];
                if (Number.class.isAssignableFrom(candidateType) ||
                        candidateType.isPrimitive()) {
                    if (match == null) {
                        match = c;
                    } else {
                        // Match still ambiguous
                        match = null;
                        break;
                    }
                }
            }
        }

        return match;
    }
701177
function makeSignature(params) {
	var r = ['('], desc;
	if ( params ) {
		for (var i = 0, p; (p = params[i]); i++) {
			// ignore @param tags for 'virtual' params that are used to document members of config-like params
			// (e.g. like "@param param1.key ...")
			if (p.name && p.name.indexOf('.') == -1) {
				if (i > 0) {
					r.push(', ');
				}

				r.push('<span');

				var types = listTypes(p.type, true);
				if ( (desc = asPlainSummary(p.description)) || types ) {
					r.push(' title="');
					if (types) {
						r.push('(');
						r.push(types);
						r.push(') ');
					}
					r.push(desc);
					r.push('"');
				}

				r.push('>');
				r.push(p.name);
				r.push('</span>');
				if ( p.optional ) {
					r.push('<i class="help" title="Optional parameter">?</i>');
				}
			}
		}
	}
	r.push(')');
	return r.join('');
}
306448
def _SeparateTypes(self, metadata_value_pairs):
    """"""
    registry_pairs = []
    file_pairs = []
    match_pairs = []
    for metadata, result in metadata_value_pairs:
      if (result.stat_entry.pathspec.pathtype ==
          rdf_paths.PathSpec.PathType.REGISTRY):
        registry_pairs.append((metadata, result.stat_entry))
      else:
        file_pairs.append((metadata, result))

      match_pairs.extend([(metadata, match) for match in result.matches])

    return registry_pairs, file_pairs, match_pairs
591059
def remove_declarated(type_):
    
    type_ = remove_alias(type_)
    if isinstance(type_, cpptypes.elaborated_t):
        type_ = type_.base
    if isinstance(type_, cpptypes.declarated_t):
        type_ = type_.declaration
    return type_
469381
function SchemaTypeWrapper(type) {
  var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];


  return new SchemaType(type, options);
}
751746
private void updateDocTypesFromConfiguration() {
        resetDocumentTypesAndExtractors();
        JBakeConfiguration config = utensils.getConfiguration();

        ModelExtractorsDocumentTypeListener listener = new ModelExtractorsDocumentTypeListener();
        DocumentTypes.addListener(listener);

        for (String docType : config.getDocumentTypes()) {
            DocumentTypes.addDocumentType(docType);
        }
    }
399268
public void negotiateInitialValueTypes() {
        // Either of the function result type or parameter type could be null or a specific supported value type, or a generic
        // NUMERIC. Replace any "generic" type (null or NUMERIC) with the more specific type without over-specifying
        // -- the BEST type might only become clear later when the context/caller of this function is parsed, so don't
        // risk guessing wrong here just for the sake of specificity.
        // There will be a "finalize" pass over the completed expression tree to finish specifying any remaining "generics".

        // DO use the type chosen by HSQL for the parameterized function as a specific type hint
        // for numeric constant arguments that could either go decimal or float.
        AbstractExpression typing_arg = m_args.get(m_resultTypeParameterIndex);
        VoltType param_type = typing_arg.getValueType();
        VoltType value_type = getValueType();
        // The heuristic for which type to change is that any type (parameter type or return type) specified so far,
        // including NUMERIC is better than nothing. And that anything else is better than NUMERIC.
        if (value_type != param_type) {
            if (value_type == null) {
                value_type = param_type;
            }
            else if (value_type == VoltType.NUMERIC) {
                if (param_type != null) {
                    value_type = param_type;
                }
                // Pushing a type DOWN to the argument is a lot like work, and not worth it just to
                // propagate down a known NUMERIC return type,
                // since it will just have to be re-specialized when a more specific type is inferred from
                // the context or finalized when the expression is complete.
            } else if ((param_type == null) || (param_type == VoltType.NUMERIC)) {
                // The only purpose of refining the parameter argument's type is to force a more specific
                // refinement than NUMERIC as implied by HSQL, in case that might be more specific than
                // what can be inferred later from the function call context.
                typing_arg.refineValueType(value_type, value_type.getMaxLengthInBytes());
            }
        }
        if (value_type != null) {
            setValueType(value_type);
            if (value_type != VoltType.INVALID && value_type != VoltType.NUMERIC) {
                int size = value_type.getMaxLengthInBytes();
                setValueSize(size);
            }
        }
    }
220088
function wrapFieldsWithMiddleware(type, deepWrap = true, typeMet = {}) {
  if (!type) {
    return;
  }

  let fields = type._fields;
  typeMet[type.name] = true;
  for (let label in fields) {
    let field = fields[label];
    if (field && !typeMet[field.type.name]) {
      if (!!field && typeof field == 'object') {
        field.resolve = resolveMiddlewareWrapper(
          field.resolve,
          field.directives,
        );
        if (field.type._fields && deepWrap) {
          wrapFieldsWithMiddleware(field.type, deepWrap, typeMet);
        } else if (field.type.ofType && field.type.ofType._fields && deepWrap) {
          let child = field.type;
          while (child.ofType) {
            child = child.ofType;
          }
          if (child._fields) {
            wrapFieldsWithMiddleware(child._fields);
          }
        }
      }
    }
  }
}
1246667
private SuggestedFix fixQualifiers(VisitorState state, MethodSymbol sym, SuggestedFix f) {
    SuggestedFix.Builder builder = SuggestedFix.builder().merge(f);
    new TreeScanner<Void, Void>() {
      @Override
      public Void visitMemberSelect(MemberSelectTree tree, Void unused) {
        fixQualifier(tree, tree.getExpression());
        return super.visitMemberSelect(tree, unused);
      }

      @Override
      public Void visitMemberReference(MemberReferenceTree tree, Void unused) {
        fixQualifier(tree, tree.getQualifierExpression());
        return super.visitMemberReference(tree, unused);
      }

      private void fixQualifier(Tree tree, ExpressionTree qualifierExpression) {
        if (sym.equals(ASTHelpers.getSymbol(tree))) {
          builder.replace(qualifierExpression, sym.owner.enclClass().getSimpleName().toString());
        }
      }
    }.scan(state.getPath().getCompilationUnit(), null);
    return builder.build();
  }