Parse a type signature
489830
def parse_type_signature(sig):
    
    match = TYPE_SIG_RE.match(sig.strip())
    if not match:
        raise RuntimeError('Type signature invalid, got ' + sig)
    groups = match.groups()
    typ = groups[0]
    generic_types = groups[1]
    if not generic_types:
        generic_types = []
    else:
        generic_types = split_sig(generic_types[1:-1])
    is_array = (groups[2] is not None)
    return typ, generic_types, is_array
987309
function _stringToSignature(string_signatures) {
	const signatures = [];
	for (let signature of string_signatures) {
		// check for properties rather than object type
		if (signature && signature.signature_header && signature.signature) {
			logger.debug('_stringToSignature - signature is protobuf');
		} else {
			logger.debug('_stringToSignature - signature is string');
			const signature_bytes = Buffer.from(signature, 'hex');
			signature = _configtxProto.ConfigSignature.decode(signature_bytes);
		}
		signatures.push(signature);
	}

	return signatures;
}
279267
function parseArgs(signature) {
  var args = [];
  var count = {};
  var index = {};
  var length = signature.length;
  for (var i = 0; i < length; i++) {
    var arg = signature[i];
    if (count[arg]) {
      count[arg]++;
    } else {
      count[arg] = 1;
    }
    index[arg] = 0;
  }
  for (var i = 0; i < length; i++) {
    var arg = signature[i];
    if (count[arg] > 1) {
      args.push(arg + "" + index[arg]);
      index[arg]++;
    } else {
      args.push(arg);
    }
  }
  return args
}
889260
def parse(self, type, data):
        
        try:
            return self.registered_formats[type]['parser'](data)
        except KeyError:
            raise NotImplementedError("No parser found for "
                                      "type '{type}'".format(type=type))
596354
function parse_predicates(Type) {

	//function first_letter_not_dollar(k) {
	//	return k[0] !== '$';
	//}

	function parse_data(opts) {
		debug.assert(opts).ignore(undefined).is('object');

		opts = opts || {};
		var datakey = get_predicate_datakey(Type);
		var res = {};
		ARRAY(Object.keys(opts)).forEach(function(i) {
			if(first_letter_is_dollar(i)) {
				// Parse top level properties
				parse_top_level_properties(res, opts, i);
			} else {
				// Parse meta properties
				parse_meta_properties(res, opts, datakey, i);
			}
		});
		return res;
	}

	return parse_data;
}
297324
function parseTypeArray (type) {
  var tmp = type.match(/(.*)\[(.*?)\]$/)
  if (tmp) {
    return tmp[2] === '' ? 'dynamic' : parseInt(tmp[2], 10)
  }
  return null
}
776703
function parseParameter(spec, ctx, params) {
  if (!spec || !isObject(spec)) return spec;

  for (var i=0, n=PARSERS.length, p; i<n; ++i) {
    p = PARSERS[i];
    if (spec.hasOwnProperty(p.key)) {
      return p.parse(spec, ctx, params);
    }
  }
  return spec;
}
1298491
function(T)
    {
        var ret = [];

        _(typedef.signature(T)).each(function(info, key) {
            if (info.decorations.FIELD)
                ret.push(key);
        });

        return ret;
    }
571655
private static String getSignature(TypeMirror type) {
        StringBuilder sbuf = new StringBuilder();
        type.accept(new SimpleTypeVisitor7<Void, StringBuilder>() {
            @Override
            protected Void defaultAction(TypeMirror e, StringBuilder stringBuilder) {
                return null;
            }

            @Override
            public Void visitPrimitive(PrimitiveType t, StringBuilder stringBuilder) {
                switch (t.getKind()) {
                    case BOOLEAN:
                        stringBuilder.append("Z");
                        break;
                    case BYTE:
                        stringBuilder.append("B");
                        break;
                    case CHAR:
                        stringBuilder.append("C");
                        break;
                    case DOUBLE:
                        stringBuilder.append("D");
                        break;
                    case FLOAT:
                        stringBuilder.append("F");
                        break;
                    case INT:
                        stringBuilder.append("I");
                        break;
                    case LONG:
                        stringBuilder.append("J");
                        break;
                    case SHORT:
                        stringBuilder.append("S");
                        break;
                    default:
                        break;
                }

                return null;
            }

            @Override
            public Void visitArray(ArrayType t, StringBuilder stringBuilder) {
                stringBuilder.append("[");
                t.getComponentType().accept(this, stringBuilder);
                return null;
            }

            @Override
            public Void visitDeclared(DeclaredType t, StringBuilder stringBuilder) {
                stringBuilder.append("L");
                stringBuilder.append(((TypeElement) t.asElement()).getQualifiedName().toString().replace('.', '/'));
                stringBuilder.append(";");

                return null;
            }

            @Override
            public Void visitExecutable(ExecutableType t, StringBuilder stringBuilder) {
                stringBuilder.append("(");
                for (TypeMirror p : t.getParameterTypes()) {
                    p.accept(this, stringBuilder);
                }
                stringBuilder.append(")");
                t.getReturnType().accept(this, stringBuilder);

                return null;
            }

            @Override
            public Void visitNoType(NoType t, StringBuilder stringBuilder) {
                if (t.getKind() == TypeKind.VOID) {
                    stringBuilder.append("V");
                }

                return null;
            }
        }, sbuf);

        return sbuf.toString();
    }
