Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
0822cd8
PY3: support print function in PY2
pavoljuhas Sep 25, 2019
15bbfa6
PY3: use fast cPickle module for Python 2
pavoljuhas Sep 25, 2019
e337d56
PY3: fix RawConfigParser import for PY2
pavoljuhas Sep 25, 2019
0cc295a
PY3: use six.StringIO for PY2/PY3 compatibility
pavoljuhas Sep 26, 2019
03fecd3
MNT: drop obsolete test code
pavoljuhas Sep 26, 2019
984df64
MNT: add todo-list of sources for 2to3 conversion
pavoljuhas Sep 26, 2019
ae9f498
PY3: 2to3 conversion of applications/pdfgui.py
pavoljuhas Sep 26, 2019
cefbaec
PY3: 2to3 check of control/calculation.py
pavoljuhas Sep 26, 2019
7dd95d0
PY3: 2to3 check of control/constraint.py
pavoljuhas Sep 26, 2019
8e67f19
PY3: 2to3 check of control/fitdataset.py
pavoljuhas Sep 26, 2019
28cb664
PY3: 2to3 check of control/fitstructure.py
pavoljuhas Sep 26, 2019
4e1e555
PY3: 2to3 check of control/fitting.py
pavoljuhas Sep 26, 2019
ef77eba
PY3: 2to3 check of control/organizer.py
pavoljuhas Sep 26, 2019
42b9c9d
PY3: 2to3 check of control/parameter.py
pavoljuhas Sep 26, 2019
4466b13
PY3: 2to3 check of control/pdfdataset.py
pavoljuhas Sep 26, 2019
ce15162
PY3: 2to3 check of control/pdfguicontrol.py
pavoljuhas Sep 26, 2019
d7f6d7e
PY3: 2to3 check of control/pdfguimacros.py
pavoljuhas Sep 26, 2019
8474e98
PY3: 2to3 check of control/pdflist.py
pavoljuhas Sep 26, 2019
c365b24
PY3: 2to3 check of control/pdfstructure.py
pavoljuhas Sep 26, 2019
e3f5757
PY3: 2to3 check of control/plotter.py
pavoljuhas Sep 26, 2019
453e9ab
PY3: 2to3 check of control/structureviewer.py
pavoljuhas Sep 26, 2019
a85ccc1
PY3: 2to3 check of gui/bondlengthdialog.py
pavoljuhas Sep 26, 2019
c2c3799
PY3: 2to3 check of gui/debugoptions.py
pavoljuhas Sep 26, 2019
1fd2756
PY3: 2to3 check of gui/dopingseriespanel.py
pavoljuhas Sep 26, 2019
1082ece
PY3: use six.moves.urllib for PY2/PY3 compatibility
pavoljuhas Sep 26, 2019
3b02236
PY3: 2to3 check of gui/errorwrapper.py
pavoljuhas Sep 26, 2019
0c75ae5
PY3: 2to3 check of gui/extendedplotframe.py
pavoljuhas Sep 26, 2019
93f0105
PY3: 2to3 check of gui/fittree.py
pavoljuhas Sep 26, 2019
9d613be
PY3: 2to3 check of gui/mainframe.py
pavoljuhas Sep 26, 2019
41fde5c
PY3: 2to3 check of gui/parameterspanel.py
pavoljuhas Sep 26, 2019
3a9a48a
PY3: 2to3 check of gui/phaseconfigurepanel.py
pavoljuhas Sep 26, 2019
19e4fc7
PY3: 2to3 check of gui/phaseconstraintspanel.py
pavoljuhas Sep 26, 2019
2801e1f
PY3: 2to3 check of gui/phasepanelutils.py
pavoljuhas Sep 26, 2019
ccf2aca
PY3: 2to3 check of gui/phasepanelutils.py
pavoljuhas Sep 26, 2019
e28d327
PY3: 2to3 check of gui/temperatureseriespanel.py
pavoljuhas Sep 26, 2019
8320f88
PY3: 2to3 check of gui/tooltips.py
pavoljuhas Sep 26, 2019
d08c0bc
PY3: 2to3 check of tests/testfitstructure.py
pavoljuhas Sep 26, 2019
2d902b2
PY3: 2to3 check of utils.py
pavoljuhas Sep 26, 2019
8ccf410
MNT: note completion of all 2to3 checks
pavoljuhas Sep 26, 2019
7743cd3
REL: add `six` to run dependencies
pavoljuhas Sep 26, 2019
0fa1444
REL: declare support for Python 3.7, 3.6, 3.5
pavoljuhas Sep 26, 2019
4e4baa9
CI: add travis tests for Python 3.5, 3.6, 3.7
pavoljuhas Sep 26, 2019
822e6c6
BLD: build conda for all supported Python versions
pavoljuhas Sep 26, 2019
c5f5af1
TST: use PY3 compatible imports in testdeps
pavoljuhas Sep 26, 2019
1f6ccb2
MNT: fix invalid escape sequences
pavoljuhas Sep 26, 2019
5dc3242
CI: stop using old conda packages
pavoljuhas Sep 26, 2019
a03d4c5
PY3: replace builtin `file()` --> `open()`
pavoljuhas Sep 26, 2019
41d8b0f
MNT: make sure to close any open files
pavoljuhas Sep 26, 2019
da5c13b
BUG: fix staticmethod in CtrlUnpickler class
pavoljuhas Sep 26, 2019
4d1451a
PY3: adjust QuotedConfigParser for Python 3
pavoljuhas Sep 26, 2019
5dfb4a3
PY3: remove unnecessary conversion to ASCII bytes
pavoljuhas Sep 26, 2019
0ceaaa0
PY3: convert text read from project zip to unicode
pavoljuhas Sep 26, 2019
a5a9f46
MNT: make sure string data are saved as unicode
pavoljuhas Sep 26, 2019
533b6e7
MNT: rename `bytes` variable to non-builtin name
pavoljuhas Sep 26, 2019
87ecea5
MNT: use `utf-8` as a standard encoding name
pavoljuhas Sep 26, 2019
121ea63
PY3: fix crashing `quote_plain`, `unquote_plain`
pavoljuhas Sep 30, 2019
3c92f1e
PY3: add `pickle_loads` with common interface
pavoljuhas Sep 30, 2019
e316562
PY3: unpickle FitDataSet with latin1 encoding
pavoljuhas Sep 30, 2019
a0c745e
ENH: write pickles with protocol 2
pavoljuhas Sep 30, 2019
0f363be
MNT: use safeCPickleDumps for all dumps
pavoljuhas Sep 30, 2019
e47cdd7
ENH: use 'encoding=latin1' default in pickle_loads
pavoljuhas Sep 30, 2019
60c62ef
ENH: replace pickle.loads with pickle_loads
pavoljuhas Sep 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PY3: 2to3 check of control/pdfguicontrol.py
  • Loading branch information
