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

Function suggestMktGrp

scripts/findNonMarket.py:211–316  ·  view source on GitHub ↗
(typeid, mode="grp")

Source from the content-addressed store, hash-verified

209 return attrs
210
211def suggestMktGrp(typeid, mode="grp"):
212 typecat = globalmap_typeid_categoryid[typeid]
213 catname = ""
214 cursor.execute(QUERY_CATEGORYID_CATEGORYNAME, (typecat,))
215 for row in cursor:
216 catname = row[0]
217 typename = ""
218 cursor.execute(QUERY_TYPEID_TYPENAME, (typeid,))
219 for row in cursor:
220 typename = row[0]
221 if catname.lower() == "module" and "civilian" in typename.lower():
222 return 760
223 attrs = getItemAttrs(typeid)
224 implantness = None
225 boosterness = None
226 cpu = None
227 power = None
228 droneBandwidthUsed = None
229 volume = None
230 if "implantness" in attrs:
231 implantness = attrs["implantness"]
232 if "boosterness" in attrs:
233 boosterness = attrs["boosterness"]
234 if "cpu" in attrs:
235 cpu = attrs["cpu"]
236 if "power" in attrs:
237 power = attrs["power"]
238 if "droneBandwidthUsed" in attrs:
239 droneBandwidthUsed = attrs["droneBandwidthUsed"]
240 if "volume" in attrs:
241 volume = attrs["volume"]
242 if mode == "grp":
243 grp = globalmap_typeid_groupid[typeid]
244 comrades = globalmap_groupid_typeid[grp]
245 elif mode == "cat":
246 cat = globalmap_typeid_categoryid[typeid]
247 comrades = globalmap_categoryid_typeid[cat]
248 mktgrps_w_cos = {}
249 for co in comrades:
250 marketgroupid = 0
251 cursor.execute(QUERY_TYPEID_MARKETGROUPID, (co,))
252 for row in cursor:
253 marketgroupid = row[0]
254 if not marketgroupid:
255 continue
256 if not marketgroupid in mktgrps_w_cos:
257 mktgrps_w_cos[marketgroupid] = 0.0
258 similarity_factor = 1.0
259 metagrp = 0
260 cursor.execute(QUERY_TYPEID_METAGROUPID, (co,))
261 for row in cursor:
262 metagrp = row[0]
263 if not metagrp in (0,1,2,14):
264 similarity_factor *= 0.01
265 if implantness or boosterness or cpu or power or droneBandwidthUsed or volume:
266 cgrpattrs = getItemAttrs(co)
267 if implantness:
268 if "implantness" in cgrpattrs:

Callers 1

findNonMarket.pyFile · 0.85

Calls 2

getItemAttrsFunction · 0.85
keysMethod · 0.45

Tested by

no test coverage detected