Get chassis inventory.

        :param modules_inventory: True - read modules inventory, false - don't read.
480737
def inventory(self, modules_inventory=False):
        

        self.c_info = self.get_attributes()
        for m_index, m_portcounts in enumerate(self.c_info['c_portcounts'].split()):
            if int(m_portcounts):
                module = XenaModule(parent=self, index=m_index)
                if modules_inventory:
                    module.inventory()
87433
def load_inventory_from_cache(self):
        '''  '''

        cache = open(self.cache_path_cache, 'r')
        json_inventory = cache.read()
        self.inventory = json.loads(json_inventory)
1279744
def HandleGetDataMessageReceived(self, payload):
        
        inventory = IOHelper.AsSerializableWithType(payload, 'neo.Network.Payloads.InvPayload.InvPayload')
        if not inventory:
            return

        for hash in inventory.Hashes:
            hash = hash.encode('utf-8')

            item = None
            # try to get the inventory to send from relay cache

            if hash in self.leader.RelayCache.keys():
                item = self.leader.RelayCache[hash]

            if inventory.Type == InventoryType.TXInt:
                if not item:
                    item, index = BC.Default().GetTransaction(hash)
                if not item:
                    item = self.leader.GetTransaction(hash)
                if item:
                    message = Message(command='tx', payload=item, print_payload=False)
                    self.SendSerializedMessage(message)

            elif inventory.Type == InventoryType.BlockInt:
                if not item:
                    item = BC.Default().GetBlock(hash)
                if item:
                    message = Message(command='block', payload=item, print_payload=False)
                    self.SendSerializedMessage(message)

            elif inventory.Type == InventoryType.ConsensusInt:
                if item:
                    self.SendSerializedMessage(Message(command='consensus', payload=item, print_payload=False))
604757
def _inventory(self):
        
        if self.dynamic_version_of:
            return self.dynamic_version_of._inventory

        if not hasattr(self, '_inventory_field'):
            self._inventory_field = limpyd_fields.SetField()
            self._inventory_field._attach_to_model(self._model)
            self._inventory_field._attach_to_instance(self._instance)
            self._inventory_field.lockable = True
            self._inventory.name = self.name

        return self._inventory_field
117569
def get(self, name):
        """"""
        if name not in self.modules:
            self.load_dependency(name, False, False, False)

        if name in self.modules:
            return self.modules[name]
        else:
            return None
1179345
def get_inventory_options(self):
        """"""
        ip_type = self.config.get('inventory', 'inventory_ip_type')
        # If the appropriate environment variables are set, they override
        # other configuration
        ip_type = os.environ.get('INVENTORY_IP_TYPE', ip_type)
        return ip_type
70599
def get_inventory_by_name(nme, character):
    

    for ndx, sk in enumerate(character["inventory"]):
        #print("sk = ", sk, " , nme = ", nme)
        if sk["name"] == nme:
            return ndx
    return 0
423183
def get_module(self, module_name):
        """"""
        try:
            return self.module[module_name]

        except KeyError:
            return sys.modules[module_name]
68200
def collect_modules(self):
        
        try:
            res = {}
            m = sys.modules
            for k in m:
                # Don't report submodules (e.g. django.x, django.y, django.z)
                # Skip modules that begin with underscore
                if ('.' in k) or k[0] == '_':
                    continue
                if m[k]:
                    try:
                        d = m[k].__dict__
                        if "version" in d and d["version"]:
                            res[k] = self.jsonable(d["version"])
                        elif "__version__" in d and d["__version__"]:
                            res[k] = self.jsonable(d["__version__"])
                        else:
                            res[k] = get_distribution(k).version
                    except DistributionNotFound:
                        pass
                    except Exception:
                        logger.debug("collect_modules: could not process module: %s" % k)

        except Exception:
            logger.debug("collect_modules", exc_info=True)
        else:
            return res
995180
def fetch_intersphinx_inventory(uri):
    

    # See https://stackoverflow.com/a/30981554
    class MockConfig(object):
        intersphinx_timeout = None
        tls_verify = False

    class MockApp(object):
        srcdir = ''
        config = MockConfig()

        def warn(self, msg):
            warnings.warn(msg)

    return intersphinx.fetch_inventory(MockApp(), '', uri)
852522
def get_loaded_modules(modules):
    ''''''

    _modules = []
    for mod in modules:
        mod_cfg = get_conf_from_module(mod)

        _modules.append((mod, mod_cfg,))

    _modules = sorted(_modules, key=lambda m: m[1].get('ordering'))

    return _modules
1238575
def Relay(self, inventory):
        
        inventory = InvPayload(type=inventory.InventoryType, hashes=[inventory.Hash.ToBytes()])
        m = Message("inv", inventory)
        self.SendSerializedMessage(m)

        return True
78686
def get_inventory_descriptions(self):
        
        yield "System"
        self.init_sdr()
        for fruid in sorted(self._sdr.fru):
            yield self._sdr.fru[fruid].fru_name
        self.oem_init()
        for compname in self._oem.get_oem_inventory_descriptions():
            yield compname
189387
def this_module(npop=1):
    '''
    '''
    stack = inspect.stack()
    st = stack[npop]
    frame = st[0]
    return inspect.getmodule(frame)
1306129
def get_inventory_of_component(self, component):
        
        self.oem_init()
        if component == 'System':
            return self._get_zero_fru()
        self.init_sdr()
        for fruid in self._sdr.fru:
            if self._sdr.fru[fruid].fru_name == component:
                return self._oem.process_fru(fru.FRU(
                    ipmicmd=self, fruid=fruid, sdr=self._sdr.fru[fruid]).info,
                                             component)
        return self._oem.get_inventory_of_component(component)
1149779
def self_inventory(self):
        
        if self.api_key is None:
            return {}

        if self._self_inventory:
            return self._self_inventory

        resp, self_inventory = self.get('Inventory?key=%s' % self.api_key)
        real_self_inventory = dict()

        for host in self_inventory:
            real_self_inventory[host[0]] = self.full_inventory[host[0]]

        self._self_inventory = real_self_inventory

        return self._self_inventory
832634
def lookup(self, lsid):
        
        if self.registered_modules is None or lsid not in self.registered_modules:
            return None
        else:
            return self.registered_modules[lsid]