Next / Previous / Contents / TCC Help System / NM Tech homepage

26.1. ClientConfig.__init__(): Constructor

hwscan3.py
# - - -   C l i e n t C o n f i g . _ _ i n i t _ _

    def __init__ ( self, reportInfo, hostName, os, hardMap ):
        '''Constructor for ClientConfig.
        '''
        #-- 1 --
        self.reportInfo  =  reportInfo
        self.hostName  =  hostName
        self.os  =  os

The next group of instance attributes to be set up come from the hardMap dictionary entries for various keys. Most of the values are strings, but the CPU count, speed, and memory are returned as integers.

hwscan3.py
        #-- 1 --
        self.nCpus  =  hardMap[self.N_CPUS]
        self.speed  =  hardMap[self.SPEED]
        self.arch  =  hardMap[self.ARCH]
        self.memory  =  hardMap[self.MEMORY]

Device configurations are a second-level dictionary contained in hardMap[DEVICES]. In each case, there may be no entry for that device type. If there is an entry for a given device type, add to self.deviceList a list with this structure:

[devType, detail]

where devType is the device type and detail is one of the descriptions found in hardMap.

hwscan3.py
        self.deviceList  =  []
        deviceMap  =  hardMap[self.DEVICES]

        #-- 2 --
        # [ self.deviceList  :=  as invariant ]
        for deviceType in reportInfo.deviceList:
            #-- 2 body --
            # [ if deviceMap has a key equal to deviceType ->
            #     self.deviceList  +:=  a list [deviceType, detail]
            #     where detail is the detail part of the
            #     corresponding value from deviceMap ]
            self.__deviceCheck ( deviceMap, deviceType )