def lookup_asset_types(self, sids):
        """
        Retrieve asset types for a list of sids.

        Parameters
        ----------
        sids : list[int]

        Returns
        -------
        types : dict[sid -> str or None]
            Asset types for the provided sids.
        """
        found = {}
        missing = set()

        for sid in sids:
            try:
                found[sid] = self._asset_type_cache[sid]
            except KeyError:
                missing.add(sid)

        if not missing:
            return found

        router_cols = self.asset_router.c

        for assets in group_into_chunks(missing):
            query = sa.select((router_cols.sid, router_cols.asset_type)).where(
                self.asset_router.c.sid.in_(map(int, assets))
            )
            for sid, type_ in query.execute().fetchall():
                missing.remove(sid)
                found[sid] = self._asset_type_cache[sid] = type_

            for sid in missing:
                found[sid] = self._asset_type_cache[sid] = None

        return found
def lookup_asset_types ( self , sids ) : found = { } missing = set ( ) for sid in sids : try : found [ sid ] = self . _asset_type_cache [ sid ] except KeyError : missing . add ( sid ) if not missing : return found router_cols = self . asset_router . c for assets in group_into_chunks ( missing ) : query = sa . select ( ( router_cols . sid , router_cols . asset_type ) ) . where ( self . asset_router . c . sid . in_ ( map ( int , assets ) ) ) for sid , type_ in query . execute ( ) . fetchall ( ) : missing . remove ( sid ) found [ sid ] = self . _asset_type_cache [ sid ] = type_ for sid in missing : found [ sid ] = self . _asset_type_cache [ sid ] = None return found
Retrieve asset types for a list of sids.

        Parameters
        ----------
        sids : list[int]

        Returns
        -------
        types : dict[sid -> str or None]
            Asset types for the provided sids.