1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Fix flake8 tests.

For the new flake8.
This commit is contained in:
Shlomi Fish 2018-11-11 22:43:36 +02:00
parent 39bd85f125
commit 908de63d9f
4 changed files with 11 additions and 18 deletions

View file

@ -3098,7 +3098,7 @@ Congratulations, you did it !
try: try:
game = self._loadGame(filename, self.app) game = self._loadGame(filename, self.app)
game.gstats.holded = 0 game.gstats.holded = 0
except AssertionError as ex: except AssertionError:
self.updateMenus() self.updateMenus()
self.setCursor(cursor=self.app.top_cursor) self.setCursor(cursor=self.app.top_cursor)
MfxMessageDialog( MfxMessageDialog(

View file

@ -1023,7 +1023,7 @@ def r(id, short_name, name=None, ncards=144, layout=None):
assert layout assert layout
if not name: if not name:
name = "Mahjongg " + short_name name = "Mahjongg " + short_name
classname = re.sub('\W', '', name) classname = re.sub('\\W', '', name)
# create class # create class
gameclass = type(classname, (AbstractMahjonggGame,), {}) gameclass = type(classname, (AbstractMahjonggGame,), {})
gameclass.L = layout gameclass.L = layout

View file

@ -800,7 +800,7 @@ class Base_Solver_Hint:
return [hint] return [hint]
def colonPrefixMatch(self, prefix, s): def colonPrefixMatch(self, prefix, s):
m = re.match(prefix + ': (\d+)', s) m = re.match(prefix + ': ([0-9]+)', s)
if m: if m:
self._v = int(m.group(1)) self._v = int(m.group(1))
return True return True
@ -1084,12 +1084,12 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
print(s) print(s)
if self._determineIfSolverState(s): if self._determineIfSolverState(s):
next next
m = re.match('Total number of states checked is (\d+)\.', s) m = re.match('Total number of states checked is ([0-9]+)\\.', s)
if m: if m:
iter_ = int(m.group(1)) iter_ = int(m.group(1))
self.dialog.setText(iter=iter_) self.dialog.setText(iter=iter_)
m = re.match('This scan generated (\d+) states\.', s) m = re.match('This scan generated ([0-9]+) states\\.', s)
if m: if m:
states = int(m.group(1)) states = int(m.group(1))
@ -1102,7 +1102,7 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
move_s = m.group(1) move_s = m.group(1)
m = re.match( m = re.match(
'the sequence on top of Stack (\d+) to the foundations', 'the sequence on top of Stack ([0-9]+) to the foundations',
move_s) move_s)
if m: if m:
@ -1113,11 +1113,11 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
dest = None dest = None
else: else:
m = re.match( m = re.match(
'(?P<ncards>a card|(?P<count>\d+) cards) ' '(?P<ncards>a card|(?P<count>[0-9]+) cards) '
'from (?P<source_type>stack|freecell) ' 'from (?P<source_type>stack|freecell) '
'(?P<source_idx>\d+) to ' '(?P<source_idx>[0-9]+) to '
'(?P<dest>the foundations|(?P<dest_type>freecell|stack) ' '(?P<dest>the foundations|(?P<dest_type>freecell|stack) '
'(?P<dest_idx>\d+))\s*', move_s) '(?P<dest_idx>[0-9]+))\\s*', move_s)
if not m: if not m:
continue continue
@ -1230,13 +1230,13 @@ class BlackHoleSolver_Hint(Base_Solver_Hint):
s = six.text_type(sbytes, encoding='utf-8') s = six.text_type(sbytes, encoding='utf-8')
if DEBUG: if DEBUG:
print(s) print(s)
m = re.match('Total number of states checked is (\d+)\.', s) m = re.match('Total number of states checked is ([0-9]+)\\.', s)
if m: if m:
iter_ = int(m.group(1)) iter_ = int(m.group(1))
self.dialog.setText(iter=iter_) self.dialog.setText(iter=iter_)
continue continue
m = re.match('This scan generated (\d+) states\.', s) m = re.match('This scan generated ([0-9]+) states\\.', s)
if m: if m:
states = int(m.group(1)) states = int(m.group(1))

View file

@ -170,7 +170,6 @@ class SingleGame_StatsDialog(MfxDialog):
x, ty[1]-dy, text="%d%%" % (100-pw), anchor="ne", font=tfont, x, ty[1]-dy, text="%d%%" % (100-pw), anchor="ne", font=tfont,
fill=fg) fill=fg)
# def _createChart3DBar(self, canvas, perc, x, y, p, col): # def _createChart3DBar(self, canvas, perc, x, y, p, col):
# if perc < 0.005: # if perc < 0.005:
# return # return
@ -204,11 +203,6 @@ class SingleGame_StatsDialog(MfxDialog):
# draw_line(5, 6) # draw_line(5, 6)
# draw_line(6, 7) # draw_line(6, 7)
# draw_line(7, 4) # draw_line(7, 4)
#
# charts
#
# def createSimpleChart(self, app, won, lost, text): # def createSimpleChart(self, app, won, lost, text):
# #c, tfont, fg = self._createChartInit(frame, 300, 100, text) # #c, tfont, fg = self._createChartInit(frame, 300, 100, text)
# self._createChartInit(300, 100, text) # self._createChartInit(300, 100, text)
@ -217,7 +211,6 @@ class SingleGame_StatsDialog(MfxDialog):
# tx = (90, 180, 210) # tx = (90, 180, 210)
# ty = (21, 41, 75) # ty = (21, 41, 75)
# self._createChartTexts(tx, ty, won, lost) # self._createChartTexts(tx, ty, won, lost)
# def create3DBarChart(self, app, won, lost, text): # def create3DBarChart(self, app, won, lost, text):
# image = app.gimages.stats[0] # image = app.gimages.stats[0]
# iw, ih = image.width(), image.height() # iw, ih = image.width(), image.height()