Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_code(name):
if name in constants.Buildings.keys():
return constants.Buildings[name]
if name in constants.Facilities.keys():
return constants.Facilities[name]
if name in constants.Defense.keys():
return constants.Defense[name]
if name in constants.Ships.keys():
return constants.Ships[name]
if name in constants.Research.keys():
return constants.Research[name]
print('Couldn\'t find code for {}'.format(name))
return None
def _build(self, planet_id, object_id, nbr=None, cancel=False):
if object_id in constants.Buildings.values() or object_id in constants.Facilities.values():
self.build_building(planet_id, object_id, cancel=cancel)
elif object_id in constants.Research.values():
self.build_technology(planet_id, object_id, cancel=cancel)
elif object_id in constants.Ships.values():
self.build_ships(planet_id, object_id, nbr)
elif object_id in constants.Defense.values():
self.build_defense(planet_id, object_id, nbr)
def get_code(name):
if name in constants.Buildings.keys():
return constants.Buildings[name]
if name in constants.Facilities.keys():
return constants.Facilities[name]
if name in constants.Defense.keys():
return constants.Defense[name]
if name in constants.Ships.keys():
return constants.Ships[name]
if name in constants.Research.keys():
return constants.Research[name]
print('Couldn\'t find code for {}'.format(name))
return None