From 12cf1e507f6aaf097877dded99031df3a7fb2e0a Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 25 May 2020 14:06:08 +0300 Subject: [PATCH] Rename variable/s to make them more descriptive. --- pysollib/game/__init__.py | 4 ++-- pysollib/game/dump.py | 4 ++-- pysollib/pysolrandom.py | 4 ++-- tests/lib/pysol_tests/ms_deals1/__init__.py | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pysollib/game/__init__.py b/pysollib/game/__init__.py index f7419155..f9f20a3e 100644 --- a/pysollib/game/__init__.py +++ b/pysollib/game/__init__.py @@ -54,7 +54,7 @@ from pysollib.move import AUpdateStackMove from pysollib.mygettext import _ from pysollib.mygettext import ungettext from pysollib.pysolrandom import LCRandom31, PysolRandom, constructRandom, \ - random__long2str + random__int2str from pysollib.pysoltk import CURSOR_WATCH from pysollib.pysoltk import Card from pysollib.pysoltk import EVENT_HANDLED, EVENT_PROPAGATE @@ -3200,7 +3200,7 @@ class Game(object): game.version = version game.version_tuple = version_tuple # - initial_seed = random__long2str(pload(int)) + initial_seed = random__int2str(pload(int)) game.random = constructRandom(initial_seed) state = pload() if not (isinstance(game.random, random2.Random) and diff --git a/pysollib/game/dump.py b/pysollib/game/dump.py index 40046a06..881d0d81 100644 --- a/pysollib/game/dump.py +++ b/pysollib/game/dump.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -from pysollib.pysolrandom import random__str2long +from pysollib.pysolrandom import random__str2int from pysollib.settings import PACKAGE from pysollib.settings import VERSION, VERSION_TUPLE @@ -30,7 +30,7 @@ def pysolDumpGame(game_, p, bookmark=0): p.dump(game_.GAME_VERSION) p.dump(game_.id) # - p.dump(random__str2long(game_.random.getSeedStr())) + p.dump(random__str2int(game_.random.getSeedStr())) p.dump(game_.random.getstate()) # p.dump(len(game_.allstacks)) diff --git a/pysollib/pysolrandom.py b/pysollib/pysolrandom.py index bbbaeabb..7ab7d018 100644 --- a/pysollib/pysolrandom.py +++ b/pysollib/pysolrandom.py @@ -111,7 +111,7 @@ def constructRandom(s): return pysol_cards.random.MTRandom(seed) -def random__str2long(s): +def random__str2int(s): if s == 'Custom': return CUSTOM_BIT | MS_LONG_BIT m = match_ms_deal_prefix(s) @@ -121,7 +121,7 @@ def random__str2long(s): return int(s) -def random__long2str(l): +def random__int2str(l): if ((l & MS_LONG_BIT) != 0): if ((l & CUSTOM_BIT) != 0): return 'Custom' diff --git a/tests/lib/pysol_tests/ms_deals1/__init__.py b/tests/lib/pysol_tests/ms_deals1/__init__.py index e99593cd..f1935395 100644 --- a/tests/lib/pysol_tests/ms_deals1/__init__.py +++ b/tests/lib/pysol_tests/ms_deals1/__init__.py @@ -59,7 +59,7 @@ from pysol_cards.random_base import RandomBase # So the localpaths will be overrided. from pysollib.pysolrandom import constructRandom, \ - random__long2str, random__str2long + random__int2str, random__str2int # PySol imports @@ -151,20 +151,20 @@ QH 9H 9D 5S 7S 6C ''', 'Microsoft Deal #6E9 - extra long seed.') inp = 'ms12345678' - got = random__long2str(random__str2long(inp)) + got = random__int2str(random__str2int(inp)) # TEST self.assertEqual(got, inp, 'long2str ms roundtrip.') inp = '246007891097' - got = random__long2str(random__str2long(inp)) + got = random__int2str(random__str2int(inp)) # TEST self.assertEqual(got, inp, 'long2str PySolFC roundtrip.') proto_inp = '246007891097' - inp = random__str2long(proto_inp) - got = random__str2long(random__long2str(inp)) + inp = random__str2int(proto_inp) + got = random__str2int(random__int2str(inp)) # TEST self.assertEqual(got, inp, 'str2long PySolFC roundtrip.')