diff --git a/wx/lib/activexwrapper.py b/wx/lib/activexwrapper.py index 026301a..74f460c 100644 --- a/wx/lib/activexwrapper.py +++ b/wx/lib/activexwrapper.py @@ -66,7 +66,7 @@ def MakeActiveXClass(CoClass, eventClass=None, eventObj=None): """ - if type(CoClass) == type(""): + if type(CoClass) == str: # use the CLSID to get the real class CoClass = win32com.client.CLSIDToClass(CoClass) diff --git a/wx/lib/agw/artmanager.py b/wx/lib/agw/artmanager.py index bf35527..1fdd827 100644 --- a/wx/lib/agw/artmanager.py +++ b/wx/lib/agw/artmanager.py @@ -6,7 +6,7 @@ import wx import random -from six import BytesIO +from io import BytesIO from .fmresources import * @@ -206,7 +206,7 @@ def DrawButton(self, dc, rect, state, input=None): :param `input`: a flag used to call the right method. """ - if input is None or type(input) == type(False): + if input is None or type(input) == bool: self.DrawButtonTheme(dc, rect, state, input) else: self.DrawButtonColour(dc, rect, state, input) @@ -1236,7 +1236,7 @@ def DrawButton(self, dc, rect, theme, state, input=None): :param `input`: a flag used to call the right method. """ - if input is None or type(input) == type(False): + if input is None or type(input) == bool: self.DrawButtonTheme(dc, rect, theme, state, input) else: self.DrawButtonColour(dc, rect, theme, state, input) diff --git a/wx/lib/agw/cubecolourdialog.py b/wx/lib/agw/cubecolourdialog.py index d221036..aa023e6 100644 --- a/wx/lib/agw/cubecolourdialog.py +++ b/wx/lib/agw/cubecolourdialog.py @@ -2308,7 +2308,7 @@ def OnPaint(self, event): vstep = 1.0/(brightRect.height-1) for y_pos in range(brightRect.y, brightRect.height+brightRect.y): - r, g, b = [c * 255.0 for c in colorsys.hsv_to_rgb(h, s, v)] + r, g, b = (c * 255.0 for c in colorsys.hsv_to_rgb(h, s, v)) colour = wx.Colour(int(r), int(g), int(b)) dc.SetPen(wx.Pen(colour, 1, wx.PENSTYLE_SOLID)) dc.DrawRectangle(brightRect.x, y_pos, brightRect.width, 1) diff --git a/wx/lib/agw/customtreectrl.py b/wx/lib/agw/customtreectrl.py index feaa00a..edc812d 100644 --- a/wx/lib/agw/customtreectrl.py +++ b/wx/lib/agw/customtreectrl.py @@ -5184,7 +5184,7 @@ def InsertItem(self, parentId, input, text, ct_type=0, wnd=None, image=-1, selIm :see: :meth:`~CustomTreeCtrl.DoInsertItem` for possible exceptions generated by this method. """ - if type(input) == type(1): + if type(input) == int: return self.InsertItemByIndex(parentId, input, text, ct_type, wnd, image, selImage, data, separator, on_the_right) else: return self.InsertItemByItem(parentId, input, text, ct_type, wnd, image, selImage, data, separator, on_the_right) diff --git a/wx/lib/agw/flatmenu.py b/wx/lib/agw/flatmenu.py index 2f47d8a..6c9b13a 100644 --- a/wx/lib/agw/flatmenu.py +++ b/wx/lib/agw/flatmenu.py @@ -4097,7 +4097,7 @@ def Move(self, input1, input2=None): :param `input2`: if not ``None``, it is an integer representing the button `y` position. """ - if type(input) == type(1): + if type(input) == int: self._pos = wx.Point(input1, input2) else: self._pos = input1 @@ -4113,7 +4113,7 @@ def SetSize(self, input1, input2=None): :param `input2`: if not ``None``, it is an integer representing the button height. """ - if type(input) == type(1): + if type(input) == int: self._size = wx.Size(input1, input2) else: self._size = input1 @@ -6647,7 +6647,7 @@ def Remove(self, item): :param `item`: can be either a menu item identifier or a plain :class:`FlatMenuItem`. """ - if type(item) != type(1): + if type(item) != int: item = item.GetId() return self._RemoveById(item) @@ -6674,7 +6674,7 @@ def DestroyItem(self, item): :param `item`: can be either a menu item identifier or a plain :class:`FlatMenuItem`. """ - if type(item) != type(1): + if type(item) != int: item = item.GetId() self._DestroyById(item) diff --git a/wx/lib/agw/flatnotebook.py b/wx/lib/agw/flatnotebook.py index e594d2d..c088f33 100644 --- a/wx/lib/agw/flatnotebook.py +++ b/wx/lib/agw/flatnotebook.py @@ -887,12 +887,12 @@ def AdjustColour(colour, percent, alpha=wx.ALPHA_OPAQUE): """ - radj, gadj, badj = [int(val * (abs(percent) / 100.)) for val in colour.Get()] + radj, gadj, badj = (int(val * (abs(percent) / 100.)) for val in colour.Get()) if percent < 0: - radj, gadj, badj = [val * -1 for val in [radj, gadj, badj]] + radj, gadj, badj = (val * -1 for val in [radj, gadj, badj]) else: - radj, gadj, badj = [val or 255 for val in [radj, gadj, badj]] + radj, gadj, badj = (val or 255 for val in [radj, gadj, badj]) red = min(colour.Red() + radj, 255) green = min(colour.Green() + gadj, 255) diff --git a/wx/lib/agw/floatspin.py b/wx/lib/agw/floatspin.py index 87cf810..c5172ee 100644 --- a/wx/lib/agw/floatspin.py +++ b/wx/lib/agw/floatspin.py @@ -1325,7 +1325,7 @@ def __init__(self, value=0, precision=DEFAULT_PRECISION): self.set_precision(precision) p = self.p - if isinstance(value, type("42.3e5")): + if isinstance(value, str): n, exp = _string2exact(value) # exact value is n*10**exp = n*10**(exp+p)/10**p effective_exp = exp + p @@ -1346,7 +1346,7 @@ def __init__(self, value=0, precision=DEFAULT_PRECISION): self.n, self.p = temp.n, temp.p return - if isinstance(value, type(42.0)): + if isinstance(value, float): # XXX ignoring infinities and NaNs and overflows for now import math f, e = math.frexp(abs(value)) diff --git a/wx/lib/analogclock/setup.py b/wx/lib/analogclock/setup.py index 1454713..114ef70 100644 --- a/wx/lib/analogclock/setup.py +++ b/wx/lib/analogclock/setup.py @@ -332,10 +332,10 @@ def __init__(self, parent): def OnChanged(self, evt): clockStyle, hourStyle, minuteStyle = \ - [functools.reduce(lambda x, y: x | y, + (functools.reduce(lambda x, y: x | y, [getattr(styles, item) \ for item in self.GetStringItemsChecked(group)], 0) \ - for group in self.groups] + for group in self.groups) self.clock.SetClockStyle(clockStyle) self.clock.SetTickStyle(hourStyle, styles.HOUR) diff --git a/wx/lib/colourchooser/pycolourslider.py b/wx/lib/colourchooser/pycolourslider.py index 633c886..92fcc4b 100644 --- a/wx/lib/colourchooser/pycolourslider.py +++ b/wx/lib/colourchooser/pycolourslider.py @@ -92,7 +92,7 @@ def DrawBuffer(self): v = 1.0 vstep = 1.0 / self.HEIGHT for y_pos in range(0, self.HEIGHT): - r,g,b = [c * 255.0 for c in colorsys.hsv_to_rgb(h,s,v)] + r,g,b = (c * 255.0 for c in colorsys.hsv_to_rgb(h,s,v)) colour = wx.Colour(int(r), int(g), int(b)) self.buffer.SetPen(wx.Pen(colour, 1, wx.PENSTYLE_SOLID)) self.buffer.DrawRectangle(0, y_pos, 15, 1) diff --git a/wx/lib/colourutils.py b/wx/lib/colourutils.py index 3a145bf..508c614 100644 --- a/wx/lib/colourutils.py +++ b/wx/lib/colourutils.py @@ -57,13 +57,13 @@ def AdjustColour(color, percent, alpha=wx.ALPHA_OPAQUE): specified as input """ - radj, gadj, badj = [ int(val * (abs(percent) / 100.)) - for val in color.Get(includeAlpha=False) ] + radj, gadj, badj = ( int(val * (abs(percent) / 100.)) + for val in color.Get(includeAlpha=False) ) if percent < 0: - radj, gadj, badj = [ val * -1 for val in [radj, gadj, badj] ] + radj, gadj, badj = ( val * -1 for val in [radj, gadj, badj] ) else: - radj, gadj, badj = [ val or 255 for val in [radj, gadj, badj] ] + radj, gadj, badj = ( val or 255 for val in [radj, gadj, badj] ) red = min(color.Red() + radj, 255) green = min(color.Green() + gadj, 255) diff --git a/wx/lib/embeddedimage.py b/wx/lib/embeddedimage.py index 159a682..0ca58b1 100644 --- a/wx/lib/embeddedimage.py +++ b/wx/lib/embeddedimage.py @@ -15,7 +15,7 @@ import base64 import wx -from six import BytesIO +from io import BytesIO try: b64decode = base64.b64decode diff --git a/wx/lib/floatcanvas/Resources.py b/wx/lib/floatcanvas/Resources.py index 84067b0..067cca1 100644 --- a/wx/lib/floatcanvas/Resources.py +++ b/wx/lib/floatcanvas/Resources.py @@ -4,7 +4,7 @@ from wx import Image as ImageFromStream from wx import Bitmap as BitmapFromImage -from six import BytesIO +from io import BytesIO import zlib diff --git a/wx/lib/floatcanvas/ScreenShot.py b/wx/lib/floatcanvas/ScreenShot.py index b308dfa..04a3b37 100644 --- a/wx/lib/floatcanvas/ScreenShot.py +++ b/wx/lib/floatcanvas/ScreenShot.py @@ -4,7 +4,7 @@ from wx import Image as ImageFromStream from wx import BitmapFromImage -from six import BytesIO +from io import BytesIO import zlib diff --git a/wx/lib/masked/maskededit.py b/wx/lib/masked/maskededit.py index 1ecfc5e..43cc0c3 100644 --- a/wx/lib/masked/maskededit.py +++ b/wx/lib/masked/maskededit.py @@ -4425,7 +4425,7 @@ def _adjustFloat(self, candidate=None): 'Fixes' an floating point control. Collapses spaces, right-justifies, etc. """ ## dbg('MaskedEditMixin::_adjustFloat, candidate = "%s"' % candidate, indent=1) - lenInt,lenFraction = [len(s) for s in self._mask.split('.')] ## Get integer, fraction lengths + lenInt,lenFraction = (len(s) for s in self._mask.split('.')) ## Get integer, fraction lengths if candidate is None: value = self._GetValue() else: value = candidate diff --git a/wx/lib/pdfviewer/viewer.py b/wx/lib/pdfviewer/viewer.py index d797bfa..71975cf 100644 --- a/wx/lib/pdfviewer/viewer.py +++ b/wx/lib/pdfviewer/viewer.py @@ -30,7 +30,8 @@ import types import copy import shutil -from six import BytesIO, string_types +from six import string_types +from io import BytesIO import wx @@ -659,7 +660,7 @@ def ProcessOperators(self, opslist, pdf_fonts): if operator == 'cm' and operand: # new transformation matrix # some operands need inverting because directions of y axis # in pdf and graphics context are opposite - a, b, c, d, e, f = [float(n) for n in operand] + a, b, c, d, e, f = (float(n) for n in operand) drawlist.append(['ConcatTransform', (a, -b, -c, d, e, -f), {}]) elif operator == 'q': # save state self.saved_state.append(copy.deepcopy(g)) @@ -668,10 +669,10 @@ def ProcessOperators(self, opslist, pdf_fonts): self.gstate = self.saved_state.pop() drawlist.append(['PopState', (), {}]) elif operator == 'RG': # Stroke RGB - rs, gs, bs = [int(float(n)*255) for n in operand] + rs, gs, bs = (int(float(n)*255) for n in operand) g.strokeRGB = wx.Colour(rs, gs, bs) elif operator == 'rg': # Fill RGB - rf, gf, bf = [int(float(n)*255) for n in operand] + rf, gf, bf = (int(float(n)*255) for n in operand) g.fillRGB = wx.Colour(rf, gf, bf) elif operator == 'K': # Stroke CMYK rs, gs, bs = self.ConvertCMYK(operand) diff --git a/wx/py/images.py b/wx/py/images.py index fd46033..71bee77 100644 --- a/wx/py/images.py +++ b/wx/py/images.py @@ -3,7 +3,7 @@ __author__ = "Patrick K. O'Brien / David Mashburn " import wx -from six import BytesIO +from io import BytesIO def getPyIcon(shellName='PyCrust'): icon = wx.Icon() diff --git a/wx/py/interpreter.py b/wx/py/interpreter.py index eff11c8..f0d866f 100644 --- a/wx/py/interpreter.py +++ b/wx/py/interpreter.py @@ -25,7 +25,7 @@ def __init__(self, locals=None, rawin=None, self.stdout = stdout self.stderr = stderr if rawin: - from six.moves import builtins + import builtins builtins.raw_input = rawin del builtins if showInterpIntro: diff --git a/wx/py/introspect.py b/wx/py/introspect.py index dcff192..ec37b40 100644 --- a/wx/py/introspect.py +++ b/wx/py/introspect.py @@ -8,7 +8,8 @@ import tokenize import types import wx -from six import BytesIO, PY3, string_types +from six import PY3, string_types +from io import BytesIO def getAutoCompleteList(command='', locals=None, includeMagic=1, includeSingle=1, includeDouble=1): diff --git a/wx/py/shell.py b/wx/py/shell.py index 6dec308..fe593ec 100644 --- a/wx/py/shell.py +++ b/wx/py/shell.py @@ -403,7 +403,7 @@ def setBuiltinKeywords(self): This sets "close", "exit" and "quit" to a helpful string. """ - from six.moves import builtins + import builtins builtins.close = builtins.exit = builtins.quit = \ 'Click on the close button to leave the application.' builtins.cd = cd diff --git a/wx/tools/pywxrc.py b/wx/tools/pywxrc.py index 103dc7c..6d3556e 100644 --- a/wx/tools/pywxrc.py +++ b/wx/tools/pywxrc.py @@ -854,7 +854,7 @@ def _OpenOutputFile(self, outputFilename): block = None try: - outputFile = open(outputFilename, "wt") + outputFile = open(outputFilename, "w") except OSError: raise OSError("Can't write output to '%s'" % outputFilename) return outputFile