diff --git a/wx/py/PyCrust.py b/wx/py/PyCrust.py index 158db8e0..1d7849d6 100644 --- a/wx/py/PyCrust.py +++ b/wx/py/PyCrust.py @@ -71,9 +71,9 @@ def main(): sys.app = app del sys # Cleanup the main namespace some more. - if md.has_key('App') and md['App'] is App: + if 'App' in md and md['App'] is App: del md['App'] - if md.has_key('__main__') and md['__main__'] is __main__: + if '__main__' in md and md['__main__'] is __main__: del md['__main__'] # Start the wxPython event loop. app.MainLoop() diff --git a/wx/py/PyShell.py b/wx/py/PyShell.py index 285cd47f..050ebb7d 100644 --- a/wx/py/PyShell.py +++ b/wx/py/PyShell.py @@ -59,9 +59,9 @@ def main(): # Create an application instance. app = App(0) # Cleanup the main namespace some more. - if md.has_key('App') and md['App'] is App: + if 'App' in md and md['App'] is App: del md['App'] - if md.has_key('__main__') and md['__main__'] is __main__: + if '__main__' in md and md['__main__'] is __main__: del md['__main__'] # Mimic the contents of the standard Python shell's sys.path. import sys diff --git a/wx/py/PySlices.py b/wx/py/PySlices.py index 8b58c585..6d428cef 100644 --- a/wx/py/PySlices.py +++ b/wx/py/PySlices.py @@ -10,8 +10,8 @@ original = __main__.__dict__.keys() __author__ = "Patrick K. O'Brien / " __author__ += "David N. Mashburn " -__cvsid__ = "$Id: PySlices.py 36607 2005-12-30 23:02:03Z RD $" # Hmmm... -__revision__ = "$Revision: 36607 $"[11:-2] #Hmmm... +__cvsid__ = "$Id$" # Hmmm... +__revision__ = "$Revision$"[11:-2] #Hmmm... import wx import os @@ -87,11 +87,11 @@ def main(filename=None): sys.app = app del sys # Cleanup the main namespace some more. - if md.has_key('App') and md['App'] is App: + if 'App' in md and md['App'] is App: del md['App'] - if md.has_key('filename') and md['filename'] is filename: + if 'filename' in md and md['filename'] is filename: del md['filename'] - if md.has_key('__main__') and md['__main__'] is __main__: + if '__main__' in md and md['__main__'] is __main__: del md['__main__'] # Start the wxPython event loop. app.MainLoop() diff --git a/wx/py/PySlicesShell.py b/wx/py/PySlicesShell.py index a189bb6a..f84d4ab4 100644 --- a/wx/py/PySlicesShell.py +++ b/wx/py/PySlicesShell.py @@ -9,8 +9,8 @@ import __main__ original = __main__.__dict__.keys() __author__ = "Patrick K. O'Brien " -__cvsid__ = "$Id: PySlicesShell.py 41078 2006-09-09 00:38:53Z RD $" -__revision__ = "$Revision: 41078 $"[11:-2] +__cvsid__ = "$Id$" +__revision__ = "$Revision$"[11:-2] import wx import os @@ -73,11 +73,11 @@ def main(filename=None): # Create an application instance. app = App(filename=filename) # Cleanup the main namespace some more. - if md.has_key('App') and md['App'] is App: + if 'App' in md and md['App'] is App: del md['App'] - if md.has_key('filename') and md['filename'] is filename: + if 'filename' in md and md['filename'] is filename: del md['filename'] - if md.has_key('__main__') and md['__main__'] is __main__: + if '__main__' in md and md['__main__'] is __main__: del md['__main__'] # Mimic the contents of the standard Python shell's sys.path. import sys diff --git a/wx/py/crust.py b/wx/py/crust.py index 2075c46b..4573f810 100644 --- a/wx/py/crust.py +++ b/wx/py/crust.py @@ -204,7 +204,7 @@ class Calltip(wx.TextCtrl): dispatcher.connect(receiver=self.display, signal=self.ShellClassName+'.calltip') df = self.GetFont() - font = wx.Font(df.GetPointSize(), wx.TELETYPE, wx.NORMAL, wx.NORMAL) + font = wx.Font(df.GetPointSize(), wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) self.SetFont(font) def display(self, calltip): @@ -231,7 +231,7 @@ class SessionListing(wx.TextCtrl): signal=ShellClassName+".loadHistory") df = self.GetFont() - font = wx.Font(df.GetPointSize(), wx.TELETYPE, wx.NORMAL, wx.NORMAL) + font = wx.Font(df.GetPointSize(), wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) self.SetFont(font) def loadHistory(self, history): @@ -260,7 +260,7 @@ class DispatcherListing(wx.TextCtrl): dispatcher.connect(receiver=self.spy) df = self.GetFont() - font = wx.Font(df.GetPointSize(), wx.TELETYPE, wx.NORMAL, wx.NORMAL) + font = wx.Font(df.GetPointSize(), wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) self.SetFont(font) def spy(self, signal, sender): diff --git a/wx/py/frame.py b/wx/py/frame.py index 55b5436c..ca868cde 100644 --- a/wx/py/frame.py +++ b/wx/py/frame.py @@ -792,7 +792,7 @@ class ShellFrameMixin: dlg = wx.lib.dialogs.ScrolledMessageDialog(self, text, title, size = ((700, 540))) - fnt = wx.Font(10, wx.TELETYPE, wx.NORMAL, wx.NORMAL) + fnt = wx.Font(10, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL) dlg.GetChildren()[0].SetFont(fnt) dlg.GetChildren()[0].SetInsertionPoint(0) dlg.ShowModal() diff --git a/wx/py/introspect.py b/wx/py/introspect.py index 3ac954bb..091e4651 100644 --- a/wx/py/introspect.py +++ b/wx/py/introspect.py @@ -177,7 +177,7 @@ def getCallTip(command='', locals=None): pass elif inspect.isfunction(object): # tip1 is a string like: "getCallTip(command='', locals=None)" - argspec = apply(inspect.formatargspec, inspect.getargspec(object)) + argspec = inspect.formatargspec(inspect.getargspec(object)) if dropSelf: # The first parameter to a method is a reference to an # instance, usually coded as "self", and is usually passed diff --git a/wx/py/shell.py b/wx/py/shell.py index 2615e059..5d04ef15 100644 --- a/wx/py/shell.py +++ b/wx/py/shell.py @@ -185,7 +185,7 @@ class ShellFacade: raise AttributeError(name) def __setattr__(self, name, value): - if self.__dict__.has_key(name): + if name in self.__dict__: self.__dict__[name] = value elif hasattr(self.other, name): setattr(self.other, name, value) @@ -418,7 +418,7 @@ class Shell(editwindow.EditWindow): """Execute the user's PYTHONSTARTUP script if they have one.""" if startupScript and os.path.isfile(startupScript): text = 'Startup script executed: ' + startupScript - self.push('print %r; execfile(%r)' % (text, startupScript)) + self.push('print(%r); execfile(%r)' % (text, startupScript)) self.interp.startupScript = startupScript else: self.push('') diff --git a/wx/py/sliceshell.py b/wx/py/sliceshell.py index 1c571040..1a343ac9 100644 --- a/wx/py/sliceshell.py +++ b/wx/py/sliceshell.py @@ -560,7 +560,7 @@ class SlicesShellFacade: raise AttributeError(name) def __setattr__(self, name, value): - if self.__dict__.has_key(name): + if name in self.__dict__: self.__dict__[name] = value elif hasattr(self.other, name): setattr(self.other, name, value) @@ -1001,7 +1001,7 @@ class SlicesShell(editwindow.EditWindow): """Execute the user's PYTHONSTARTUP script if they have one.""" if startupScript and os.path.isfile(startupScript): text = 'Startup script executed: ' + startupScript - self.push('print %r; execfile(%r)' % (text, startupScript)) + self.push('print(%r); execfile(%r)' % (text, startupScript)) self.interp.startupScript = startupScript else: self.push('') diff --git a/wx/py/tests/test_introspect.py b/wx/py/tests/test_introspect.py index b6bd53fa..6b0b28bd 100644 --- a/wx/py/tests/test_introspect.py +++ b/wx/py/tests/test_introspect.py @@ -694,7 +694,7 @@ class GetAttributeNamesTestCase(GetAttributeTestCase): def test_getAttributeNames(self): for item in self.items: self._checkAttributeNames(item) - if __builtins__.has_key('object'): + if 'object' in __builtins__: self._checkAttributeNames(object) def test_getAttributeNames_NoSingle(self): @@ -800,7 +800,7 @@ class C1(A1): class D1(C1, B1): pass -if __builtins__.has_key('object'): +if 'object' in __builtins__: class A2(object): def __init__(self, a): self.a = a @@ -851,7 +851,7 @@ class GetConstructorTestCase(unittest.TestCase): args = ('self', 'a') varnames = introspect.getConstructor(D1).func_code.co_varnames self.assertEqual(varnames, args) - if __builtins__.has_key('object'): + if 'object' in __builtins__: # Test new style inheritance rules as well. args = ('self', 'b') varnames = introspect.getConstructor(D2).func_code.co_varnames