/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 | Static Public Attributes
Scraper::pmthv::PmtHvFaker Class Reference
Inheritance diagram for Scraper::pmthv::PmtHvFaker:
Inheritance graph
[legend]
Collaboration diagram for Scraper::pmthv::PmtHvFaker:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def fake

Static Public Attributes

tuple lcr_matcher = LCR()

Detailed Description

Creates fake instances and inserts them into sourcedb   

Definition at line 125 of file pmthv.py.


Member Function Documentation

def Scraper::pmthv::PmtHvFaker::fake (   self,
  inst,
  id,
  dt 
)
Invoked from base class call method, 
set attributes of source instance to form a fake 

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

Definition at line 130 of file pmthv.py.

00131                                   :
00132         """
00133         Invoked from base class call method, 
00134         set attributes of source instance to form a fake 
00135 
00136         :param inst: source instance
00137         :param id: id to assign to the instance instance
00138         """
00139         fakefn=lambda (l,c,r),qty:l*100 + c*10 + r if qty == "voltage" else 1 
00140         for k,v in inst.asdict.items():
00141             if k in 'id P_id'.split():
00142                  pass
00143                  #setattr( inst, k, id )   ## not setting the id leads to AUTO_INCREMENT kicking in which can avoid integrity errors from duplicate keys 
00144             elif k in 'date_time P_date_time'.split():
00145                  setattr( inst, k, dt )
00146             else:
00147                 qty,kk = ('pw',k[2:]) if k.startswith('P_') else ('voltage',k)
00148                 lcr = self.lcr_matcher(kk)    
00149                 setattr( inst , k, fakefn( lcr, qty) )
00150 


Member Data Documentation

Definition at line 129 of file pmthv.py.


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