715434
def parse_chunks(b):
	
	# skip signature
	i = 8
	# yield chunks
	while i < len(b):
		data_len, = struct.unpack("!I", b[i:i+4])
		type_ = b[i+4:i+8].decode("latin-1")
		yield Chunk(type_, b[i:i+data_len+12])
		i += data_len + 12
147615
public void parseForMethod(GenericDeclaration genericDecl,
            String signature, Class<?>[] rawExceptionTypes) {
        setInput(genericDecl, signature);
        if (!eof) {
            parseMethodTypeSignature(rawExceptionTypes);
        } else {
            Method m = (Method) genericDecl;
            this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
            Class<?>[] parameterTypes = m.getParameterTypes();
            if (parameterTypes.length == 0) {
                this.parameterTypes = ListOfTypes.EMPTY;
            } else {
                this.parameterTypes = new ListOfTypes(parameterTypes);
            }
            Class<?>[] exceptionTypes = m.getExceptionTypes();
            if (exceptionTypes.length == 0) {
                this.exceptionTypes = ListOfTypes.EMPTY;
            } else {
                this.exceptionTypes = new ListOfTypes(exceptionTypes);
            }
            this.returnType = m.getReturnType();
        }
    }
986181
private static int checkTypeVariableSignature(final String signature,
            int pos) {
        // TypeVariableSignature:
        // T Identifier ;

        pos = checkChar('T', signature, pos);
        pos = checkIdentifier(signature, pos);
        return checkChar(';', signature, pos);
    }
381530
def name_from_type(type_):
    # type: (InternalType) -> str
    
    if isinstance(type_, (DictType, ListType, TupleType, SetType, IteratorType)):
        return repr(type_)
    else:
        if type_.__name__ != 'NoneType':
            module = type_.__module__
            if module in BUILTIN_MODULES or module == '<unknown>':
                # Omit module prefix for known built-ins, for convenience. This
                # makes unit tests for this module simpler.
                # Also ignore '<uknown>' modules so pyannotate can parse these types
                return type_.__name__
            else:
                name = getattr(type_, '__qualname__', None) or type_.__name__
                delim = '.' if '.' not in name else ':'
                return '%s%s%s' % (module, delim, name)
        else:
            return 'None'
980361
def get_type_name(type_):
    

    if type_ is None:
        return ""
    if isinstance(type_, string_types):
        return type_
    elif isinstance(type_, list):
        assert len(type_) == 1
        return "[%s]" % get_type_name(type_[0])
    elif isinstance(type_, dict):
        assert len(type_) == 1
        key, value = list(type_.items())[0]
        return "{%s: %s}" % (get_type_name(key), get_type_name(value))
    elif type_.__module__ in ("__builtin__", "builtins"):
        return type_.__name__
    else:
        return "%s.%s" % (type_.__module__, type_.__name__)
508049
private static int checkFieldTypeSignature(final String signature, int pos) {
        // FieldTypeSignature:
        // ClassTypeSignature | ArrayTypeSignature | TypeVariableSignature
        //
        // ArrayTypeSignature:
        // [ TypeSignature

        switch (getChar(signature, pos)) {
        case 'L':
            return checkClassTypeSignature(signature, pos);
        case '[':
            return checkTypeSignature(signature, pos + 1);
        default:
            return checkTypeVariableSignature(signature, pos);
        }
    }
258927
private void parseQuerySignature(boolean lastChunk) {
        ByteBufProcessor processor = null;
        //signature can be any valid JSON item, which get tricky to detect
        //let's try to find out what's the boundary character
        int openPos = responseContent.forEachByte(new WhitespaceSkipper()) - responseContent.readerIndex();
        if (openPos < 0) {
            //only whitespace left in the buffer, need more data
            return;
        }
        char openChar = (char) responseContent.getByte(responseContent.readerIndex() + openPos);
        if (openChar == '{') {
            processor = new ClosingPositionBufProcessor('{', '}', true);
        } else if (openChar == '[') {
            processor = new ClosingPositionBufProcessor('[', ']', true);
        } else if (openChar == '"') {
            processor = new StringClosingPositionBufProcessor();
        } //else this should be a scalar, skip processor

        int closePos;
        if (processor != null) {
            closePos = responseContent.forEachByte(processor) - responseContent.readerIndex();
        } else {
            closePos = findNextChar(responseContent, ',') - 1;
        }
        if (closePos > 0) {
            responseContent.skipBytes(openPos);
            int length = closePos - openPos + 1;
            ByteBuf signature = responseContent.readSlice(length);
            querySignatureObservable.onNext(signature.copy());
        } else {
            //wait for more data
            return;
        }
        //note: the signature section could be absent, so we'll make sure to complete the observable
        // when receiving status since this is in every well-formed response.
        sectionDone();
        queryParsingState = transitionToNextToken(lastChunk);
    }
1032118
function parseTypeString(type){
  if (type.indexOf('CompositeType') > -1){
    return getCompositeTypes(type);
  } else if(type.indexOf('ReversedType') > -1){
    return getType(getInnerType(type));
  }
  else if(type.indexOf('org.apache.cassandra.db.marshal.SetType') > -1){
    return getSetType(type);
  }
  else if(type.indexOf('org.apache.cassandra.db.marshal.ListType') > -1){
    return getListType(type);
  }
  else if(type.indexOf('org.apache.cassandra.db.marshal.MapType') > -1){
    return getMapType(type);
  }
  else if(type === null || type === undefined) {
    return 'BytesType';
  } else {
    return getType(type);
  }
}