示例#1
0
 def getMetaGroupByItem(self, item):
     """Get meta group by item"""
     # Check if item is in forced metagroup map
     if item.name in self.ITEMS_FORCEDMETAGROUP:
         # Create meta group from scratch
         metaGroup = types_MetaType()
         # Get meta group info object based on meta group name
         metaGroupInfo = self.getMetaGroup(self.ITEMS_FORCEDMETAGROUP[item.name][0])
         # Get parent item based on its name
         parent = self.getItem(self.ITEMS_FORCEDMETAGROUP[item.name][1])
         # Assign all required for metaGroup variables
         metaGroup.info = metaGroupInfo
         metaGroup.items = item
         metaGroup.parent = parent
         metaGroup.metaGroupID = metaGroupInfo.ID
         metaGroup.parentTypeID = parent.ID
         metaGroup.typeID = item.ID
     # If no forced meta group is provided, try to use item's
     # meta group if any
     else:
         metaGroup = item.metaGroup
     return metaGroup
示例#2
0
文件: market.py 项目: Sectoid/Pyfa
 def getMetaGroupByItem(self, item):
     """Get meta group by item"""
     # Check if item is in forced metagroup map
     if item.name in self.ITEMS_FORCEDMETAGROUP:
         # Create meta group from scratch
         metaGroup = types_MetaType()
         # Get meta group info object based on meta group name
         metaGroupInfo = self.getMetaGroup(self.ITEMS_FORCEDMETAGROUP[item.name][0])
         # Get parent item based on its name
         parent = self.getItem(self.ITEMS_FORCEDMETAGROUP[item.name][1])
         # Assign all required for metaGroup variables
         metaGroup.info = metaGroupInfo
         metaGroup.items = item
         metaGroup.parent = parent
         metaGroup.metaGroupID = metaGroupInfo.ID
         metaGroup.parentTypeID = parent.ID
         metaGroup.typeID = item.ID
     # If no forced meta group is provided, try to use item's
     # meta group if any
     else:
         metaGroup = item.metaGroup
     return metaGroup