mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
flake8 compliance
This commit is contained in:
parent
b24da7cc92
commit
39d59547af
6 changed files with 17 additions and 17 deletions
pysollib
tests/lib/pysol_tests/ms_deals1
|
@ -29,7 +29,7 @@ from pysollib.help import help_about, help_html
|
|||
from pysollib.mfxutil import Struct, openURL
|
||||
from pysollib.mfxutil import print_err
|
||||
from pysollib.mygettext import _
|
||||
from pysollib.pysolrandom import constructRandom
|
||||
from pysollib.pysolrandom import construct_random
|
||||
from pysollib.pysoltk import AllGames_StatsDialog, SingleGame_StatsDialog
|
||||
from pysollib.pysoltk import ColorsDialog
|
||||
from pysollib.pysoltk import EditTextDialog
|
||||
|
@ -251,7 +251,7 @@ class PysolMenubar(PysolMenubarTk):
|
|||
|
||||
def _mNewGameBySeed(self, seed, origin):
|
||||
try:
|
||||
random = constructRandom(seed)
|
||||
random = construct_random(seed)
|
||||
if random is None:
|
||||
return
|
||||
id = self.game.id
|
||||
|
|
|
@ -43,7 +43,7 @@ from pysollib.mfxutil import latin1_normalize, print_err
|
|||
from pysollib.mfxutil import pickle, unpickle
|
||||
from pysollib.mygettext import _
|
||||
from pysollib.options import Options
|
||||
from pysollib.pysolrandom import PysolRandom, constructRandom
|
||||
from pysollib.pysolrandom import PysolRandom, construct_random
|
||||
from pysollib.pysoltk import HTMLViewer
|
||||
from pysollib.pysoltk import HelpStatusbar, PysolStatusbar
|
||||
from pysollib.pysoltk import MfxDialog, MfxExceptionDialog, MfxMessageDialog
|
||||
|
@ -336,7 +336,7 @@ class Application:
|
|||
self.nextgame.id = gameid
|
||||
deal = self.commandline.deal
|
||||
self.nextgame.random = \
|
||||
None if deal is None else constructRandom(deal)
|
||||
None if deal is None else construct_random(deal)
|
||||
elif self.commandline.gameid is not None:
|
||||
self.nextgame.id, self.nextgame.random = \
|
||||
self.commandline.gameid, None
|
||||
|
|
|
@ -54,7 +54,7 @@ from pysollib.move import ATurnStackMove
|
|||
from pysollib.move import AUpdateStackMove
|
||||
from pysollib.mygettext import _
|
||||
from pysollib.mygettext import ungettext
|
||||
from pysollib.pysolrandom import LCRandom31, PysolRandom, constructRandom
|
||||
from pysollib.pysolrandom import LCRandom31, PysolRandom, construct_random
|
||||
from pysollib.pysoltk import CURSOR_WATCH
|
||||
from pysollib.pysoltk import Card
|
||||
from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE
|
||||
|
@ -3204,7 +3204,7 @@ class Game(object):
|
|||
game.version_tuple = version_tuple
|
||||
#
|
||||
initial_seed = random__int2str(pload(int))
|
||||
game.random = constructRandom(initial_seed)
|
||||
game.random = construct_random(initial_seed)
|
||||
state = pload()
|
||||
if not (isinstance(game.random, random2.Random) and
|
||||
isinstance(state, int)):
|
||||
|
|
|
@ -29,7 +29,7 @@ import time
|
|||
from io import BytesIO
|
||||
|
||||
from pysollib.mfxutil import destruct
|
||||
from pysollib.pysolrandom import constructRandom
|
||||
from pysollib.pysolrandom import construct_random
|
||||
from pysollib.settings import DEBUG, FCS_COMMAND
|
||||
from pysollib.util import KING
|
||||
|
||||
|
@ -873,12 +873,12 @@ class FreeCellSolver_Hint(Base_Solver_Hint):
|
|||
|
||||
def importFile(solver, fh, s_game, self):
|
||||
s_game.endGame()
|
||||
s_game.random = constructRandom('Custom')
|
||||
s_game.random = construct_random('Custom')
|
||||
s_game.newGame(
|
||||
shuffle=True,
|
||||
random=constructRandom('Custom'),
|
||||
random=construct_random('Custom'),
|
||||
dealer=lambda: solver.importFileHelper(fh, s_game))
|
||||
s_game.random = constructRandom('Custom')
|
||||
s_game.random = construct_random('Custom')
|
||||
|
||||
def importFileHelper(solver, fh, s_game):
|
||||
game = s_game.s
|
||||
|
|
|
@ -65,7 +65,7 @@ PysolRandom = pysol_cards.random.MTRandom
|
|||
|
||||
|
||||
# construct Random from seed string
|
||||
def constructRandom(s):
|
||||
def construct_random(s):
|
||||
if s == 'Custom':
|
||||
return CustomRandom()
|
||||
m = match_ms_deal_prefix(s)
|
||||
|
|
|
@ -59,7 +59,7 @@ from pysol_cards.random import random__int2str, random__str2int
|
|||
from pysol_cards.random_base import RandomBase
|
||||
|
||||
# So the localpaths will be overrided.
|
||||
from pysollib.pysolrandom import constructRandom
|
||||
from pysollib.pysolrandom import construct_random
|
||||
|
||||
# PySol imports
|
||||
|
||||
|
@ -122,7 +122,7 @@ AC 9D 7H 6D KS JH
|
|||
KC JS 9H 4S 7S AD
|
||||
''', 'PySolFC deal No. 123456')
|
||||
|
||||
rand = constructRandom('ms3000000000')
|
||||
rand = construct_random('ms3000000000')
|
||||
self.assertEqual(rand.getSeedAsStr(), 'ms3000000000')
|
||||
game = Game("freecell", 3000000000, RandomBase.DEALS_MS)
|
||||
# TEST
|
||||
|
@ -136,7 +136,7 @@ KC JS 9H 4S 7S AD
|
|||
8C AH 2H 5H 2D 5S
|
||||
''', 'Microsoft Deal #3E9 - long seed.')
|
||||
|
||||
rand = constructRandom('ms6000000000')
|
||||
rand = construct_random('ms6000000000')
|
||||
game = Game("freecell", 6000000000, RandomBase.DEALS_MS)
|
||||
# TEST
|
||||
got_s = game.calc_layout_string(ren)
|
||||
|
@ -169,12 +169,12 @@ QH 9H 9D 5S 7S 6C
|
|||
# TEST
|
||||
self.assertEqual(got, inp, 'str2long PySolFC roundtrip.')
|
||||
|
||||
rand = constructRandom('ms100000')
|
||||
rand = construct_random('ms100000')
|
||||
seed = rand.increaseSeed(rand.initial_seed)
|
||||
seed = rand.str(seed)
|
||||
# TEST
|
||||
self.assertEqual(seed, 'ms100001', 'increaseSeed for ms deals')
|
||||
rand = constructRandom(seed)
|
||||
rand = construct_random(seed)
|
||||
game = Game("freecell", int(seed[2:]), RandomBase.DEALS_MS)
|
||||
# TEST
|
||||
self._cmp_board(game.calc_layout_string(ren), '''5S AH 4H TD 4S JD JS
|
||||
|
@ -188,7 +188,7 @@ KH 6H 6C TC 2C 7D
|
|||
''', 'ms100001')
|
||||
|
||||
seed = 24000024
|
||||
rand = constructRandom(str(seed))
|
||||
rand = construct_random(str(seed))
|
||||
expected0 = rand.randint(0, 100)
|
||||
expected1 = rand.randint(0, 100)
|
||||
rand.reset()
|
||||
|
|
Loading…
Add table
Reference in a new issue