wg_invent_client::invent_client::Invent Class Reference

Stores username and password, provides access to invent. More...

List of all members.

Public Member Functions

def __init__
def add_attachment
 Adds attachment to component.
def addItemReference
 Add reference to an item.
def check_assembled
 Verifies that component is assembled and parts have passed Qual.
def check_serial_valid
 Check invent DB for serial, make sure it is valid.
def delete_attachment
 Deletes attachment.
def delete_note
 Delete note for item.
def deleteKV
 Delete key value for component.
def generateWGMacaddr
 Generates Willow Garage mac address for item.
def get_attachment_info
 Get attachment info.
def get_item_notes
 Gets notes for an item.
def get_item_references
 Return any references to an item.
def get_note
 Get information about note.
def get_parent_item
 Returns parent item (serial number) or location.
def get_sub_items
 Returns list of sub items (references) for a particular parent.
def get_test_status
 Returns True if part has 'Test Status'='PASS', False otherwise.
def getItemReferences
def getKV
 Return value of component's key Get key-value of component.
def list_attachments
 List all attachments for an item.
def listKVs
 List Key-Value pairs of component.
def login
 Logs into Invent.
def lookup_by_reference
 Lookup item by a reference.
def reload_pr2scds_bom
 Reload BoM from PR2 SCDS.
def remove_item_reference
 Remove reference from item.
def restore_note
 Restore (un-delete) note for item.
def setKV
 Set value of component's key.
def setNote
 Sets notes of component Sets a note value for the component.

Public Attributes

 cj
 debug
 loggedin
 opener
 password
 site
 username

Private Member Functions

def _login
 Login to inventory system with given username and password Returns True if successful, False if failure.

Private Attributes

 _logged_time

Detailed Description

Stores username and password, provides access to invent.

Performs all action relating to inventory system Will login automatically before all functions if needed

Definition at line 65 of file invent_client.py.


Member Function Documentation

def wg_invent_client::invent_client::Invent::__init__ (   self,
  username,
  password,
  debug = False 
)
Parameters:
username str : Username for WG invent system
password str : Password for WG invent system

Definition at line 68 of file invent_client.py.

def wg_invent_client::invent_client::Invent::_login (   self  )  [private]

Login to inventory system with given username and password Returns True if successful, False if failure.

Definition at line 93 of file invent_client.py.

def wg_invent_client::invent_client::Invent::add_attachment (   self,
  reference,
  name,
  mimetype,
  attachment,
  note = None,
  aid = None 
)

Adds attachment to component.

Adds file as attachment to component. Attachment it encoded to unicode, then uploaded. Mimetype is optional, but helps users view attachments in window.

Parameters:
reference str : Serial number of component
name str : Attachment filename
mimetype MIMEType : MIMEType of file
attachment any : Attachment data
note str : Note to add with attachment (description)
aid str : Attachment ID. If set, attempts to overwrite attachment at ID
Returns:
str : Attachment ID of set attachment

Definition at line 580 of file invent_client.py.

def wg_invent_client::invent_client::Invent::addItemReference (   self,
  key,
  name,
  reference 
)

Add reference to an item.

Parameters:
key str : Serial number of item
name str : Reference name
reference str : Reference value
Returns:
bool : True if reference is valid

Definition at line 284 of file invent_client.py.

def wg_invent_client::invent_client::Invent::check_assembled (   self,
  serial,
  recursive = False 
)

Verifies that component is assembled and parts have passed Qual.

Checks that part is assembled against BoM. All sub-parts must be properly associated to the parent part. All sub-parts must have passed qualification.

Parameters:
serial str : Serial number to check
recursive bool : Check all sub-assemblies for assembly
Returns:
True if part is assembled

Definition at line 159 of file invent_client.py.

def wg_invent_client::invent_client::Invent::check_serial_valid (   self,
  serial 
)

Check invent DB for serial, make sure it is valid.

Returns:
bool : True if serial is valid, False if not

Definition at line 135 of file invent_client.py.

def wg_invent_client::invent_client::Invent::delete_attachment (   self,
  aid 
)

Deletes attachment.

Hard delete.

Returns true if attachment is deleted, or not found.

Parameters:
aid str : Attachment ID
Returns:
bool : True if deleted

Definition at line 672 of file invent_client.py.

def wg_invent_client::invent_client::Invent::delete_note (   self,
  noteid 
)

Delete note for item.

Soft-delete only. Will return True if note has already been deleted

Parameters:
noteid str : Note to delete
Returns:
bool : True if successful

Definition at line 380 of file invent_client.py.

def wg_invent_client::invent_client::Invent::deleteKV (   self,
  reference,
  key 
)

Delete key value for component.

Delete key-value of component.

Parameters:
reference str : Serial number of component
key str : Key (name)
Returns:
True if deleted key properly

Definition at line 488 of file invent_client.py.

def wg_invent_client::invent_client::Invent::generateWGMacaddr (   self,
  key,
  name 
)

Generates Willow Garage mac address for item.

Used for forearm cameras Does not return mac address

Parameters:
key str : Serial number of item
name str : Interface name (ex: "lan0")

Definition at line 311 of file invent_client.py.

def wg_invent_client::invent_client::Invent::get_attachment_info (   self,
  aid 
)

Get attachment info.

Parameters:
aid str : Attachment ID
Returns:
( str, str, str, str ) : reference, docname, username, note, date

Definition at line 642 of file invent_client.py.

def wg_invent_client::invent_client::Invent::get_item_notes (   self,
  reference,
  deleted = False 
)

Gets notes for an item.

