Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.HotRand.HotCache Class Reference

List of all members.

Public Member Functions

def __init__
def fill_hot_cache
def next_num

Public Attributes

 url
 query
 hot_cache

Detailed Description

Definition at line 21 of file HotRand.py.


Constructor & Destructor Documentation

Definition at line 23 of file HotRand.py.

00023 
00024     def __init__( self  ):
00025 #        self.url = 'http://www.fourmilab.ch/cgi-bin/uncgi/Hotbits?num=5000&min=1&max=6&col=1'
00026         self.url = 'http://www.random.org/cgi-bin/randbyte?'
00027         self.query = { 'nbytes' : 128, 'fmt' : 'h' }
00028         self.fill_hot_cache()

Here is the caller graph for this function:


Member Function Documentation

Definition at line 29 of file HotRand.py.

00029 
00030     def fill_hot_cache( self ):
00031         url = self.url + urllib.urlencode( self.query )
00032         fh = urllib.urlopen( url )
00033         self.hot_cache = fh.read()
00034         fh.close()

Here is the caller graph for this function:

def Bio.HotRand.HotCache.next_num (   self,
  num_digits = 4 
)

Definition at line 35 of file HotRand.py.

00035 
00036     def next_num( self, num_digits = 4 ):
00037         cache = self.hot_cache
00038         numbytes = num_digits / 2
00039         if( len( cache ) % numbytes != 0 ):
00040             print 'len_cache is %d' % len( cache )
00041             raise ValueError
00042         if( cache == '' ):
00043             self.fill_hot_cache()
00044             cache = self.hot_cache
00045         hexdigits = cache[ :numbytes ]
00046         self.hot_cache = cache[ numbytes: ]
00047         return byte_concat( hexdigits )
00048 
00049 

Here is the call graph for this function:


Member Data Documentation

Definition at line 32 of file HotRand.py.

Definition at line 26 of file HotRand.py.

Definition at line 25 of file HotRand.py.


The documentation for this class was generated from the following file: