From 383e93801996d4dcb7dfb1a52c22cdce44a50853 Mon Sep 17 00:00:00 2001 From: matchaSamurai <93385586+adityakiran1423@users.noreply.github.com> Date: Wed, 27 Nov 2024 22:03:32 +0530 Subject: [PATCH] Fix indentation (#285) * appended National Science Foundation wherever required * fixed indentation, won't cause IndentationError --- .../electron_configuration_reader.py | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/acom_music_box/connections/electron_configuration_reader.py b/src/acom_music_box/connections/electron_configuration_reader.py index 51ca14e6..0fe50c26 100644 --- a/src/acom_music_box/connections/electron_configuration_reader.py +++ b/src/acom_music_box/connections/electron_configuration_reader.py @@ -10,73 +10,41 @@ class ElectronConfiguraitonReader: """ Reads configuration information from the electron applicant to create a box model simulation. """ - def __init__(self): - self.box_model_options = None - self.species_list = None - self.reaction_list = None - self.initial_conditions = None - self.evolving_conditions = None + def __init__(self): + self.box_model_options = None + self.species_list = None + self.reaction_list = None + self.initial_conditions = None + self.evolving_conditions = None - def read_electron_configuration(self): - with open(self.electron_configuration_file_path, 'r') as file: - for line in file: - element, configuration = line.strip().split(' ') - self.electron_configuration[element] = configuration + def read_electron_configuration(self): + with open(self.electron_configuration_file_path, 'r') as file: + for line in file: + element, configuration = line.strip().split(' ') + self.electron_configuration[element] = configuration - def get_electron_configuration(self, element): - return self.electron_configuration[element] + def get_electron_configuration(self, element): + return self.electron_configuration[element] - def readFromUIJson(self, path_to_json): - """ - Reads and parses a JSON file from the MusicBox Interactive UI to set up the box model simulation. + def readFromUIJson(self, path_to_json): + """ + Reads and parses a JSON file from the MusicBox Interactive UI to set up the box model simulation. - This function takes the path to a JSON file, reads the file, and parses the JSON - to set up the box model simulation. + This function takes the path to a JSON file, reads the file, and parses the JSON + to set up the box model simulation. - Args: - path_to_json (str): The path to the JSON file from the UI. + Args: + path_to_json (str): The path to the JSON file from the UI. - Returns: - None + Returns: + None - Raises: - ValueError: If the JSON file cannot be read or parsed. - """ + Raises: + ValueError: If the JSON file cannot be read or parsed. + """ - with open(path_to_json, 'r') as json_file: - data = json.load(json_file) - - # Set box model options - self.box_model_options = BoxModelOptions.from_UI_JSON(data) - - # Set species list - self.species_list = SpeciesList.from_UI_JSON(data) - - # Set reaction list - self.reaction_list = ReactionList.from_UI_JSON( - data, self.species_list) - - # Set initial conditions - self.initial_conditions = Conditions.from_UI_JSON( - data, self.species_list, self.reaction_list) - - # Set evolving conditions - self.evolving_conditions = EvolvingConditions.from_UI_JSON( - data, self.species_list, self.reaction_list) - - def readFromUIJsonString(self, data): - """ - Reads and parses a JSON string from the MusicBox Interactive UI to set up the box model simulation. - - Args: - json_string (str): The JSON string from the UI. - - Returns: - None - - Raises: - ValueError: If the JSON string cannot be parsed. - """ + with open(path_to_json, 'r') as json_file: + data = json.load(json_file) # Set box model options self.box_model_options = BoxModelOptions.from_UI_JSON(data) @@ -85,7 +53,8 @@ def readFromUIJsonString(self, data): self.species_list = SpeciesList.from_UI_JSON(data) # Set reaction list - self.reaction_list = ReactionList.from_UI_JSON(data, self.species_list) + self.reaction_list = ReactionList.from_UI_JSON( + data, self.species_list) # Set initial conditions self.initial_conditions = Conditions.from_UI_JSON( @@ -94,3 +63,34 @@ def readFromUIJsonString(self, data): # Set evolving conditions self.evolving_conditions = EvolvingConditions.from_UI_JSON( data, self.species_list, self.reaction_list) + + def readFromUIJsonString(self, data): + """ + Reads and parses a JSON string from the MusicBox Interactive UI to set up the box model simulation. + + Args: + json_string (str): The JSON string from the UI. + + Returns: + None + + Raises: + ValueError: If the JSON string cannot be parsed. + """ + + # Set box model options + self.box_model_options = BoxModelOptions.from_UI_JSON(data) + + # Set species list + self.species_list = SpeciesList.from_UI_JSON(data) + + # Set reaction list + self.reaction_list = ReactionList.from_UI_JSON(data, self.species_list) + + # Set initial conditions + self.initial_conditions = Conditions.from_UI_JSON( + data, self.species_list, self.reaction_list) + + # Set evolving conditions + self.evolving_conditions = EvolvingConditions.from_UI_JSON( + data, self.species_list, self.reaction_list)