Author: bugman
Date: Tue Nov 11 14:43:25 2014
New Revision: 26522
URL: http://svn.gna.org/viewcvs/relax?rev=26522&view=rev
Log:
Python 3 fixes via 2to3 - proper handling of the dict.items() and dict.values()
functions.
These are now all wrapped in list() function calls to ensure that the Python 3
iterators are
converted to list objects before they are accessed.
The command used was:
2to3 -j 4 -w -f dict .
Modified:
trunk/data_store/__init__.py
trunk/graphics/wizards/dipole_pair/VectorFieldPlot.py
trunk/pipe_control/plotting.py
trunk/pipe_control/spectrometer.py
trunk/pipe_control/spectrum.py
trunk/specific_analyses/consistency_tests/api.py
trunk/specific_analyses/jw_mapping/api.py
trunk/specific_analyses/model_free/bmrb.py
trunk/specific_analyses/noe/api.py
trunk/test_suite/shared_data/dispersion/bug_22146_unpacking_r2a_r2b_cluster/cpmg_synthetic.py
trunk/test_suite/system_tests/relax_disp.py
trunk/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py
Modified: trunk/data_store/__init__.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/data_store/__init__.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/data_store/__init__.py (original)
+++ trunk/data_store/__init__.py Tue Nov 11 14:43:25 2014
@@ -334,7 +334,7 @@
# Build the new frequency list structure.
dp.spectrometer_frq_list = []
- for frq in dp.spectrometer_frq.values():
+ for frq in list(dp.spectrometer_frq.values()):
if frq not in dp.spectrometer_frq_list:
dp.spectrometer_frq_list.append(frq)
Modified: trunk/graphics/wizards/dipole_pair/VectorFieldPlot.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/graphics/wizards/dipole_pair/VectorFieldPlot.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/graphics/wizards/dipole_pair/VectorFieldPlot.py (original)
+++ trunk/graphics/wizards/dipole_pair/VectorFieldPlot.py Tue Nov 11
14:43:25 2014
@@ -205,7 +205,7 @@
def __get_arrowname(self, fillcolor='#000000'):
if 'arrows' not in dir(self):
self.arrows = {}
- if fillcolor not in iter(self.arrows.keys()):
+ if fillcolor not in iter(list(self.arrows.keys())):
arrow = etree.SubElement(self.__get_defs(), 'path')
self.arrows[fillcolor] = arrow
arrow.set('id', 'arrow' + str(len(self.arrows)))
@@ -544,7 +544,7 @@
obj = etree.SubElement(self.symbols, name)
else:
obj = etree.SubElement(group, name)
- for i, j in params.items():
+ for i, j in list(params.items()):
obj.set(str(i), str(j))
return obj
@@ -606,7 +606,7 @@
if v != None: d_near *= 1.3 - cosv(v, self.first_point - p)
type_near = 'start'
mon = []
- for ptype, poles in self.field.elements.items():
+ for ptype, poles in list(self.field.elements.items()):
if ptype not in ['monopoles', 'dipoles'] or len(poles) == 0:
continue
for pole in poles:
@@ -1114,7 +1114,7 @@
'''
def __init__ (self, elements={}):
self.elements = {}
- for name, params in elements.items():
+ for name, params in list(elements.items()):
self.add_element(name, params)
'''
Modified: trunk/pipe_control/plotting.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/plotting.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/pipe_control/plotting.py (original)
+++ trunk/pipe_control/plotting.py Tue Nov 11 14:43:25 2014
@@ -371,14 +371,14 @@
continue
# Are the X keys in the Y values?
- if x_keys[0] in y_val.values():
+ if x_keys[0] in list(y_val.values()):
keys_for_values = 'x'
for key in x_keys:
if key not in base_values:
base_values.append(key)
# Are the Y keys in the X values?
- elif y_keys[0] in x_val.values():
+ elif y_keys[0] in list(x_val.values()):
keys_for_values = 'y'
for key in y_keys:
if key not in base_values:
Modified: trunk/pipe_control/spectrometer.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/spectrometer.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/pipe_control/spectrometer.py (original)
+++ trunk/pipe_control/spectrometer.py Tue Nov 11 14:43:25 2014
@@ -135,7 +135,7 @@
del cdp.spectrometer_frq[id]
# Update the structures as needed.
- if frq in cdp.spectrometer_frq_list and frq not in
cdp.spectrometer_frq.values():
+ if frq in cdp.spectrometer_frq_list and frq not in
list(cdp.spectrometer_frq.values()):
cdp.spectrometer_frq_list.pop(cdp.spectrometer_frq_list.index(frq))
cdp.spectrometer_frq_count = len(cdp.spectrometer_frq_list)
Modified: trunk/pipe_control/spectrum.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/spectrum.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/pipe_control/spectrum.py (original)
+++ trunk/pipe_control/spectrum.py Tue Nov 11 14:43:25 2014
@@ -74,7 +74,7 @@
repl = replicated_flags()
# Are all spectra replicated?
- if False in repl.values():
+ if False in list(repl.values()):
all_repl = False
print("All spectra replicated: No.")
else:
Modified: trunk/specific_analyses/consistency_tests/api.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/consistency_tests/api.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/specific_analyses/consistency_tests/api.py (original)
+++ trunk/specific_analyses/consistency_tests/api.py Tue Nov 11 14:43:25 2014
@@ -131,7 +131,7 @@
raise RelaxNoValueError("interatomic distance",
spin_id=spin_id, spin_id2=spin_id2)
# Frequency index.
- if cdp.ct_frq not in cdp.spectrometer_frq.values():
+ if cdp.ct_frq not in list(cdp.spectrometer_frq.values()):
raise RelaxError("No relaxation data corresponding to the
frequency %s has been loaded." % cdp.ct_frq)
# Consistency testing.
Modified: trunk/specific_analyses/jw_mapping/api.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/jw_mapping/api.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/specific_analyses/jw_mapping/api.py (original)
+++ trunk/specific_analyses/jw_mapping/api.py Tue Nov 11 14:43:25 2014
@@ -122,7 +122,7 @@
raise RelaxNoValueError("interatomic distance",
spin_id=spin_id, spin_id2=spin_id2)
# Frequency index.
- if cdp.jw_frq not in cdp.spectrometer_frq.values():
+ if cdp.jw_frq not in list(cdp.spectrometer_frq.values()):
raise RelaxError("No relaxation data corresponding to the
frequency " + repr(cdp.jw_frq) + " has been loaded.")
# Reduced spectral density mapping.
Modified: trunk/specific_analyses/model_free/bmrb.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/model_free/bmrb.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/specific_analyses/model_free/bmrb.py (original)
+++ trunk/specific_analyses/model_free/bmrb.py Tue Nov 11 14:43:25 2014
@@ -73,7 +73,7 @@
}
# Loop over the dictionary.
- for item in map.items():
+ for item in list(map.items()):
# Normal match.
if item[0] == name:
return item[1]
Modified: trunk/specific_analyses/noe/api.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/noe/api.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/specific_analyses/noe/api.py (original)
+++ trunk/specific_analyses/noe/api.py Tue Nov 11 14:43:25 2014
@@ -81,7 +81,7 @@
raise RelaxError("The spectrum types have not been set.")
# Test if the 2 spectra types 'ref' and 'sat' exist.
- if not 'ref' in cdp.spectrum_type.values() or not 'sat' in
cdp.spectrum_type.values():
+ if not 'ref' in list(cdp.spectrum_type.values()) or not 'sat' in
list(cdp.spectrum_type.values()):
raise RelaxError("The reference and saturated NOE spectra have not
been loaded.")
# Loop over the spins.
Modified:
trunk/test_suite/shared_data/dispersion/bug_22146_unpacking_r2a_r2b_cluster/cpmg_synthetic.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/dispersion/bug_22146_unpacking_r2a_r2b_cluster/cpmg_synthetic.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
---
trunk/test_suite/shared_data/dispersion/bug_22146_unpacking_r2a_r2b_cluster/cpmg_synthetic.py
(original)
+++
trunk/test_suite/shared_data/dispersion/bug_22146_unpacking_r2a_r2b_cluster/cpmg_synthetic.py
Tue Nov 11 14:43:25 2014
@@ -267,7 +267,7 @@
min_r2 = min_params[mo_param]
clust_r2 = clust_params[mo_param]
set_r2 = params[mo_param]
- for key, val in min_r2.items():
+ for key, val in list(min_r2.items()):
grid_r2_frq = grid_r2[key]
min_r2_frq = min_r2[key]
clust_r2_frq = min_r2[key]
@@ -376,7 +376,7 @@
if isinstance(getattr(cur_spin, mo_param), dict):
set_r2 = params[mo_param]
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
# Update value to float
set_r2.update({ key : float(val) })
print(cur_spin.model, res_name, cur_spin_id, mo_param, key,
float(val))
@@ -570,7 +570,7 @@
if isinstance(getattr(cur_spin, mo_param), dict):
set_r2 = params[mo_param]
if mo_param not in ds.dx_params:
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
# Update value to float
set_r2.update({ key : float(val) })
print("Setting param:%s to :%f"%(key, float(val)))
Modified: trunk/test_suite/system_tests/relax_disp.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/relax_disp.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/test_suite/system_tests/relax_disp.py (original)
+++ trunk/test_suite/system_tests/relax_disp.py Tue Nov 11 14:43:25 2014
@@ -295,7 +295,7 @@
print(mo_param)
# The R2 is a dictionary, depending on spectrometer frequency.
if isinstance(getattr(cur_spin, mo_param), dict):
- for key, val in getattr(cur_spin, mo_param).items():
+ for key, val in list(getattr(cur_spin, mo_param).items()):
should_be = params[mo_param][key]
print(cur_spin.model, res_name, cur_spin_id, mo_param,
key, float(val), should_be)
self.assertAlmostEqual(val, should_be)
@@ -2071,7 +2071,7 @@
grid_r2 = grid_params[mo_param]
min_r2 = min_params[mo_param]
set_r2 = params[mo_param]
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
grid_r2_frq = grid_r2[key]
min_r2_frq = min_r2[key]
set_r2_frq = set_r2[key]
@@ -2217,7 +2217,7 @@
grid_r2 = grid_params[mo_param]
min_r2 = min_params[mo_param]
set_r2 = params[mo_param]
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
grid_r2_frq = grid_r2[key]
min_r2_frq = min_r2[key]
set_r2_frq = set_r2[key]
@@ -2355,7 +2355,7 @@
grid_r2 = grid_params[mo_param]
min_r2 = min_params[mo_param]
set_r2 = params[mo_param]
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
grid_r2_frq = grid_r2[key]
min_r2_frq = min_r2[key]
set_r2_frq = set_r2[key]
@@ -2494,7 +2494,7 @@
grid_r2 = grid_params[mo_param]
min_r2 = min_params[mo_param]
set_r2 = params[mo_param]
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
grid_r2_frq = grid_r2[key]
min_r2_frq = min_r2[key]
set_r2_frq = set_r2[key]
@@ -2638,7 +2638,7 @@
grid_r2 = grid_params[mo_param]
min_r2 = min_params[mo_param]
set_r2 = params[mo_param]
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
grid_r2_frq = grid_r2[key]
min_r2_frq = min_r2[key]
set_r2_frq = set_r2[key]
Modified: trunk/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py?rev=26522&r1=26521&r2=26522&view=diff
==============================================================================
--- trunk/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py
(original)
+++ trunk/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py Tue Nov
11 14:43:25 2014
@@ -256,7 +256,7 @@
min_r2 = min_params[mo_param]
clust_r2 = clust_params[mo_param]
set_r2 = params[mo_param]
- for key, val in min_r2.items():
+ for key, val in list(min_r2.items()):
grid_r2_frq = grid_r2[key]
min_r2_frq = min_r2[key]
clust_r2_frq = min_r2[key]
@@ -365,7 +365,7 @@
if isinstance(getattr(cur_spin, mo_param), dict):
set_r2 = params[mo_param]
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
# Update value to float
set_r2.update({ key : float(val) })
print(cur_spin.model, res_name, cur_spin_id, mo_param, key,
float(val))
@@ -559,7 +559,7 @@
if isinstance(getattr(cur_spin, mo_param), dict):
set_r2 = params[mo_param]
if mo_param not in ds.dx_params:
- for key, val in set_r2.items():
+ for key, val in list(set_r2.items()):
# Update value to float
set_r2.update({ key : float(val) })
print("Setting param:%s to :%f"%(key, float(val)))
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits