/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions
Scraper::adlid::AdLidFaker Class Reference
Inheritance diagram for Scraper::adlid::AdLidFaker:
Inheritance graph
[legend]
Collaboration diagram for Scraper::adlid::AdLidFaker:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def fake

Detailed Description

Definition at line 105 of file adlid.py.


Member Function Documentation

def Scraper::adlid::AdLidFaker::fake (   self,
  inst,
  id,
  dt = None 
)
Invoked from base class, sets source instance attributes to form a fake 

:param inst: source instance
:param id: id to assign to the instance 

Note that **not** setting the `id` attribute allows AUTOINCREMENT to kick in and
can avoid SQLAlchemy IntegrityError from duplicate keys. 

Definition at line 106 of file adlid.py.

00107                                        :
00108         """
00109         Invoked from base class, sets source instance attributes to form a fake 
00110 
00111         :param inst: source instance
00112         :param id: id to assign to the instance 
00113 
00114         Note that **not** setting the `id` attribute allows AUTOINCREMENT to kick in and
00115         can avoid SQLAlchemy IntegrityError from duplicate keys. 
00116 
00117         """
00118         if dt==None:
00119             dt = datetime.now()
00120         for k,v in inst.asdict.items():
00121             if k == 'id':
00122                 pass  
00123                 #setattr( inst, k, id )   
00124             elif k == 'date_time':
00125                 setattr( inst, k, dt )
00126             else:
00127                 if k.startswith('Ultrasonic'):
00128                     setattr( inst, k, random.gauss(2000, 5) )
00129                 elif k.startswith('Capacitance'):
00130                     setattr( inst, k, random.gauss(200, 10) )
00131                 elif k.startswith('Temp_'):
00132                     setattr( inst, k, random.gauss(22.7, 0.1) )
00133                 elif k.startswith('Tilt'):
00134                     setattr( inst, k, random.gauss(0, 0.1) )
00135                 else:
00136                     setattr( inst, k, 0 );   
00137 


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:50:03 for Scraper by doxygen 1.7.4