Author: bugman Date: Fri Sep 11 13:52:36 2009 New Revision: 9517 URL: http://svn.gna.org/viewcvs/relax?rev=9517&view=rev Log: Renamed the state.load() and state.save() directory argument from dir_name to dir. This is to bring it in line with the rest of relax. Modified: 1.3/generic_fns/state.py 1.3/prompt/state.py 1.3/test_suite/system_tests/relax_fit.py 1.3/test_suite/system_tests/scripts/1UBQ_relax_fit.py 1.3/test_suite/system_tests/scripts/palmer.py 1.3/test_suite/system_tests/scripts/palmer_omp.py 1.3/test_suite/unit_tests/_prompt/test_state.py 1.3/test_suite/unit_tests/state_testing_base.py Modified: 1.3/generic_fns/state.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/state.py?rev=9517&r1=9516&r2=9517&view=diff ============================================================================== --- 1.3/generic_fns/state.py (original) +++ 1.3/generic_fns/state.py Fri Sep 11 13:52:36 2009 @@ -98,19 +98,19 @@ return True -def load_state(state=None, dir_name=None, force=False): +def load_state(state=None, dir=None, force=False): """Function for loading a saved program state. @keyword state: The saved state file. @type state: str - @keyword dir_name: The path of the state file. - @type dir_name: str + @keyword dir: The path of the state file. + @type dir: str @keyword force: If True, the relax data store will be reset prior to state loading. @type force: bool """ # Open the file for reading. - file = open_read_file(file_name=state, dir=dir_name) + file = open_read_file(file_name=state, dir=dir) # Determine the format of the file. format = determine_format(file) @@ -136,13 +136,13 @@ raise RelaxError("The saved state " + repr(state) + " is not compatible with this version of relax.") -def save_state(state=None, dir_name=None, compress_type=1, force=False, pickle=True): +def save_state(state=None, dir=None, compress_type=1, force=False, pickle=True): """Function for saving the program state. @keyword state: The saved state file. @type state: str - @keyword dir_name: The path of the state file. - @type dir_name: str + @keyword dir: The path of the state file. + @type dir: str @keyword force: Boolean argument which if True causes the file to be overwritten if it already exists. @type force: bool @@ -152,7 +152,7 @@ """ # Open the file for writing. - file = open_write_file(file_name=state, dir=dir_name, force=force, compress_type=compress_type) + file = open_write_file(file_name=state, dir=dir, force=force, compress_type=compress_type) # Pickle the data class and write it to file if pickle: Modified: 1.3/prompt/state.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/state.py?rev=9517&r1=9516&r2=9517&view=diff ============================================================================== --- 1.3/prompt/state.py (original) +++ 1.3/prompt/state.py Fri Sep 11 13:52:36 2009 @@ -36,7 +36,7 @@ class State(User_fn_class): """Class for saving or loading the program state.""" - def load(self, state=None, dir_name=None, force=False): + def load(self, state=None, dir=None, force=False): """Function for loading a saved program state. Keyword Arguments @@ -45,7 +45,7 @@ state: The file name, which can be a string or a file descriptor object, of a saved program state. - dir_name: The name of the directory in which the file is found. + dir: The name of the directory in which the file is found. force: A boolean flag which if True will cause the current program state to be overwritten. @@ -86,20 +86,20 @@ if self.__relax__.interpreter.intro: text = sys.ps3 + "state.load(" text = text + "state=" + repr(state) - text = text + ", dir_name=" + repr(dir_name) + text = text + ", dir=" + repr(dir) text = text + ", force=" + repr(force) + ")" print(text) # The argument checks. check.is_str_or_inst(state, 'file name') - check.is_str(dir_name, 'directory name', can_be_none=True) + check.is_str(dir, 'directory name', can_be_none=True) check.is_bool(force, 'force flag') # Execute the functional code. - load_state(state=state, dir_name=dir_name, force=force) + load_state(state=state, dir=dir, force=force) - def save(self, state=None, dir_name=None, compress_type=1, force=False, pickle=False): + def save(self, state=None, dir=None, compress_type=1, force=False, pickle=False): """Function for saving the program state. Keyword Arguments @@ -108,7 +108,7 @@ state: The file name, which can be a string or a file descriptor object, to save the current program state in. - dir_name: The name of the directory in which to place the file. + dir: The name of the directory in which to place the file. compress_type: The type of compression to use when creating the file. @@ -165,7 +165,7 @@ if self.__relax__.interpreter.intro: text = sys.ps3 + "state.save(" text = text + "state=" + repr(state) - text = text + ", dir_name=" + repr(dir_name) + text = text + ", dir=" + repr(dir) text = text + ", compress_type=" + repr(compress_type) text = text + ", force=" + repr(force) text = text + ", pickle=" + repr(pickle) + ")" @@ -173,10 +173,10 @@ # The argument checks. check.is_str_or_inst(state, 'file name') - check.is_str(dir_name, 'directory name', can_be_none=True) + check.is_str(dir, 'directory name', can_be_none=True) check.is_int(compress_type, 'compression type') check.is_bool(force, 'force flag') check.is_bool(pickle, 'pickle flag') # Execute the functional code. - save_state(state=state, dir_name=dir_name, compress_type=compress_type, force=force, pickle=pickle) + save_state(state=state, dir=dir, compress_type=compress_type, force=force, pickle=pickle) Modified: 1.3/test_suite/system_tests/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/relax_fit.py?rev=9517&r1=9516&r2=9517&view=diff ============================================================================== --- 1.3/test_suite/system_tests/relax_fit.py (original) +++ 1.3/test_suite/system_tests/relax_fit.py Fri Sep 11 13:52:36 2009 @@ -90,7 +90,7 @@ """The Sparky peak height loading test.""" # Load the original state. - self.relax.interpreter._State.load(state='basic_heights_T2_ncyc1', dir_name=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'saved_states', force=True) + self.relax.interpreter._State.load(state='basic_heights_T2_ncyc1', dir=sys.path[-1] + sep+'test_suite'+sep+'shared_data'+sep+'saved_states', force=True) # Create a new data pipe for the new data. self.relax.interpreter._Pipe.create('new', 'relax_fit') Modified: 1.3/test_suite/system_tests/scripts/1UBQ_relax_fit.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/1UBQ_relax_fit.py?rev=9517&r1=9516&r2=9517&view=diff ============================================================================== --- 1.3/test_suite/system_tests/scripts/1UBQ_relax_fit.py (original) +++ 1.3/test_suite/system_tests/scripts/1UBQ_relax_fit.py Fri Sep 11 13:52:36 2009 @@ -104,4 +104,4 @@ grace.write(x_data_type='relax_times', y_data_type='int', norm=True, file='intensities_norm.agr', dir=ds.tmpdir, force=True) # Average peak intensities (normalised). # Save the program state. -state.save('rx.save', dir_name=ds.tmpdir, force=True) +state.save('rx.save', dir=ds.tmpdir, force=True) Modified: 1.3/test_suite/system_tests/scripts/palmer.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/palmer.py?rev=9517&r1=9516&r2=9517&view=diff ============================================================================== --- 1.3/test_suite/system_tests/scripts/palmer.py (original) +++ 1.3/test_suite/system_tests/scripts/palmer.py Fri Sep 11 13:52:36 2009 @@ -49,7 +49,7 @@ palmer.execute(dir=ds.tmpdir + sep + name, force=True) # Save the program state. - state.save(state='stage1.save', dir_name=ds.tmpdir, force=True) + state.save(state='stage1.save', dir=ds.tmpdir, force=True) def exec_stage_2(pipes): @@ -79,7 +79,7 @@ results.write(file='results', dir=ds.tmpdir, force=True) # Save the program state. - state.save(state='stage2.save', dir_name=ds.tmpdir, force=True) + state.save(state='stage2.save', dir=ds.tmpdir, force=True) def exec_stage_3(): @@ -104,7 +104,7 @@ results.write(file='final', dir=ds.tmpdir, force=True) # Save the program state. - state.save(state='stage3.save', dir_name=ds.tmpdir, force=True) + state.save(state='stage3.save', dir=ds.tmpdir, force=True) # Main section of the script. Modified: 1.3/test_suite/system_tests/scripts/palmer_omp.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/scripts/palmer_omp.py?rev=9517&r1=9516&r2=9517&view=diff ============================================================================== --- 1.3/test_suite/system_tests/scripts/palmer_omp.py (original) +++ 1.3/test_suite/system_tests/scripts/palmer_omp.py Fri Sep 11 13:52:36 2009 @@ -60,7 +60,7 @@ palmer.execute(dir=ds.tmpdir + sep + name, force=True) # Save the program state. - state.save(state='stage1.save', dir_name=ds.tmpdir, force=True) + state.save(state='stage1.save', dir=ds.tmpdir, force=True) def exec_stage_2(pipes): @@ -90,7 +90,7 @@ results.write(file='results', dir=ds.tmpdir, force=True) # Save the program state. - state.save(state='stage2.save', dir_name=ds.tmpdir, force=True) + state.save(state='stage2.save', dir=ds.tmpdir, force=True) def exec_stage_3(): @@ -115,7 +115,7 @@ results.write(file='final', dir=ds.tmpdir, force=True) # Save the program state. - state.save(state='stage3.save', dir_name=ds.tmpdir, force=True) + state.save(state='stage3.save', dir=ds.tmpdir, force=True) # Main section of the script. Modified: 1.3/test_suite/unit_tests/_prompt/test_state.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_prompt/test_state.py?rev=9517&r1=9516&r2=9517&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/_prompt/test_state.py (original) +++ 1.3/test_suite/unit_tests/_prompt/test_state.py Fri Sep 11 13:52:36 2009 @@ -57,8 +57,8 @@ self.assertRaises(RelaxStrFileError, self.state.load_state, state=data[1]) - def test_load_argfail_dir_name(self): - """Test the proper failure of the state.load() user function for the dir_name argument.""" + def test_load_argfail_dir(self): + """Test the proper failure of the state.load() user function for the dir argument.""" # Loop over the data types. for data in DATA_TYPES: @@ -67,7 +67,7 @@ continue # The argument test. - self.assertRaises(RelaxNoneStrError, self.state.load_state, state='a', dir_name=data[1]) + self.assertRaises(RelaxNoneStrError, self.state.load_state, state='a', dir=data[1]) def test_save_argfail_state(self): @@ -83,8 +83,8 @@ self.assertRaises(RelaxStrFileError, self.state.save_state, state=data[1]) - def test_save_argfail_dir_name(self): - """Test the proper failure of the state.save() user function for the dir_name argument.""" + def test_save_argfail_dir(self): + """Test the proper failure of the state.save() user function for the dir argument.""" # Loop over the data types. for data in DATA_TYPES: @@ -93,7 +93,7 @@ continue # The argument test. - self.assertRaises(RelaxNoneStrError, self.state.save_state, state='a', dir_name=data[1]) + self.assertRaises(RelaxNoneStrError, self.state.save_state, state='a', dir=data[1]) def test_save_argfail_force(self): Modified: 1.3/test_suite/unit_tests/state_testing_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/state_testing_base.py?rev=9517&r1=9516&r2=9517&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/state_testing_base.py (original) +++ 1.3/test_suite/unit_tests/state_testing_base.py Fri Sep 11 13:52:36 2009 @@ -73,7 +73,7 @@ path = sys.path[-1] # Load the state. - self.state.load_state(state='basic_single_pipe', dir_name=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') + self.state.load_state(state='basic_single_pipe', dir=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') # Get the data pipe. dp = pipes.get_pipe('orig') @@ -102,7 +102,7 @@ path = sys.path[-1] # Load the state. - self.state.load_state(state='basic_single_pipe', dir_name=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') + self.state.load_state(state='basic_single_pipe', dir=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') # Add a new data pipe and some data to it. ds.add('new', 'jw_mapping') @@ -137,7 +137,7 @@ path = sys.path[-1] # Load the state. - self.state.load_state(state='basic_single_pipe', dir_name=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') + self.state.load_state(state='basic_single_pipe', dir=path+sep+'test_suite'+sep+'shared_data'+sep+'saved_states') # Reset. ds.__reset__()