def __refresh_Sys_Recipes(self): sys_dir_path = Filename("{}/*.shv".format(_path.SYSTEMS)) sys_files = glob(sys_dir_path.toOsLongName()) sys_recipes = {} for sys_file in sys_files: base_name = os_path.basename(sys_file) sys_name = os_path.splitext(base_name)[0] sys_recipes[sys_name] = SC.compile_sys_recipe(sys_file) return sys_recipes
def __get_Recipe(self, planet_spec): if type(planet_spec) == type(""): # Shiva str. if "\n" in planet_spec: recipe = SC.compile_body_recipe(planet_spec) # Planet name. else: shv_path = Filename("{}/{}/{}.shv".format(_path.BODIES, planet_spec, planet_spec)) with open(shv_path.toOsLongName()) as shv_file: lines = shv_file.readlines() shiva_str = "".join(lines) recipe = SC.compile_body_recipe(shiva_str) # Recipe given. else: recipe = planet_spec return recipe
def __get_Recipe(self, planet_spec): if type(planet_spec) == type(""): # Shiva str. if "\n" in planet_spec: recipe = SC.compile_body_recipe(planet_spec) # Planet name. else: shv_path = Filename("{}/{}/{}.shv".format( _path.BODIES, planet_spec, planet_spec)) with open(shv_path.toOsLongName()) as shv_file: lines = shv_file.readlines() shiva_str = "".join(lines) recipe = SC.compile_body_recipe(shiva_str) # Recipe given. else: recipe = planet_spec return recipe