Generate token used to trace execution of operation across multiple packets

 === Return
 tr(String):: Trace token, may be empty
966267
def trace
      audit_id = self.respond_to?(:payload) && payload.is_a?(Hash) && (payload['audit_id'] || payload[:audit_id])
      tok = self.respond_to?(:token) && token
      tr = "<#{audit_id || nil}> <#{tok}>"
    end
1105422
def log_trace(logger, level=logging.DEBUG, show_enter=True, show_exit=True):
    
    def wrap(function):
        l = logger.getChild(function.__name__).log
        @wraps(function)
        def thunk(*args, **kwargs):
            global trace_depth
            trace_depth.value += 1
            try:
                start = time()
                if show_enter:
                    l(level, "{0}> {1} {2}".format(" "*trace_depth.value,
                                                   args, kwargs))
                try:
                    result = function(*args, **kwargs)
                except:
                    _, result, _ = sys.exc_info()
                    raise
                finally:
                    if show_exit:
                        l(level, "{0}< return {1} [{2:.2f} sec]".format(
                            " "*trace_depth.value, result, time() - start))
            finally:
                trace_depth.value -= 1
            return result
        return thunk
    return wrap
256205
def get_cache_token(self, token):
        

        if self.conn is None:
            raise CacheException('Redis is not connected')

        token_data = self.conn.get(token)
        token_data = json.loads(token_data) if token_data else None

        return token_data
310044
def log_context(trace_level, stream):
    '''
    
    '''
    original_trace_level = DebugInfoHolder.DEBUG_TRACE_LEVEL
    original_stream = DebugInfoHolder.DEBUG_STREAM

    DebugInfoHolder.DEBUG_TRACE_LEVEL = trace_level
    DebugInfoHolder.DEBUG_STREAM = stream
    try:
        yield
    finally:
        DebugInfoHolder.DEBUG_TRACE_LEVEL = original_trace_level
        DebugInfoHolder.DEBUG_STREAM = original_stream
880763
def executed_block_set(trace):
    
    executed_set = set()
    for entry in trace:
        if entry[0] == 'execute':
            executed_set.add(entry[get_trace_index('execute', 'BLOCK_NAME')])
    return executed_set
354990
function() {
    var captures;
    if (captures = /^-*[_a-zA-Z$][-\w\d$]*/.exec(this.str)) {
      this.skip(captures);
      return new Token('ident', new nodes.Ident(captures[0]));
    }
  }
847707
def send
      return if @queue.empty? || ENV['INSTANA_GEM_TEST']

      size = @queue.size
      if size > 200
        Instana.logger.debug "Trace queue is #{size}"
      end

      # Scan for any staged but incomplete traces that have now
      # completed.
      process_staged

      # Retrieve all spans for queued traces
      spans = queued_spans

      # Report spans in batches
      batch = spans.shift(@batch_size)
      while !batch.empty? do
        ::Instana.agent.report_spans(batch)
        batch = spans.shift(@batch_size)
      end
    end
529954
def token_of_request(
            self,
            method,
            host,
            url,
            qheaders,
            content_type=None,
            body=None):
        
        parsed_url = urlparse(url)
        netloc = parsed_url.netloc
        path = parsed_url.path
        query = parsed_url.query

        if not host:
            host = netloc

        path_with_query = path
        if query != '':
            path_with_query = ''.join([path_with_query, '?', query])
        data = ''.join(["%s %s" %
                        (method, path_with_query), "\n", "Host: %s" %
                        host, "\n"])

        if content_type:
            data += "Content-Type: %s" % (content_type) + "\n"

        data += qheaders
        data += "\n"

        if content_type and content_type != "application/octet-stream" and body:
            data += body.decode(encoding='UTF-8')

        return '{0}:{1}'.format(self.__access_key, self.__token(data))
31996
def __traces_url(self):
        
        path = AGENT_TRACES_PATH % self.from_.pid
        return "http://%s:%s/%s" % (self.host, self.port, path)
118179
def trace_incoming_remote_call(
            self,
            method,
            name,
            endpoint,
            protocol_name=None,
            str_tag=None,
            byte_tag=None):
        '''
        '''
        result = tracers.IncomingRemoteCallTracer(
            self._nsdk,
            self._nsdk.incomingremotecalltracer_create(method, name, endpoint))
        if protocol_name is not None:
            self._nsdk.incomingremotecalltracer_set_protocol_name(
                result.handle, protocol_name)
        self._applytag(result, str_tag, byte_tag)
        return result
749633
function newToken(){ // check if the client has all the tokens
	var allRetrieved = true;
	var tokens = client.getTokens();
	
	['auth', 'gvx', 'rnr'].forEach(function(type){
		if(!tokens.hasOwnProperty(type)){
			allRetrieved = false;
		}
	});
	
	if(allRetrieved){ // save tokens once all have been retrieved
		fs.writeFileSync('./tokens.json', JSON.stringify(tokens));
		console.log('\n\nALL TOKENS SAVED TO tokens.json')
	}
}
1213035
def generate_token():
    
    length = 50
    stringset = string.ascii_letters + string.digits
    token = ''.join([stringset[i % len(stringset)] for i in [ord(x) for x in os.urandom(length)]])
    return token
201020
def generate_token(self, *args, **kwargs):
        
        # determine the length based on min_length and max_length
        length = random.randint(self.min_length, self.max_length)

        # generate the token using os.urandom and hexlify
        return binascii.hexlify(
            os.urandom(self.max_length)
        ).decode()[0:length]
794641
def _generateForTokenSecurity(self):
        
        agolToken = self._agolSecurityHandler.token
        url = self._url + "/getProxyUserToken"
        params = {"token" : self._agolSecurityHandler.token,
                  "contributorUid" : self._contributionUID}
        res = self._post(url=url, param_dict=params,
                         additional_headers={ "Referer": self._agolSecurityHandler._referer_url},
                         proxy_port=self._proxy_port,
                         proxy_url=self._proxy_url)
        return res['token']
1110573
def _generate_state() -> str:
        
        state = str(uuid.uuid4()).replace('-', '')
        logger.debug("Generated OAuth state: %s" % state)
        return state
356168
function Trace(input, pos1, pos2, expr, succeeded, bindings, optChildren) {
  this.input = input;
  this.pos = this.pos1 = pos1;
  this.pos2 = pos2;
  this.source = new Interval(input, pos1, pos2);
  this.expr = expr;
  this.bindings = bindings;
  this.children = optChildren || [];
  this.terminatingLREntry = null;

  this._flags = succeeded ? Flags.succeeded : 0;
}
1324235
def trace_module(no_print=True):
    """"""
    pwd = os.path.dirname(__file__)
    script_name = os.path.join(pwd, "test_my_module.py")
    with pexdoc.ExDocCxt() as exdoc_obj:
        if pytest.main(["-s", "-vv", "-x", "{0}".format(script_name)]):
            raise RuntimeError("Tracing did not complete successfully")
    if not no_print:
        module_prefix = "docs.support.my_module."
        callable_names = ["func", "MyClass.value"]
        for callable_name in callable_names:
            callable_name = module_prefix + callable_name
            print("\nCallable: {0}".format(callable_name))
            print(exdoc_obj.get_sphinx_doc(callable_name, width=70))
            print("\n")
    return copy.copy(exdoc_obj)