Author: bugman Date: Sun Oct 9 13:40:36 2011 New Revision: 14812 URL: http://svn.gna.org/viewcvs/relax?rev=14812&view=rev Log: Updates for Python 3.0 using the Python 2to3 script. The command used was: 2to3 -w \ -f buffer \ -f idioms \ -f set_literal \ -f ws_comma \ -x except \ -x import \ -x imports \ -x long \ -x numliterals \ -x xrange \ relax . All files in the extern package were excluded to allow these to track upstream development in the future. Modified: 1.3/generic_fns/mol_res_spin.py 1.3/gui/analyses/base.py 1.3/gui/analyses/elements.py 1.3/gui/components/conversion.py 1.3/gui/components/grid.py 1.3/gui/controller.py 1.3/gui/menu.py 1.3/gui/misc.py 1.3/gui/spin_viewer/containers.py 1.3/gui/user_functions/base.py 1.3/gui/user_functions/molmol.py 1.3/gui/user_functions/pymol.py 1.3/gui/user_functions/spin.py 1.3/gui/wizard.py 1.3/multi/multi_processor_base.py 1.3/prompt/base_class.py 1.3/sample_scripts/n_state_model/two_domain.py 1.3/test_suite/system_tests/model_free.py Modified: 1.3/generic_fns/mol_res_spin.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/mol_res_spin.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/generic_fns/mol_res_spin.py (original) +++ 1.3/generic_fns/mol_res_spin.py Sun Oct 9 13:40:36 2011 @@ -583,7 +583,7 @@ polymer_type = 'other' # Add the entity. - star.entity.add(mol_name=mol.name, mol_type=mol_type, polymer_type=polymer_type, polymer_seq_code=polymer_seq_code,thiol_state=cdp.exp_info.thiol_state, res_nums=res_nums, res_names=res_names) + star.entity.add(mol_name=mol.name, mol_type=mol_type, polymer_type=polymer_type, polymer_seq_code=polymer_seq_code, thiol_state=cdp.exp_info.thiol_state, res_nums=res_nums, res_names=res_names) def copy_molecule(pipe_from=None, mol_from=None, pipe_to=None, mol_to=None): Modified: 1.3/gui/analyses/base.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/base.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/analyses/base.py (original) +++ 1.3/gui/analyses/base.py Sun Oct 9 13:40:36 2011 @@ -360,7 +360,7 @@ box = wx.BoxSizer(wx.VERTICAL) # Convert the bitmap names to a list. - if type(self.bitmap) != list: + if not isinstance(self.bitmap, list): bitmaps = [self.bitmap] else: bitmaps = self.bitmap Modified: 1.3/gui/analyses/elements.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/analyses/elements.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/analyses/elements.py (original) +++ 1.3/gui/analyses/elements.py Sun Oct 9 13:40:36 2011 @@ -210,7 +210,7 @@ # The button. if button: # Function is in the control class. - if type(fn) == str: + if isinstance(fn, str): # The function. fn = getattr(field, fn) Modified: 1.3/gui/components/conversion.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/components/conversion.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/components/conversion.py (original) +++ 1.3/gui/components/conversion.py Sun Oct 9 13:40:36 2011 @@ -37,7 +37,7 @@ """ # Delete whitespace. - string = replace(string, ' ','') + string = replace(string, ' ', '') # Strip string. values = split(string, '*') Modified: 1.3/gui/components/grid.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/components/grid.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/components/grid.py (original) +++ 1.3/gui/components/grid.py Sun Oct 9 13:40:36 2011 @@ -198,7 +198,7 @@ self.cell.SetValue(str_to_gui(num)) # Set the insertion point to the end. - self.cell.SetSelection(1,1) + self.cell.SetSelection(1, 1) # Skip everything else. else: @@ -333,7 +333,7 @@ self.vc_time.SetToolTipString("Time of counter loop in seconds.") self.vc_time.SetMinSize((50, 20)) self.vc_time.SetFont(wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) - button_sizer.Add(self.vc_time, 0, 0 ,0) + button_sizer.Add(self.vc_time, 0, 0, 0) # Action of Button self.gui.Bind(wx.EVT_BUTTON, lambda event, vc=True: self.load_delay(event, vc), add_vc) Modified: 1.3/gui/controller.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/controller.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/controller.py (original) +++ 1.3/gui/controller.py Sun Oct 9 13:40:36 2011 @@ -768,7 +768,7 @@ stream_list = [0] # Loop until the queue is empty. - while 1: + while True: # End condition. if self.log_queue.empty(): break Modified: 1.3/gui/menu.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/menu.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/menu.py (original) +++ 1.3/gui/menu.py Sun Oct 9 13:40:36 2011 @@ -334,7 +334,7 @@ id = self.add_class(name="relax_fit", text="relax_&fit", icon=None) self.add_uf(parent_id=id, name="relax_fit.relax_time", text="&relax_time", icon=None, fn=user_functions.relax_fit.relax_time) - self.add_uf(parent_id=id, name="relax_fit.select_model", text="&select_model", icon=None,fn=user_functions.relax_fit.select_model) + self.add_uf(parent_id=id, name="relax_fit.select_model", text="&select_model", icon=None, fn=user_functions.relax_fit.select_model) id = self.add_class(name="residue", text="resid&ue", icon=paths.icon_16x16.residue) self.add_uf(parent_id=id, name="residue.copy", text="©", icon=paths.icon_16x16.copy, fn=user_functions.residue.copy) Modified: 1.3/gui/misc.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/misc.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/misc.py (original) +++ 1.3/gui/misc.py Sun Oct 9 13:40:36 2011 @@ -203,18 +203,18 @@ return None # Already a float. - if type(string) == float: + if isinstance(string, float): return string # Convert. val = eval(string) # An int. - if type(val) == int: + if isinstance(val, int): val = float(val) # Not a float! - if type(val) != float: + if not isinstance(val, float): return string # A float. @@ -235,14 +235,14 @@ return None # Already an int. - if type(string) == int: + if isinstance(string, int): return string # Convert. val = eval(string) # Not an int! - if type(val) != int: + if not isinstance(val, int): return string # An int. @@ -263,7 +263,7 @@ return None # Already an int or list. - if type(string) == int or type(string) == list: + if isinstance(string, int) or isinstance(string, list): return string # Convert. @@ -294,7 +294,7 @@ # Convert. val = eval(string) - if type(val) != list: + if not isinstance(val, list): val = [val] # Return the list. Modified: 1.3/gui/spin_viewer/containers.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/spin_viewer/containers.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/spin_viewer/containers.py (original) +++ 1.3/gui/spin_viewer/containers.py Sun Oct 9 13:40:36 2011 @@ -540,8 +540,7 @@ # Dictionary types. elif obj_type == 'dict': # The keys. - keys = obj.keys() - keys.sort() + keys = sorted(obj.keys()) # Single entry (or None). if len(keys) < 2: Modified: 1.3/gui/user_functions/base.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/base.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/user_functions/base.py (original) +++ 1.3/gui/user_functions/base.py Sun Oct 9 13:40:36 2011 @@ -184,14 +184,14 @@ stripped_text = _strip_lead(text) # Remove the first characters if newlines. - while 1: + while True: if stripped_text[0] == "\n": stripped_text = stripped_text[1:] else: break # Remove the last character if a newline. - while 1: + while True: if stripped_text[-1] == "\n": stripped_text = stripped_text[:-1] else: Modified: 1.3/gui/user_functions/molmol.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/molmol.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/user_functions/molmol.py (original) +++ 1.3/gui/user_functions/molmol.py Sun Oct 9 13:40:36 2011 @@ -264,7 +264,7 @@ self.force = self.boolean_selector(sizer, "Force flag:", tooltip=self.uf._doc_args_dict['force'], default=True) # The data type. - self.data_type = self.combo_box(sizer, "The data type:", choices=['S2', 'S2f', 'S2s', 'amp_fast', 'amp_slow', 'te', 'tf', 'ts',' time_fast', 'time_slow', 'Rex'], tooltip=self.uf._doc_args_dict['data_type']) + self.data_type = self.combo_box(sizer, "The data type:", choices=['S2', 'S2f', 'S2s', 'amp_fast', 'amp_slow', 'te', 'tf', 'ts', ' time_fast', 'time_slow', 'Rex'], tooltip=self.uf._doc_args_dict['data_type']) # The style. self.style = self.input_field(sizer, "The style:", tooltip=self.uf._doc_args_dict['style']) Modified: 1.3/gui/user_functions/pymol.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/pymol.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/user_functions/pymol.py (original) +++ 1.3/gui/user_functions/pymol.py Sun Oct 9 13:40:36 2011 @@ -287,7 +287,7 @@ self.force = self.boolean_selector(sizer, "Force flag:", tooltip=self.uf._doc_args_dict['force'], default=True) # The data type. - self.data_type = self.combo_box(sizer, "The data type:", choices=['S2', 'S2f', 'S2s', 'amp_fast', 'amp_slow', 'te', 'tf', 'ts',' time_fast', 'time_slow', 'Rex'], tooltip=self.uf._doc_args_dict['data_type']) + self.data_type = self.combo_box(sizer, "The data type:", choices=['S2', 'S2f', 'S2s', 'amp_fast', 'amp_slow', 'te', 'tf', 'ts', ' time_fast', 'time_slow', 'Rex'], tooltip=self.uf._doc_args_dict['data_type']) # The style. self.style = self.input_field(sizer, "The style:", tooltip=self.uf._doc_args_dict['style']) Modified: 1.3/gui/user_functions/spin.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/user_functions/spin.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/user_functions/spin.py (original) +++ 1.3/gui/user_functions/spin.py Sun Oct 9 13:40:36 2011 @@ -524,7 +524,7 @@ self.spin_id = self.spin_id_element(sizer, desc="Restrict the element setting to the spins:") # The element. - self.element = self.combo_box(sizer, "The element:", tooltip=self.uf._doc_args_dict['element'], choices=['H', 'N', 'C','O', 'P'], read_only=False) + self.element = self.combo_box(sizer, "The element:", tooltip=self.uf._doc_args_dict['element'], choices=['H', 'N', 'C', 'O', 'P'], read_only=False) # The force flag. self.force = self.boolean_selector(sizer, "The force flag:", tooltip=self.uf._doc_args_dict['force'], default=False) Modified: 1.3/gui/wizard.py URL: http://svn.gna.org/viewcvs/relax/1.3/gui/wizard.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/gui/wizard.py (original) +++ 1.3/gui/wizard.py Sun Oct 9 13:40:36 2011 @@ -1395,7 +1395,7 @@ yield current # Loop over the sequence. - while 1: + while True: # Update. next = self._seq_next[current] current = next Modified: 1.3/multi/multi_processor_base.py URL: http://svn.gna.org/viewcvs/relax/1.3/multi/multi_processor_base.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/multi/multi_processor_base.py (original) +++ 1.3/multi/multi_processor_base.py Sun Oct 9 13:40:36 2011 @@ -257,7 +257,7 @@ self.assert_on_master() running_set = set() - idle_set = set([i for i in range(1, self.processor_size()+1)]) + idle_set = {i for i in range(1, self.processor_size()+1)} if self.threaded_result_processing: result_queue = Threaded_result_queue(self) Modified: 1.3/prompt/base_class.py URL: http://svn.gna.org/viewcvs/relax/1.3/prompt/base_class.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/prompt/base_class.py (original) +++ 1.3/prompt/base_class.py Sun Oct 9 13:40:36 2011 @@ -119,14 +119,14 @@ stripped_text = _strip_lead(text) # Remove the first characters if newlines. - while 1: + while True: if stripped_text[0] == "\n": stripped_text = stripped_text[1:] else: break # Remove the last character if a newline. - while 1: + while True: if stripped_text[-1] == "\n": stripped_text = stripped_text[:-1] else: Modified: 1.3/sample_scripts/n_state_model/two_domain.py URL: http://svn.gna.org/viewcvs/relax/1.3/sample_scripts/n_state_model/two_domain.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/sample_scripts/n_state_model/two_domain.py (original) +++ 1.3/sample_scripts/n_state_model/two_domain.py Sun Oct 9 13:40:36 2011 @@ -150,7 +150,7 @@ print("# fk: %s" % cdp.chi2) # Pivot point. -piv = [ 12.067 , 14.313 , -3.2675] # Ave between 1J70 AND 1J7P (model 2). +piv = [ 12.067, 14.313, -3.2675] # Ave between 1J70 AND 1J7P (model 2). # Centre of mass analysis. n_state_model.CoM(pivot_point=piv) Modified: 1.3/test_suite/system_tests/model_free.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/system_tests/model_free.py?rev=14812&r1=14811&r2=14812&view=diff ============================================================================== --- 1.3/test_suite/system_tests/model_free.py (original) +++ 1.3/test_suite/system_tests/model_free.py Sun Oct 9 13:40:36 2011 @@ -2575,25 +2575,25 @@ self.assertEqual(spin.s2s, None, msg=mesg) # te correlation time. - if type(te) == float: + if isinstance(te, float): self.assertAlmostEqual(spin.te / 1e-12, te, 5, msg=mesg) elif te == None: self.assertEqual(spin.te, None, msg=mesg) # tf correlation time. - if type(tf) == float: + if isinstance(tf, float): self.assertAlmostEqual(spin.tf / 1e-12, tf, 4, msg=mesg) elif tf == None: self.assertEqual(spin.tf, None, msg=mesg) # ts correlation time. - if type(ts) == float: + if isinstance(ts, float): self.assertAlmostEqual(spin.ts / 1e-12, ts, 4, msg=mesg) elif ts == None: self.assertEqual(spin.ts, None, msg=mesg) # Chemical exchange. - if type(rex) == float: + if isinstance(rex, float): self.assertAlmostEqual(spin.rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2, rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2, msg=mesg) elif rex == None: self.assertEqual(spin.rex, None, msg=mesg)