Project

General

Profile

Actions

Task #6109

open

leginon python3 conversion

Added by Anchi Cheng about 6 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
10/02/2018
Due date:
% Done:

0%

Estimated time:
Deliverable:

Description

Want to use sinedon for some new projects.


Related issues 1 (1 open0 closed)

Related to Leginon - Bug #9843: Configparser.SafeConfigParser is configparser.ConfigParser in python 3.2AssignedAnchi Cheng01/25/2021

Actions
Actions #1

Updated by Anchi Cheng almost 4 years ago

  • Related to Bug #9843: Configparser.SafeConfigParser is configparser.ConfigParser in python 3.2 added
Actions #2

Updated by Anchi Cheng almost 4 years ago

  • Target version changed from Appion/Leginon Future Version to Appion/Leginon 4.0
Actions #3

Updated by Anchi Cheng over 2 years ago

  • Subject changed from sinedon python3 conversion to leginon python3 conversion

Here are changes I noted down.

SocketServer > socketserver
cPickle
>pickle
ConfigParser ->configparser

  • when index is needed range(10) -> list(range(10)
  • y_dict.has_keyx in y_dict.keys()
  • integer math 5/2 -> 5//2
  • types
    long -> int
    02 octa -> 0o2 octa
  • string module can not be used to operate as an instance of a text string.
  • string.join([‘a’,’b’]) -> “ “.join([‘a’, ‘b’])
    string.join([‘a’,’b’],”:") -> “:“.join([‘a’, ‘b’])
  • Exceptions
  • except Exception, e -> Exception as e
  • sort(cmpfunc0 -> sort(key=functools.cmp_to_key(cmpfunc)
  • numpy
  • numpy.frombuffer(‘REAL’, numpy.int32) -> numpy.frombuffer(b‘REAL’, numpy.int32)
  • numpy.dtype(‘Int’) -> numpy.dtype(‘int’)
  • wxPython
    1,$s/pyDeadObjectError/RuntimeError

1,$s/wx.wizard/wx.adv.wizard

1,$s/Wizard.EVT_WI/EVT_WI

1,$s/from \./from leginon

1,$s/gui.wx/leginon.gui.wx

1,$s/shortHelpString/shortHelp

1,$s/AppendItem(/Append(/g
1,$s/BitmapFromImage/Bitmap/g
1,$s/EmptyBitmap/Bitmap/g
1,$s/FindItemData/FindItem/g
1,$s/SetStringItem/SetItem/g

1,$s/InsertStringItem/InsertItem/g
1,$s/StockCursor/StockCursor/g

dc.BeginDrawing nad EndDrawing dprecated (just comment them out)
wx.colour is not hashable -> tuple(wx.colour)

Actions

Also available in: Atom PDF