Back to index

salome-kernel  6.5.0
Public Member Functions
KERNEL_PY.kernel.diclookup.Lookup Class Reference

List of all members.

Public Member Functions

def __init__
def get_keys
def get_key
def get_value

Detailed Description

a dictionary which can lookup value by key, or keys by value

Definition at line 40 of file diclookup.py.


Constructor & Destructor Documentation

def KERNEL_PY.kernel.diclookup.Lookup.__init__ (   self,
  items = [] 
)
items can be a list of pair_lists or a dictionary

Definition at line 44 of file diclookup.py.

00044 
00045     def __init__(self, items=[]):
00046         """items can be a list of pair_lists or a dictionary"""
00047         dict.__init__(self, items)


Member Function Documentation

def KERNEL_PY.kernel.diclookup.Lookup.get_key (   self,
  value 
)
find the key associated to the given a value. If several keys exist,
only the first is given. To get the whole list, use get_keys instead.

Definition at line 52 of file diclookup.py.

00052 
00053     def get_key(self, value):
00054         """
00055         find the key associated to the given a value. If several keys exist,
00056         only the first is given. To get the whole list, use get_keys instead.
00057         """
00058         list = self.get_keys(value)
00059         if len(list) == 0:
00060             return None
00061         return list[0]

Here is the call graph for this function:

def KERNEL_PY.kernel.diclookup.Lookup.get_keys (   self,
  value 
)
find the key(s) as a list given a value

Definition at line 48 of file diclookup.py.

00048 
00049     def get_keys(self, value):
00050         """find the key(s) as a list given a value"""
00051         return [item[0] for item in self.items() if item[1] == value]

Here is the caller graph for this function:

find the value given a key

Definition at line 62 of file diclookup.py.

00062 
00063     def get_value(self, key):
00064         """find the value given a key"""
00065         return self[key]
00066 
00067 #
00068 # ==============================================================================
00069 # Use cases and unit tests
00070 # ==============================================================================
#

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