Helper function to encode local-lookup internal references
197303
function encodeLIREF(encoder, op8, op16, local_ids, xrid) {
	var DEBUG_THIS = false;

	// Check if the given object is part of the array
	var id=-1, i=0, l=local_ids.length;
	for (;i<l;++i) {
		if (i > 65535) break;
		if (local_ids[i] === xrid) {
			id = i;
			break;
		}
	}

	if (id === -1) { // IREF
		op8.push( pack1b( PRIM_BULK_KNOWN_OP.IREF | ((xrid >> 16) & 0xF), false ) );
		op16.push( pack2b( xrid & 0xFFFF, false ) );
		encoder.counters.op_iref+=3;
		local_ids.push(xrid);
		if (DEBUG_THIS) console.log("->- IREF(",xrid,",",id,")");
	} else if (id < 128) { // LREF_7
		op8.push( pack1b( PRIM_BULK_KNOWN_OP.LREF_7 | (id & 0x7F), false ) );
		encoder.counters.op_iref+=1;
		if (DEBUG_THIS) console.log("->- LREF_7(",xrid,",",id,")");
	} else if (id < 2048) { // LREF_11
		op8.push( pack1b( PRIM_BULK_KNOWN_OP.LREF_11 | ((id >> 8) & 0x7), false ) );
		op8.push( pack1b( id & 0xFF, false ) );
		encoder.counters.op_iref+=2;
		if (DEBUG_THIS) console.log("->- LREF_11(",xrid,",",id,")");
	} else if (id < 65536) { // LREF_16
		op8.push( pack1b( PRIM_BULK_KNOWN_OP.LREF_16, false ) );
		op16.push( pack2b( id & 0xFFFF, false ) );
		encoder.counters.op_iref+=3;
		if (DEBUG_THIS) console.log("->- LREF_16(",xrid,",",id,")");
	}

}
462767
def cache_call_signatures(source, user_pos, stmt):
    """"""
    index = user_pos[0] - 1
    lines = source.splitlines() or ['']
    if source and source[-1] == '\n':
        lines.append('')

    before_cursor = lines[index][:user_pos[1]]
    other_lines = lines[stmt.start_pos[0]:index]
    whole = '\n'.join(other_lines + [before_cursor])
    before_bracket = re.match(r'.*\(', whole, re.DOTALL)

    module_path = stmt.get_parent_until().path
    return None if module_path is None else (module_path, before_bracket, stmt.start_pos)
1357651
function locateCodeImport(value, fromIndex) {
  var index = value.indexOf(C_NEWLINE, fromIndex);

  if (value.charAt(index + 1) !== "<" && value.charAt(index + 2) !== "<") {
    return;
  }

  return index;
}
542428
def get_locals(f):
    '''  '''
    return pformat({i:f.f_locals[i] for i in f.f_locals if not i.startswith('__')})
172420
function encodeObject( encoder, object ) {

	// Check ByRef internally
	var id = encoder.lookupIRef( object );
	if (id > -1) { encodeIREF( encoder, id ); return; }

	// Check ByRef externally
	id = encoder.lookupXRef( object );
	if (id > -1) { encodeXREF( encoder, id); return }

	// Lookup object type
	var enc = encoder.profile.encode(object);
	if (!enc) {
		throw new Errors.XRefError('An object trying to encode was not declared in the object table!');
	}

	// Populate property table
	var eid = enc[0], propertyTable = enc[1]( object );

	// Check ByVal ref
	id = encoder.lookupIVal( propertyTable, eid );
	if (id > -1) 
		{ encodeIREF( encoder, id ); return; }

	// Keep this object for internal cross-refferencing
	encoder.log(LOG.OBJ,"eid="+eid+", properties="+propertyTable.length);
	encoder.keepIRef( object, propertyTable, eid );

	// Check if we should use 12-bit or 5-bit index
	if (eid < 32) {

		// Write entity opcode
		encoder.stream8.write( pack1b( PRIM_OP.OBJECT | OBJ_OP.KNOWN_5 | eid ) );
		encoder.counters.op_prm+=1;

	} else {

		// Split 12-bit number
		var eid_hi = (eid & 0xF00) >> 8,
			eid_lo = eid & 0xFF;

		// Write entity
		encoder.stream8.write( pack1b( PRIM_OP.OBJECT | OBJ_OP.KNOWN_12 | eid_hi ) );
		encoder.stream8.write( pack1b( eid_lo ) );
		encoder.counters.op_prm+=2;

	}

	// Write property table as an array
	encodeArray( encoder, propertyTable );

}
407718
def _iter_refs(obj, named):
    '''
    '''
    r = _getreferents(obj)  # special case
    return _refs(r, named, itor=_nameof(obj) or 'iteref')
445717
def clean_locals(data):
    
    if data.get('params') is not None:
        return data.get('params')
    else:
        return {
            to_camel_case(k): v for k, v in data.items() if v is not None and k not in
            ['self', 'session', 'params', 'lightweight']
        }
