Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 8, 2024
1 parent 92d2fab commit 19e39d3
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 35 deletions.
2 changes: 1 addition & 1 deletion wx/lib/activexwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions wx/lib/agw/artmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import wx
import random

from six import BytesIO
from io import BytesIO

from .fmresources import *

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wx/lib/agw/cubecolourdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wx/lib/agw/customtreectrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions wx/lib/agw/flatmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions wx/lib/agw/flatnotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions wx/lib/agw/floatspin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions wx/lib/analogclock/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wx/lib/colourchooser/pycolourslider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions wx/lib/colourutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wx/lib/embeddedimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import base64

import wx
from six import BytesIO
from io import BytesIO

try:
b64decode = base64.b64decode
Expand Down
2 changes: 1 addition & 1 deletion wx/lib/floatcanvas/Resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion wx/lib/floatcanvas/ScreenShot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from wx import Image as ImageFromStream
from wx import BitmapFromImage

from six import BytesIO
from io import BytesIO
import zlib


Expand Down
2 changes: 1 addition & 1 deletion wx/lib/masked/maskededit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions wx/lib/pdfviewer/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wx/py/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com> / David Mashburn <david.n.mashburn@gmail.com>"

import wx
from six import BytesIO
from io import BytesIO

def getPyIcon(shellName='PyCrust'):
icon = wx.Icon()
Expand Down
2 changes: 1 addition & 1 deletion wx/py/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion wx/py/introspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion wx/py/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion wx/tools/pywxrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 19e39d3

Please sign in to comment.