Parameters:
reference str : Serial number to check
deleted bool : Retrieve deleted notes in addition to non-deleted notes
Returns:
{ str : str } : Note ID to note text

Definition at line 351 of file invent_client.py.

def wg_invent_client::invent_client::Invent::get_item_references (   self,
  key 
)

Return any references to an item.

References are grouped by name, and are stored as NAME:REFERENCE,... under each item.

Parameters:
key str : Serial number of item
Returns:
{ str : str } : { name, reference }

Definition at line 228 of file invent_client.py.

def wg_invent_client::invent_client::Invent::get_note (   self,
  noteid 
)

Get information about note.

Returns tuple of note information as strings. Reference is serial number. Date is UTC format. "deleted" is "1" for deleted, "0" if not.

Parameters:
noteid str : Note ID
Returns:
(reference, note, username, date, deleted) (str, str, str, str, str) :

Definition at line 429 of file invent_client.py.

def wg_invent_client::invent_client::Invent::get_parent_item (   self,
  reference 
)

Returns parent item (serial number) or location.

Parent may be a location, such as "Recieving", instead of a serial number.

Parameters:
reference str : Serial number to check
Returns:
str : Serial number of parent. None if no parent found

Definition at line 728 of file invent_client.py.

def wg_invent_client::invent_client::Invent::get_sub_items (   self,
  reference,
  recursive = False 
)

Returns list of sub items (references) for a particular parent.

In debug mode, Invent can return list of sub parts recursively

Parameters:
reference str : WG PN of component or assembly
recursive bool [optional] : Sub-sub-...-sub-parts of reference
Returns:
[ str ] : Serial number of sub-assemblies of component

Definition at line 697 of file invent_client.py.

def wg_invent_client::invent_client::Invent::get_test_status (   self,
  reference 
)

Returns True if part has 'Test Status'='PASS', False otherwise.

Definition at line 515 of file invent_client.py.

def wg_invent_client::invent_client::Invent::getItemReferences (   self,
  key 
)

Definition at line 219 of file invent_client.py.

def wg_invent_client::invent_client::Invent::getKV (   self,
  reference,
  key 
)

Return value of component's key Get key-value of component.

Ex: 'PASS' = getKV(my_ref, 'Test Status')

Parameters:
reference str : Serial number of component
key str : Key (name)
Returns:
str : Value, or '' if key doesn't exist

Definition at line 523 of file invent_client.py.

def wg_invent_client::invent_client::Invent::list_attachments (   self,
  key 
)

List all attachments for an item.

Returns:
{ str : str } : Attachment ID to filename

Definition at line 615 of file invent_client.py.

def wg_invent_client::invent_client::Invent::listKVs (   self,
  reference 
)

List Key-Value pairs of component.

Parameters:
reference str : Serial number of component
Returns:
{ str : str } : Key values of component

Definition at line 546 of file invent_client.py.

def wg_invent_client::invent_client::Invent::login (   self  ) 

Logs into Invent.

Returns true if successful

Definition at line 85 of file invent_client.py.

def wg_invent_client::invent_client::Invent::lookup_by_reference (   self,
  ref 
)

Lookup item by a reference.

Item references are stored as key-values. Ex: { "wan0", "005a86000000" } This returns all items associated with a given reference value.

Parameters:
str : Reference to lookup
Returns:
[ str ] : All items serial numbers that matched reference

Definition at line 198 of file invent_client.py.

def wg_invent_client::invent_client::Invent::reload_pr2scds_bom (   self  ) 

Reload BoM from PR2 SCDS.

Loads barcode association tables

Returns:
bool : True if serial is valid, False if not

Definition at line 114 of file invent_client.py.

def wg_invent_client::invent_client::Invent::remove_item_reference (   self,
  key,
  name 
)

Remove reference from item.

Parameters:
key str : Serial number of item
name str : Reference name
Returns:
bool : True if reference was removed. Returns False if no reference found

Definition at line 256 of file invent_client.py.

def wg_invent_client::invent_client::Invent::restore_note (   self,
  noteid 
)

Restore (un-delete) note for item.

Will return True if note has already been restored

Parameters:
noteid str : Note to delete
Returns:
bool : True if successful

Definition at line 404 of file invent_client.py.

def wg_invent_client::invent_client::Invent::setKV (   self,
  reference,
  key,
  value 
)

Set value of component's key.

Set key-value of component. Ex: setKV(my_ref, 'Test Status', 'PASS')

Parameters:
reference str : Serial number of component
key str : Key (name)
value str : Value
Returns:
True if set Key properly

Definition at line 460 of file invent_client.py.

def wg_invent_client::invent_client::Invent::setNote (   self,
  reference,
  note,
  noteid = None 
)

Sets notes of component Sets a note value for the component.

Allows users to set the text of a particular note if the noteid parameter is specified. Returns noteid to allow note edits. Returns None if error.

Parameters:
reference str : Serial number of item
note str : Text of item
noteid int (optional) : Note ID, allows programmatic access to note text

Definition at line 328 of file invent_client.py.


Member Data Documentation

Definition at line 78 of file invent_client.py.

Definition at line 74 of file invent_client.py.

Definition at line 72 of file invent_client.py.

Definition at line 77 of file invent_client.py.

Definition at line 75 of file invent_client.py.

Definition at line 70 of file invent_client.py.

Definition at line 80 of file invent_client.py.

Definition at line 69 of file invent_client.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables


wg_invent_client
Author(s): Scott Hassan, Kevin Watts
autogenerated on Fri Jan 11 09:32:50 2013