pavoljuhas committed Sep 26, 2019
commit ce15162995da49199a3d31ea85ce85b35d71f9d3
1 change: 0 additions & 1 deletion TODO-2to3.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
src/diffpy/pdfgui/control/pdfguicontrol.py
src/diffpy/pdfgui/control/pdfguimacros.py
src/diffpy/pdfgui/control/pdflist.py
src/diffpy/pdfgui/control/pdfstructure.py
Expand Down
25 changes: 11 additions & 14 deletions src/diffpy/pdfgui/control/pdfguicontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run(self):
while self.running:
try:
self.control.checkQueue()
except ControlError, error:
except ControlError as error:
gui = self.control.gui
if gui:
gui.postEvent(gui.ERROR, "<Queue exception> %s"%error.info)
Expand Down Expand Up @@ -249,8 +249,7 @@ def add(self, ID, position = None):
"""
if not isinstance(ID, Fitting) and \
not isinstance(ID, Calculation):
raise ControlTypeError, "Can't add %s to list"%\
self.__class__.__name__
raise ControlTypeError("Can't add %s to list" % self.__class__.__name__)
if position is not None:
self.fits.insert(position, ID)
else:
Expand All @@ -271,8 +270,7 @@ def __findOwner(self, ID):
try:
return ID.owner
except AttributeError:
raise ControlTypeError, "Object %s doesn't exit in the list"\
%ID.name
raise ControlTypeError("Object %s doesn't exit in the list" % ID.name)

def rename(self, ID, new_name):
"""rename Fitting, Calculation, Dataset or Structure
Expand Down Expand Up @@ -349,7 +347,7 @@ def _nameParser(namelist):
pathDict = fileTree
for x in subs[:-1]:
# if no node has been created
if not pathDict.has_key(x):
if x not in pathDict:
pathDict[x] = {}
pathDict = pathDict[x]

Expand Down Expand Up @@ -378,16 +376,16 @@ def _nameParser(namelist):
if len(z.fileTree) == 0:
raise ControlFileError(emsg_invalid_file)
# The first layer has only one folder
rootDict = z.fileTree.values()[0]
projName = z.fileTree.keys()[0]
rootDict = next(iter(z.fileTree.values()))
projName = next(iter(z.fileTree.keys()))

if rootDict.has_key('journal'):
if 'journal' in rootDict:
self.journal = z.read(projName + '/journal').decode('utf8')

# all the fitting and calculations
#NOTE: It doesn't hurt to keep backward compatibility
# old test project may not have file 'fits'
if rootDict.has_key('fits'):
if 'fits' in rootDict:
ftxt = z.read(projName + '/fits').decode('utf8')
fitnames = ftxt.splitlines()
else:
Expand All @@ -402,7 +400,7 @@ def _nameParser(namelist):
# but let's also handle old project files
if rdname not in rootDict:
rdname = name
if rootDict.has_key(rdname):
if rdname in rootDict:
org = fit.load(z, projName + '/' + rdname + '/')
else:
# it's simply a blank fitting, has no info in proj file yet
Expand Down Expand Up @@ -512,8 +510,7 @@ def stop(self):
def __validateType(self, targetID):
"""check if targetID is a Fitting class"""
if not isinstance(targetID, Organizer):
raise ControlTypeError, "Can't insert to %s"%\
self.__class__.__name__
raise ControlTypeError("Can't insert to %s" % self.__class__.__name__)

def redirectStdout(self):
"""Redirect standard out.
Expand Down Expand Up @@ -568,7 +565,7 @@ class CtrlUnpickler:
def loads(s):
try:
return pickle.loads(s)
except ImportError,err:
except ImportError as err:
missedModule = str(err).split(' ')[-1]
if missedModule.find('pdfgui.control') == -1:
raise err
Expand Down