740058
function encodeXREF( encoder, id ) {

	// Write opcode for 16-bit lookup 
	encoder.log(LOG.XREF, "xref="+id+" [" + encoder.stringLookup[id] + "]")
	encoder.stream8.write( pack1b( PRIM_OP.IMPORT, false ) );
	encoder.stream16.write( pack2b( id, false ) );
	encoder.counters.op_xref+=3;

}
743734
function findVariableReferences (ast, identifier, skip) {
  var references = [];
  traverse.traverse(ast, {
    enter: function (node, parent) {
      if (node === skip) {
        this.skip();
      }
      else if (
          node.type === 'Identifier' &&
          node.name === identifier.name &&
          (parent.type !== 'MemberExpression' || parent.left !== node)
      ) {
        references.push(node);
      }
    }
  });
  return references;
}
137076
def _refs(obj, named, *ats, **kwds):
    '''
    '''
    if named:
        for a in ats:  # cf. inspect.getmembers()
            if hasattr(obj, a):
                yield _NamedRef(a, getattr(obj, a))
        if kwds:  # kwds are _dir2() args
            for a, o in _dir2(obj, **kwds):
                yield _NamedRef(a, o)
    else:
        for a in ats:  # cf. inspect.getmembers()
            if hasattr(obj, a):
                yield getattr(obj, a)
        if kwds:  # kwds are _dir2() args
            for _, o in _dir2(obj, **kwds):
                yield o
660675
function locateRepoReference(value, fromIndex) {
  var hash = value.indexOf('@', fromIndex)
  var issue = value.indexOf('#', fromIndex)
  var index
  var start
  var test

  if (hash === -1) {
    index = issue
  } else if (issue === -1) {
    index = hash
  } else {
    index = hash > issue ? issue : hash
  }

  start = index

  if (start === -1) {
    return index
  }

  while (index >= fromIndex) {
    if (!repoCharacter(value.charCodeAt(index - 1))) {
      break
    }

    index--
  }

  if (index < start && index >= fromIndex) {
    test = start === hash ? hexadecimal : decimal

    if (
      test(value.charCodeAt(start + 1)) &&
      !repoCharacter(value.charCodeAt(index - 1))
    ) {
      return index
    }
  }

  /* Find the next possible value. */
  return locateRepoReference(value, start + 1)
}
111274
function saveResolvedLocalsInData() {
    var localNames = previousOrParentNode.tNode.localNames;
    if (localNames) {
        for (var i = 0; i < localNames.length; i += 2) {
            var index = localNames[i + 1];
            var value = index === -1 ? previousOrParentNode.native : directives[index];
            viewData.push(value);
        }
    }
}
133286
function encodeParams(cache, API_URL, params) {
  var obj = {}, v;
  for (var k in params) {
    if (!params.hasOwnProperty(k)) continue;
    v = obj[k] = encode(cache, API_URL, params[k]);
    if (!v) return;
  }
  return obj;
}
525218
function nest (str, refs, escape) {
		var res = [], match

		var a = 0
		while (match = re.exec(str)) {
			if (a++ > 10e3) throw Error('Circular references in parenthesis')

			res.push(str.slice(0, match.index))

			res.push(nest(refs[match[1]], refs))

			str = str.slice(match.index + match[0].length)
		}

		res.push(str)

		return res
	}
151472
def match_local(self, prefix, includes, excludes):
        
        includes_pattern = r"|".join([fnmatch.translate(x) for x in includes])
        excludes_pattern = r"|".join([fnmatch.translate(x) for x in excludes]) or r"$."
        matches = []
        for root, dirs, files in os.walk(prefix, topdown=True):
            # exclude dirs
            dirs[:] = [os.path.join(root, d) for d in dirs]
            dirs[:] = [d for d in dirs if not re.match(excludes_pattern,
                                                       d.split(root)[1])]
            # exclude/include files
            files = [os.path.join(root, f) for f in files]
            files = [os.path.join(root, f) for f in files
                     if not re.match(excludes_pattern, f)]
            files = [os.path.join(root, f) for f in files
                     if re.match(includes_pattern, f.split(prefix)[1])]
            for fname in files:
                matches.append(fname)
        return matches
87862
function getNames(local) {
    return forAll(data, function getNamesIterator(row) {
        return local ? row.local : row.name;
    });
}
129841
function createTransformers( moduleName, symbolsToFilename, localSymbols ) {
   const _replaceLinks = text => {
      return text.replace(
         LINK_MATCHER,
         ( _, $plain, $moduleName = '', $localItem, $localItemProp, $parens = '', $title = '' ) => {
            let link = '';
            link += $localItem ? `#${$localItem}` : '';
            link += $localItemProp ? `.${$localItemProp}` : '';

            const linkText = $title.trim() ? $title.trim() : $moduleName + link + $parens;
            if( $moduleName && $moduleName !== moduleName ) {
               link = `${symbolsToFilename[ $moduleName ] || '-unknown-'}${link}`;
            }
            if( $plain ) {
               return `[${linkText}](${link})`;
            }
            return `[\`${linkText}\`](${link})`;
         } );
   };
   const _renderType = type => {
      if( localSymbols.indexOf( type ) !== -1 ) {
         return `[\`${type}\`](#${type})`;
      }
      if( type in symbolsToFilename ) {
         return `[\`${type}\`](${symbolsToFilename[ type ]}#${type})`;
      }
      return '`' + type + '`';
   };
   const _renderTypes = obj => ( obj.types || [] ).map( _renderType ).join( ', ' );
   const _renderPropertyType = dox => {
      const types = ( dox.tags.filter( _ => _.type === 'type' )[ 0 ] || {} ).types || [];
      return _renderType( types[ 0 ] );
   };
   const _deprecationTitle = obj => deprecation( obj ) ? ' **(Deprecated)**' : '';
   const _deprecationText = obj => {
      const deprecationNotice = deprecation( obj );
      return deprecationNotice ? `\n\n**Deprecated:**\n\n> ${_replaceLinks(deprecationNotice)}\n\n` : '';
   };
   return {
      _replaceLinks,
      _renderType,
      _renderTypes,
      _renderPropertyType,
      _deprecationTitle,
      _deprecationText
   };
}