MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / getItemsByMarketGroup

Method getItemsByMarketGroup

service/market.py:758–786  ·  view source on GitHub ↗

Get items in the given market group

(self, mg, vars_=True)

Source from the content-addressed store, hash-verified

756 return items
757
758 def getItemsByMarketGroup(self, mg, vars_=True):
759 """Get items in the given market group"""
760 result = set()
761 # Get items from eos market group
762 baseitms = set(mg.items)
763 # Add hardcoded items to set
764 if mg.ID in self.ITEMS_FORCEDMARKETGROUP_R:
765 forceditms = set(self.getItem(itmn) for itmn in self.ITEMS_FORCEDMARKETGROUP_R[mg.ID])
766 baseitms.update(forceditms)
767 if vars_:
768 parents = set()
769 for item in baseitms:
770 # Add one of the base market group items to result
771 result.add(item)
772 parent = self.getParentItemByItem(item, selfparent=False)
773 # If item has no parent, it's base item (or at least should be)
774 if parent is None:
775 parents.add(item)
776 # Fetch variations only for parent items
777 variations = self.getVariationsByItems(parents, alreadyparent=True)
778 for variation in variations:
779 # Exclude items with their own explicitly defined market groups
780 if self.getMarketGroupByItem(variation, parentcheck=False) is None:
781 result.add(variation)
782 else:
783 result = baseitms
784 # Get rid of unpublished items
785 result = set([item_ for item_ in result if self.getPublicityByItem(item_)])
786 return result
787
788 def marketGroupHasTypesCheck(self, mg):
789 """If market group has any items, return true"""

Callers 4

getIconByMarketGroupMethod · 0.95
handleMgMethod · 0.95
selectionMadeMethod · 0.80
expandLookupMethod · 0.80

Calls 6

getItemMethod · 0.95
getParentItemByItemMethod · 0.95
getVariationsByItemsMethod · 0.95
getMarketGroupByItemMethod · 0.95
getPublicityByItemMethod · 0.95
updateMethod · 0.45

Tested by

no test coverage detected