Returns a random session ID for this flow based on the runner args.

    Returns:
      A formatted session id URN.
163478
def GetNewSessionID(self):
    
    # Calculate a new session id based on the flow args. Note that our caller
    # can specify the base path to the session id, but they can not influence
    # the exact session id we pick. This ensures that callers can not engineer a
    # session id clash forcing us to overwrite an existing flow.
    base = self.runner_args.base_session_id
    if base is None:
      base = self.runner_args.client_id or aff4.ROOT_URN
      base = base.Add("flows")

    return rdfvalue.SessionID(base=base, queue=self.runner_args.queue)
1082612
def generate_random_upload_path(instance, filename):
    
    return os.path.join(instance.__class__.__name__.lower(), uuid().hex, filename)
878132
def random(*args):
    
    current_frame     = inspect.currentframe().f_back
    trace_string      = ""
    while current_frame.f_back:
      trace_string = trace_string + current_frame.f_back.f_code.co_name
      current_frame = current_frame.f_back
    return counter.get_from_trace(trace_string)
1091518
def randomSlugField(self):
        
        lst = [
            "sample-slug-{}".format(uuid.uuid4().hex),
            "awesome-djipsum-{}".format(uuid.uuid4().hex),
            "unique-slug-{}".format(uuid.uuid4().hex)
        ]
        return self.randomize(lst)
1126944
def generate_session_id(data):
    
    host = data['environ']['HOST']
    tty = data['environ'].get('TTY') or 'NO_TTY'
    return ':'.join(map(str, [
        host, tty, os.getppid(), data['start']]))
1243139
protected static String generateSessionId() {
        return String.valueOf(randomGenerator.nextInt(Integer.MAX_VALUE) + randomGenerator.nextInt(Integer.MAX_VALUE));
    }
743731
def lastId(self):
        
        if self._last is False:
            # Request the next urn
            self._last = self.childIds[-1]
        return self._last
20682
def rrandom():
    """"""
    import urllib.request
    import urllib.error
    import urllib.parse
    if checkquota() < 1:
        raise Exception("Your www.random.org quota has already run out.")
    request = urllib.request.Request(
        'http://www.random.org/integers/?num=1&min=0&max=1000000000&col=1&base=10&format=plain&rnd=new')
    request.add_header('User-Agent', 'randomwrapy/0.1 very alpha')
    opener = urllib.request.build_opener()
    numlist = opener.open(request).read()
    num = numlist.split()[0]
    return float(num) / 1000000000
637165
def get_session_url(session_id, type='view', **params):
        
        url = 'sessions/{}/{}'.format(session_id, type)
        url = urljoin(API_URL, url)
        return add_to_url(url, **params)
1259480
def url_path(self):
        ''' 

        '''
        if self.failed:
            return None
        else:
            # TODO should fix invalid URL characters
            return '/' + os.path.splitext(os.path.basename(self._runner.path))[0]
1360680
def random_tracing():
    
    new_id = _uniq_id()
    return Tracing(
        span_id=new_id,
        parent_id=0,
        trace_id=new_id,
        traceflags=0)
1331374
def int(self, *args):
        
        return self.random.randint(*self._arg_defaults(args, [-sys.maxint, sys.maxint], int))
1273853
def get_rng(obj=None):
    
    seed = (id(obj) + os.getpid() +
            int(datetime.now().strftime("%Y%m%d%H%M%S%f"))) % 4294967295
    if _RNG_SEED is not None:
        seed = _RNG_SEED
    return np.random.RandomState(seed)
588955
def nextId(self):
        
        if self._next_id is False:
            # Request the next urn
            self._prev_id, self._next_id = self.getPrevNextUrn(reference=self.urn.reference)
        return self._next_id
445867
def get_shutit_pexpect_session_from_id(self, shutit_pexpect_id):
		
		shutit_global.shutit_global_object.yield_to_draw()
		for key in self.shutit_pexpect_sessions:
			if self.shutit_pexpect_sessions[key].pexpect_session_id == shutit_pexpect_id:
				return self.shutit_pexpect_sessions[key]
		return self.fail('Should not get here in get_shutit_pexpect_session_from_id',throw_exception=True)
292617
def firstId(self):
        
        if self._first is False:
            # Request the next urn
            self._first = self.getFirstUrn()
        return self._first
363145
def _getNextId(self):
        
        if not self._uuids:
            for _ in range(self.UUID_POOL_GEN_SIZE):
                self._uuids.append(uuid.uuid4().bytes)
        return self._uuids.pop()