Commit 811c0538 authored by Whitfield, Ross's avatar Whitfield, Ross
Browse files

Fix all PythonScriptsTest for python3

parent 8ab67e8d
# pylint: disable=too-many-arguments,unused-variable # pylint: disable=too-many-arguments,unused-variable
from mantid.simpleapi import * from mantid.simpleapi import *
from os.path import join from os.path import join
......
from __future__ import (absolute_import, division, print_function)
from .fitting import CrystalField, CrystalFieldFit, CrystalFieldMulti from .fitting import CrystalField, CrystalFieldFit, CrystalFieldMulti
from .function import PeaksFunction, Background, Function from .function import PeaksFunction, Background, Function
#pylint: disable=no-name-in-module #pylint: disable=no-name-in-module
from __future__ import (absolute_import, division, print_function)
from mantid.simpleapi import CrystalFieldEnergies from mantid.simpleapi import CrystalFieldEnergies
import numpy as np import numpy as np
import warnings import warnings
......
from __future__ import (absolute_import, division, print_function)
import numpy as np import numpy as np
import re import re
from mantid.kernel import ConfigService from mantid.kernel import ConfigService
...@@ -167,7 +168,7 @@ class CrystalField(object): ...@@ -167,7 +168,7 @@ class CrystalField(object):
temperature = self._getTemperature(i) temperature = self._getTemperature(i)
out = 'name=CrystalFieldPeaks,Ion=%s,Symmetry=%s,Temperature=%s' % (self._ion, self._symmetry, temperature) out = 'name=CrystalFieldPeaks,Ion=%s,Symmetry=%s,Temperature=%s' % (self._ion, self._symmetry, temperature)
out += ',ToleranceEnergy=%s,ToleranceIntensity=%s' % (self._toleranceEnergy, self._toleranceIntensity) out += ',ToleranceEnergy=%s,ToleranceIntensity=%s' % (self._toleranceEnergy, self._toleranceIntensity)
out += ',%s' % ','.join(['%s=%s' % item for item in self._fieldParameters.items()]) out += ',%s' % ','.join(['%s=%s' % item for item in list(self._fieldParameters.items())])
return out return out
def makeSpectrumFunction(self, i=0): def makeSpectrumFunction(self, i=0):
...@@ -181,7 +182,7 @@ class CrystalField(object): ...@@ -181,7 +182,7 @@ class CrystalField(object):
out += ',PeakShape=%s' % self.getPeak(i).name out += ',PeakShape=%s' % self.getPeak(i).name
if self._FWHM is not None: if self._FWHM is not None:
out += ',FWHM=%s' % self._getFWHM(i) out += ',FWHM=%s' % self._getFWHM(i)
out += ',%s' % ','.join(['%s=%s' % item for item in self._fieldParameters.items()]) out += ',%s' % ','.join(['%s=%s' % item for item in list(self._fieldParameters.items())])
peaks = self.getPeak(i) peaks = self.getPeak(i)
params = peaks.paramString('', 0) params = peaks.paramString('', 0)
if len(params) > 0: if len(params) > 0:
...@@ -217,7 +218,7 @@ class CrystalField(object): ...@@ -217,7 +218,7 @@ class CrystalField(object):
out += ',Temperatures=(%s)' % ','.join(map(str, self._temperature)) out += ',Temperatures=(%s)' % ','.join(map(str, self._temperature))
if self._FWHM is not None: if self._FWHM is not None:
out += ',FWHMs=(%s)' % ','.join(map(str, self._FWHM)) out += ',FWHMs=(%s)' % ','.join(map(str, self._FWHM))
out += ',%s' % ','.join(['%s=%s' % item for item in self._fieldParameters.items()]) out += ',%s' % ','.join(['%s=%s' % item for item in list(self._fieldParameters.items())])
tieList = [] tieList = []
constraintsList = [] constraintsList = []
...@@ -281,7 +282,7 @@ class CrystalField(object): ...@@ -281,7 +282,7 @@ class CrystalField(object):
""" """
if value not in self.ion_nre_map.keys(): if value not in self.ion_nre_map.keys():
msg = 'Value %s is not allowed for attribute Ion.\nList of allowed values: %s' %\ msg = 'Value %s is not allowed for attribute Ion.\nList of allowed values: %s' %\
(value, ', '.join(self.ion_nre_map.keys())) (value, ', '.join(list(self.ion_nre_map.keys())))
raise RuntimeError(msg) raise RuntimeError(msg)
self._ion = value self._ion = value
self._dirty_eigensystem = True self._dirty_eigensystem = True
...@@ -529,7 +530,7 @@ class CrystalField(object): ...@@ -529,7 +530,7 @@ class CrystalField(object):
self._fieldTies[name] = '0' self._fieldTies[name] = '0'
def getFieldTies(self): def getFieldTies(self):
ties = ['%s=%s' % item for item in self._fieldTies.items()] ties = ['%s=%s' % item for item in list(self._fieldTies.items())]
return ','.join(ties) return ','.join(ties)
def getFieldConstraints(self): def getFieldConstraints(self):
...@@ -740,7 +741,7 @@ class CrystalFieldMulti(object): ...@@ -740,7 +741,7 @@ class CrystalFieldMulti(object):
self._ties[tie] = kwargs[tie] self._ties[tie] = kwargs[tie]
def getTies(self): def getTies(self):
ties = ['%s=%s' % item for item in self._ties.items()] ties = ['%s=%s' % item for item in list(self._ties.items())]
return ','.join(ties) return ','.join(ties)
def getSpectrum(self, i=0, workspace=None, ws_index=0): def getSpectrum(self, i=0, workspace=None, ws_index=0):
......
from __future__ import (absolute_import, division, print_function)
import re import re
parNamePattern = re.compile(r'([a-zA-Z][\w.]+)') parNamePattern = re.compile(r'([a-zA-Z][\w.]+)')
...@@ -75,13 +76,13 @@ class Function(object): ...@@ -75,13 +76,13 @@ class Function(object):
def toString(self): def toString(self):
"""Create function initialisation string""" """Create function initialisation string"""
attrib = ['%s=%s' % item for item in self._attrib.items()] + \ attrib = ['%s=%s' % item for item in list(self._attrib.items())] + \
['%s=%s' % item for item in self._params.items()] ['%s=%s' % item for item in list(self._params.items())]
if len(attrib) > 0: if len(attrib) > 0:
out = 'name=%s,%s' % (self._name, ','.join(attrib)) out = 'name=%s,%s' % (self._name, ','.join(attrib))
else: else:
out = 'name=%s' % self._name out = 'name=%s' % self._name
ties = ','.join(['%s=%s' % item for item in self._ties.items()]) ties = ','.join(['%s=%s' % item for item in list(self._ties.items())])
if len(ties) > 0: if len(ties) > 0:
out += ',ties=(%s)' % ties out += ',ties=(%s)' % ties
constraints = ','.join(self._constraints) constraints = ','.join(self._constraints)
...@@ -93,15 +94,15 @@ class Function(object): ...@@ -93,15 +94,15 @@ class Function(object):
"""Create a string with only parameters and attributes settings. """Create a string with only parameters and attributes settings.
The prefix is prepended to all attribute names. The prefix is prepended to all attribute names.
""" """
attrib = ['%s%s=%s' % ((prefix,) + item) for item in self._attrib.items()] + \ attrib = ['%s%s=%s' % ((prefix,) + item) for item in list(self._attrib.items())] + \
['%s%s=%s' % ((prefix,) + item) for item in self._params.items()] ['%s%s=%s' % ((prefix,) + item) for item in list(self._params.items())]
return ','.join(attrib) return ','.join(attrib)
def tiesString(self, prefix): def tiesString(self, prefix):
"""Create a string with only ties settings. """Create a string with only ties settings.
The prefix is prepended to all parameter names. The prefix is prepended to all parameter names.
""" """
ties = ['%s%s=%s' % ((prefix,) + item) for item in self._ties.items()] ties = ['%s%s=%s' % ((prefix,) + item) for item in list(self._ties.items())]
return ','.join(ties) return ','.join(ties)
def constraintsString(self, prefix): def constraintsString(self, prefix):
...@@ -153,7 +154,7 @@ class CompositeProperties(object): ...@@ -153,7 +154,7 @@ class CompositeProperties(object):
def getSize(self): def getSize(self):
"""Get number of maps (functions) defined here""" """Get number of maps (functions) defined here"""
keys = self._properties.keys() keys = list(self._properties.keys())
if len(keys) > 0: if len(keys) > 0:
return max(keys) + 1 return max(keys) + 1
return 0 return 0
...@@ -166,7 +167,7 @@ class CompositeProperties(object): ...@@ -166,7 +167,7 @@ class CompositeProperties(object):
for i in range(self.getSize()): for i in range(self.getSize()):
if i in self._properties: if i in self._properties:
props = self._properties[i] props = self._properties[i]
prop_list.append(','.join(['%s=%s' % item for item in props.items()])) prop_list.append(','.join(['%s=%s' % item for item in sorted(props.items())]))
else: else:
prop_list.append('') prop_list.append('')
return prop_list return prop_list
...@@ -184,7 +185,7 @@ class CompositeProperties(object): ...@@ -184,7 +185,7 @@ class CompositeProperties(object):
props = self._properties[i] props = self._properties[i]
if len(out) > 0: if len(out) > 0:
out += ',' out += ','
out += ','.join(['%s%s=%s' % ((fullPrefix,) + item) for item in props.items()]) out += ','.join(['%s%s=%s' % ((fullPrefix,) + item) for item in sorted(props.items())])
return out[:] return out[:]
...@@ -406,7 +407,7 @@ class Background(object): ...@@ -406,7 +407,7 @@ class Background(object):
def __mul__(self, nCopies): def __mul__(self, nCopies):
"""Make expressions like Background(...) * 8 return a list of 8 identical backgrounds.""" """Make expressions like Background(...) * 8 return a list of 8 identical backgrounds."""
copies = [self] * nCopies copies = [self] * nCopies
return map(Background.clone, copies) return list(map(Background.clone, copies))
# return [self.clone() for i in range(nCopies)] # return [self.clone() for i in range(nCopies)]
def __rmul__(self, nCopies): def __rmul__(self, nCopies):
......
#pylint: disable=too-many-lines #pylint: disable=too-many-lines
#pylint: disable=invalid-name #pylint: disable=invalid-name
#pylind: disable=attribute-defined-outside-init #pylind: disable=attribute-defined-outside-init
from __future__ import (absolute_import, division, print_function)
from mantid.simpleapi import * from mantid.simpleapi import *
from mantid.kernel import funcinspect from mantid.kernel import funcinspect
from mantid import geometry,api from mantid import geometry,api
...@@ -11,6 +12,8 @@ import math ...@@ -11,6 +12,8 @@ import math
import time import time
import numpy as np import numpy as np
import collections import collections
from six import iteritems
from six.moves import range
import Direct.CommonFunctions as common import Direct.CommonFunctions as common
import Direct.diagnostics as diagnostics import Direct.diagnostics as diagnostics
...@@ -1087,8 +1090,8 @@ class DirectEnergyConversion(object): ...@@ -1087,8 +1090,8 @@ class DirectEnergyConversion(object):
TOF_range = self.get_TOF_for_energies(workspace,en_list,spectra_id,ei) TOF_range = self.get_TOF_for_energies(workspace,en_list,spectra_id,ei)
def process_block(tof_range): def process_block(tof_range):
tof_range = filter(lambda x: not(math.isnan(x)), tof_range) tof_range = [x for x in tof_range if not(math.isnan(x))]
dt = map(lambda x,y : abs(x - y),tof_range[1:],tof_range[:-1]) dt = list(map(lambda x,y : abs(x - y),tof_range[1:],tof_range[:-1]))
t_step = min(dt) t_step = min(dt)
tof_min = min(tof_range) tof_min = min(tof_range)
tof_max = max(tof_range) tof_max = max(tof_range)
...@@ -1097,7 +1100,7 @@ class DirectEnergyConversion(object): ...@@ -1097,7 +1100,7 @@ class DirectEnergyConversion(object):
nBlocks = len(spectra_id) nBlocks = len(spectra_id)
if nBlocks > 1: if nBlocks > 1:
tof_min,t_step,tof_max = process_block(TOF_range[0]) tof_min,t_step,tof_max = process_block(TOF_range[0])
for ind in xrange(1,nBlocks): for ind in range(1,nBlocks):
tof_min1,t_step1,tof_max1 = process_block(TOF_range[ind]) tof_min1,t_step1,tof_max1 = process_block(TOF_range[ind])
tof_min = min(tof_min,tof_min1) tof_min = min(tof_min,tof_min1)
tof_max = max(tof_max,tof_max1) tof_max = max(tof_max,tof_max1)
...@@ -1482,7 +1485,7 @@ class DirectEnergyConversion(object): ...@@ -1482,7 +1485,7 @@ class DirectEnergyConversion(object):
scale_factor = van_multiplier * sample_multiplier / xsection scale_factor = van_multiplier * sample_multiplier / xsection
for norm_type,val in norm_factor.iteritems(): for norm_type,val in iteritems(norm_factor):
norm_factor[norm_type] = val * scale_factor norm_factor[norm_type] = val * scale_factor
# check for NaN # check for NaN
......
#!/usr/bin/python #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
import os import os
import sys import sys
import platform import platform
...@@ -8,6 +9,7 @@ import copy ...@@ -8,6 +9,7 @@ import copy
from datetime import date from datetime import date
import time import time
from xml.dom import minidom from xml.dom import minidom
from six import iteritems
# the list of instruments this configuration is applicable to # the list of instruments this configuration is applicable to
INELASTIC_INSTRUMENTS = ['MAPS', 'LET', 'MERLIN', 'MARI', 'HET'] INELASTIC_INSTRUMENTS = ['MAPS', 'LET', 'MERLIN', 'MARI', 'HET']
...@@ -85,7 +87,7 @@ class UserProperties(object): ...@@ -85,7 +87,7 @@ class UserProperties(object):
self._rb_dirs[recent_date_id] = rb_folder_or_id self._rb_dirs[recent_date_id] = rb_folder_or_id
if self._recent_dateID: if self._recent_dateID:
max_date = self._start_dates[self._recent_dateID] max_date = self._start_dates[self._recent_dateID]
for date_key, a_date in self._start_dates.iteritems(): for date_key, a_date in iteritems(self._start_dates):
if a_date > max_date: if a_date > max_date:
self._recent_dateID = date_key self._recent_dateID = date_key
max_date = a_date max_date = a_date
...@@ -310,15 +312,15 @@ class UserProperties(object): ...@@ -310,15 +312,15 @@ class UserProperties(object):
def get_all_instruments(self): def get_all_instruments(self):
""" Return list of all instruments, user is working on during this cycle""" """ Return list of all instruments, user is working on during this cycle"""
return self._instrument.values() return list(self._instrument.values())
def get_all_cycles(self): def get_all_cycles(self):
"""Return list of all cycles the user participates in""" """Return list of all cycles the user participates in"""
return self._instrument.keys() return list(self._instrument.keys())
def get_all_rb(self): def get_all_rb(self):
"""Return list of all rb folders the user participates in""" """Return list of all rb folders the user participates in"""
return self._rb_dirs.values() return list(self._rb_dirs.values())
# #
...@@ -544,7 +546,7 @@ class MantidConfigDirectInelastic(object): ...@@ -544,7 +546,7 @@ class MantidConfigDirectInelastic(object):
fh_targ = open(output_file, 'w') fh_targ = open(output_file, 'w')
if not fh_targ: if not fh_targ:
return return
var_to_replace = replacemets_list.keys() var_to_replace = list(replacemets_list.keys())
with open(input_file) as fh_source: with open(input_file) as fh_source:
for line in fh_source: for line in fh_source:
rez = line rez = line
...@@ -572,7 +574,7 @@ class MantidConfigDirectInelastic(object): ...@@ -572,7 +574,7 @@ class MantidConfigDirectInelastic(object):
shutil.copyfile(input_file, output_file) shutil.copyfile(input_file, output_file)
else: else:
self._copy_and_parse_user_file(input_file, output_file, replacement_list) self._copy_and_parse_user_file(input_file, output_file, replacement_list)
os.chmod(output_file, 0777) os.chmod(output_file, 0o777)
ownership_str = "chown {0}:{1} {2}".format(self._user.userID,rb_group, output_file) ownership_str = "chown {0}:{1} {2}".format(self._user.userID,rb_group, output_file)
if platform.system() != 'Windows': if platform.system() != 'Windows':
...@@ -732,7 +734,7 @@ class MantidConfigDirectInelastic(object): ...@@ -732,7 +734,7 @@ class MantidConfigDirectInelastic(object):
# how to check cycle folders, they may not be available # how to check cycle folders, they may not be available
self._cycle_data_folder = set() self._cycle_data_folder = set()
# pylint: disable=W0212 # pylint: disable=W0212
for date_key, folder_id in theUser._cycle_IDs.items(): for date_key, folder_id in list(theUser._cycle_IDs.items()):
self._cycle_data_folder.add(self.get_data_folder_name(theUser._instrument[date_key], folder_id)) self._cycle_data_folder.add(self.get_data_folder_name(theUser._instrument[date_key], folder_id))
# Initialize configuration settings # Initialize configuration settings
self._dynamic_configuration = copy.deepcopy(self._dynamic_options_base) self._dynamic_configuration = copy.deepcopy(self._dynamic_options_base)
...@@ -788,7 +790,7 @@ class MantidConfigDirectInelastic(object): ...@@ -788,7 +790,7 @@ class MantidConfigDirectInelastic(object):
# define and append user scripts search path # define and append user scripts search path
user_path_part = copy.deepcopy(self._python_user_scripts) user_path_part = copy.deepcopy(self._python_user_scripts)
# pylint: disable=W0212 # pylint: disable=W0212
for instr in self._user._instrument.values(): for instr in list(self._user._instrument.values()):
user_path_part.add(os.path.join('direct_inelastic', instr.upper())) user_path_part.add(os.path.join('direct_inelastic', instr.upper()))
for part in user_path_part: for part in user_path_part:
path += ';' + os.path.join(self._script_repo, part) + '/' path += ';' + os.path.join(self._script_repo, part) + '/'
...@@ -849,7 +851,7 @@ class MantidConfigDirectInelastic(object): ...@@ -849,7 +851,7 @@ class MantidConfigDirectInelastic(object):
users_cycles = self._user.get_all_cycles() users_cycles = self._user.get_all_cycles()
users_rb = self._user.get_all_rb() users_rb = self._user.get_all_rb()
# extract rb folder without path, which gives RB group name # extract rb folder without path, which gives RB group name
users_rb = map(os.path.basename,users_rb) users_rb = list(map(os.path.basename,users_rb))
# #
for cycle,rb_name in zip(users_cycles,users_rb): for cycle,rb_name in zip(users_cycles,users_rb):
if key_users_list: if key_users_list:
...@@ -914,7 +916,7 @@ class MantidConfigDirectInelastic(object): ...@@ -914,7 +916,7 @@ class MantidConfigDirectInelastic(object):
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) != 6: if len(sys.argv) != 6:
print "usage: Config.py userID instrument RBNumber cycleID start_date" print("usage: Config.py userID instrument RBNumber cycleID start_date")
exit() exit()
argi = sys.argv[1:] argi = sys.argv[1:]
...@@ -946,19 +948,19 @@ if __name__ == "__main__": ...@@ -946,19 +948,19 @@ if __name__ == "__main__":
# initialize Mantid configuration # initialize Mantid configuration
# its testing route under main so it rightly imports itself # its testing route under main so it rightly imports itself
#pylint: disable=W0406 #pylint: disable=W0406
from ISISDirecInelasticConfig import MantidConfigDirectInelastic, UserProperties from .ISISDirecInelasticConfig import MantidConfigDirectInelastic, UserProperties
mcf = MantidConfigDirectInelastic(MantidDir, rootDir, UserScriptRepoDir, MapMaskDir) mcf = MantidConfigDirectInelastic(MantidDir, rootDir, UserScriptRepoDir, MapMaskDir)
print "Successfully initialized ISIS Inelastic Configuration script generator" print("Successfully initialized ISIS Inelastic Configuration script generator")
rb_user_folder = os.path.join(mcf._home_path, user.userID) rb_user_folder = os.path.join(mcf._home_path, user.userID)
user.rb_dir = rb_user_folder user.rb_dir = rb_user_folder
if not user.rb_dir_exist: if not user.rb_dir_exist:
print "RB folder {0} for user {1} should exist and be accessible to configure this user".format(user.rb_dir, print("RB folder {0} for user {1} should exist and be accessible to configure this user".format(user.rb_dir,
user.userID) user.userID))
exit() exit()
# Configure user # Configure user
mcf.init_user(user.userID, user) mcf.init_user(user.userID, user)
mcf.generate_config() mcf.generate_config()
print "Successfully Configured user: {0} for instrument {1} and RBNum: {2}" \ print("Successfully Configured user: {0} for instrument {1} and RBNum: {2}" \
.format(user.userID, user.instrument, user.rb_folder) .format(user.userID, user.instrument, user.rb_folder))
#pylint: disable=invalid-name #pylint: disable=invalid-name
from __future__ import (absolute_import, division, print_function)
from Direct.PropertiesDescriptors import * from Direct.PropertiesDescriptors import *
from Direct.RunDescriptor import RunDescriptor,RunDescriptorDependent from Direct.RunDescriptor import RunDescriptor,RunDescriptorDependent
...@@ -16,11 +17,11 @@ class NonIDF_Properties(object): ...@@ -16,11 +17,11 @@ class NonIDF_Properties(object):
# logging levels available for user # logging levels available for user
#pylint: disable=unnecessary-lambda #pylint: disable=unnecessary-lambda
log_options = \ log_options = \
{ "error" : (1,lambda (msg): logger.error(msg)), { "error" : (1,lambda msg: logger.error(msg)),
"warning" : (2,lambda (msg): logger.warning(msg)), "warning" : (2,lambda msg: logger.warning(msg)),
"notice" : (3,lambda (msg): logger.notice(msg)), "notice" : (3,lambda msg: logger.notice(msg)),
"information" : (4,lambda (msg): logger.information(msg)), "information" : (4,lambda msg: logger.information(msg)),
"debug" : (5,lambda (msg): logger.debug(msg))} "debug" : (5,lambda msg: logger.debug(msg))}
def __init__(self,Instrument,run_workspace=None): def __init__(self,Instrument,run_workspace=None):
""" initialize main properties, defined by the class """ initialize main properties, defined by the class
...@@ -66,7 +67,7 @@ class NonIDF_Properties(object): ...@@ -66,7 +67,7 @@ class NonIDF_Properties(object):
else: else:
# TODO: reconcile this with Mantid. # TODO: reconcile this with Mantid.
if lev <= self._current_log_level: if lev <= self._current_log_level:
print msg print(msg)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Complex properties with personal descriptors # Complex properties with personal descriptors
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
......
#pylint: disable=too-many-lines #pylint: disable=too-many-lines
#pylint: disable=invalid-name #pylint: disable=invalid-name
""" File contains collection of Descriptors used to define complex """ File contains collection of Descriptors used to define complex
properties in NonIDF_Properties and PropertyManager classes properties in NonIDF_Properties and PropertyManager classes
""" """
from __future__ import (absolute_import, division, print_function)
import os import os
import numpy as np import numpy as np
import math import math
...@@ -17,6 +18,7 @@ from mantid import api,geometry,config ...@@ -17,6 +18,7 @@ from mantid import api,geometry,config
import Direct.ReductionHelpers as prop_helpers import Direct.ReductionHelpers as prop_helpers
#pylint: disable=unused-import #pylint: disable=unused-import
import Direct.CommonFunctions as common import Direct.CommonFunctions as common
import collections
#----------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------
...@@ -194,7 +196,7 @@ class IncidentEnergy(PropDescriptor): ...@@ -194,7 +196,7 @@ class IncidentEnergy(PropDescriptor):
else: else:
if value.find('[') > -1: if value.find('[') > -1:
energy_list = True energy_list = True
value = value.translate(None, '[]').strip() value = value.replace('[','').replace(']','').strip()
else: else:
energy_list = False energy_list = False
en_list = str.split(value,',') en_list = str.split(value,',')
...@@ -381,7 +383,7 @@ class EnergyBins(PropDescriptor): ...@@ -381,7 +383,7 @@ class EnergyBins(PropDescriptor):
def __set__(self,instance,values): def __set__(self,instance,values):
if values is not None: if values is not None:
if isinstance(values,str): if isinstance(values,str):
values = values.translate(None, '[]').strip() values = values.replace('[','').replace(']','').strip()
lst = values.split(',') lst = values.split(',')
self.__set__(instance,lst) self.__set__(instance,lst)
return return
...@@ -514,7 +516,7 @@ class SaveFileName(PropDescriptor): ...@@ -514,7 +516,7 @@ class SaveFileName(PropDescriptor):
if value is None: if value is None:
self._file_name = None self._file_name = None
elif callable(value): elif isinstance(value, collections.Callable):
self._custom_print = value self._custom_print = value
else: else: