original_docstring: Load the game settings from a JSON configuration file.
docstring: Load the game settings from a JSON configuration file.
docstring_tokens: Load the game settings from a JSON configuration file .
code: def load_from_config(self, config_file):
          """Load the game settings from a JSON configuration file."""
          with open(config_file, "r") as f:
              config_data = json.load(f)
  
          self._num_sides = config_data.get("num_sides", DEFAULT_NUM_SIDES)
          self._num_dice = config_data.get("num_dice", DEFAULT_NUM_DICE)
  
          self._categories = []
          for category in config_data.get("categories", []):
              category_type = category.pop("__type__")
              self.add_category(category_type, **category)
code_tokens: def load_from_config ( self , config_file ) : with open ( config_file , "r" ) as f : config_data = json . load ( f ) self . _num_sides = config_data . get ( "num_sides" , DEFAULT_NUM_SIDES ) self . _num_dice = config_data . get ( "num_dice" , DEFAULT_NUM_DICE ) self . _categories = [ ] for category in config_data . get ( "categories" , [ ] ) : category_type = category . pop ( "__type__" ) self . add_category ( category_type , ** category )
short_docstring: Load the game settings from a JSON configuration file.
short_docstring_tokens: Load the game settings from a JSON configuration file .
comment: """Load the game settings from a JSON configuration file."""