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

Function getGroup

eos/db/gamedata/queries.py:193–213  ·  view source on GitHub ↗
(lookfor, eager=None)

Source from the content-addressed store, hash-verified

191
192@cachedQuery(1, "lookfor")
193def getGroup(lookfor, eager=None):
194 if isinstance(lookfor, int):
195 if eager is None:
196 group = get_gamedata_session().query(Group).get(lookfor)
197 else:
198 group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.ID == lookfor).first()
199 elif isinstance(lookfor, str):
200 if lookfor in groupNameMap:
201 id = groupNameMap[lookfor]
202 if eager is None:
203 group = get_gamedata_session().query(Group).get(id)
204 else:
205 group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.ID == id).first()
206 else:
207 # Group names are unique, so we can use first() instead of one()
208 group = get_gamedata_session().query(Group).options(*processEager(eager)).filter(Group.name == lookfor).first()
209 if group is not None:
210 groupNameMap[lookfor] = group.ID
211 else:
212 raise TypeError("Need integer or string as argument")
213 return group
214
215
216categoryNameMap = {}

Callers 3

getT2MwdSpeedMethod · 0.90
getShipSizeMethod · 0.90

Calls 3

get_gamedata_sessionFunction · 0.90
processEagerFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected