From 4d963e3f597afdd1bfe2a7ebc24d529e4d672485 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 22 May 2017 00:00:50 +0300 Subject: [PATCH] 2to3 on pysollib/games/mahjongg/*.py --- pysollib/games/mahjongg/__init__.py | 8 ++++---- pysollib/games/mahjongg/mahjongg.py | 11 ++++++----- pysollib/games/mahjongg/mahjongg1.py | 2 +- pysollib/games/mahjongg/mahjongg2.py | 2 +- pysollib/games/mahjongg/mahjongg3.py | 2 +- pysollib/games/mahjongg/shisensho.py | 6 ++++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pysollib/games/mahjongg/__init__.py b/pysollib/games/mahjongg/__init__.py index 288eafe7..deb59cbe 100644 --- a/pysollib/games/mahjongg/__init__.py +++ b/pysollib/games/mahjongg/__init__.py @@ -20,7 +20,7 @@ # along with this program. If not, see . # # ---------------------------------------------------------------------------## -import mahjongg1 -import mahjongg2 -import mahjongg3 -import shisensho +from . import mahjongg1 +from . import mahjongg2 +from . import mahjongg3 +from . import shisensho diff --git a/pysollib/games/mahjongg/mahjongg.py b/pysollib/games/mahjongg/mahjongg.py index c50e3973..cfd6a00b 100644 --- a/pysollib/games/mahjongg/mahjongg.py +++ b/pysollib/games/mahjongg/mahjongg.py @@ -468,10 +468,10 @@ class AbstractMahjonggGame(Game): assert tilemap.get((level, tx, ty+1)) is stack assert tilemap.get((level, tx+1, ty+1)) is stack # - above = tuple(filter(None, above.keys())) - below = tuple(filter(None, below.keys())) - left = tuple(filter(None, left.keys())) - right = tuple(filter(None, right.keys())) + above = tuple([_f for _f in above.keys() if _f]) + below = tuple([_f for _f in below.keys() if _f]) + left = tuple([_f for _f in left.keys() if _f]) + right = tuple([_f for _f in right.keys() if _f]) # up = tuple(filter(None, up.keys())) # bottom = tuple(filter(None, bottom.keys())) @@ -1020,7 +1020,8 @@ def r(id, short_name, name=None, ncards=144, layout=None): gi = GameInfo(id, gameclass, name, GI.GT_MAHJONGG, 4*decks, 0, # GI.SL_MOSTLY_SKILL, category=GI.GC_MAHJONGG, short_name=short_name, - suits=range(3), ranks=range(ranks), trumps=range(trumps), + suits=list(range(3)), ranks=list(range(ranks)), + trumps=list(range(trumps)), si={"decks": decks, "ncards": ncards}) gi.ncards = ncards gi.rules_filename = "mahjongg.html" diff --git a/pysollib/games/mahjongg/mahjongg1.py b/pysollib/games/mahjongg/mahjongg1.py index dae5cee8..eacc075b 100644 --- a/pysollib/games/mahjongg/mahjongg1.py +++ b/pysollib/games/mahjongg/mahjongg1.py @@ -21,7 +21,7 @@ # # ---------------------------------------------------------------------------## -from mahjongg import r +from pysollib.games.mahjongg.mahjongg import r # ************************************************************************ # * game definitions diff --git a/pysollib/games/mahjongg/mahjongg2.py b/pysollib/games/mahjongg/mahjongg2.py index 3245b7f3..dda98cd5 100644 --- a/pysollib/games/mahjongg/mahjongg2.py +++ b/pysollib/games/mahjongg/mahjongg2.py @@ -25,7 +25,7 @@ # http://www.kyodai.com/index.en.html # http://files.cyna.net/layouts.zip -from mahjongg import r +from pysollib.games.mahjongg.mahjongg import r # ************************************************************************ # * game definitions diff --git a/pysollib/games/mahjongg/mahjongg3.py b/pysollib/games/mahjongg/mahjongg3.py index 6155e1ea..6a633888 100644 --- a/pysollib/games/mahjongg/mahjongg3.py +++ b/pysollib/games/mahjongg/mahjongg3.py @@ -21,7 +21,7 @@ # # ---------------------------------------------------------------------------## -from mahjongg import r +from pysollib.games.mahjongg.mahjongg import r # test # r(5991, "AAA 1", ncards=4, layout="0daa") diff --git a/pysollib/games/mahjongg/shisensho.py b/pysollib/games/mahjongg/shisensho.py index da2fa61a..45a7763a 100644 --- a/pysollib/games/mahjongg/shisensho.py +++ b/pysollib/games/mahjongg/shisensho.py @@ -36,7 +36,8 @@ from pysollib.layout import Layout from pysollib.hint import AbstractHint from pysollib.pysoltk import MfxCanvasText, MfxCanvasLine -from mahjongg import Mahjongg_RowStack, AbstractMahjonggGame, comp_cardset +from pysollib.games.mahjongg.mahjongg import Mahjongg_RowStack, \ + AbstractMahjonggGame, comp_cardset from pysollib.util import ANY_SUIT @@ -513,7 +514,8 @@ def r(id, gameclass, name, rules_filename="shisensho.html"): gi = GameInfo(id, gameclass, name, GI.GT_SHISEN_SHO, 4*decks, 0, GI.SL_MOSTLY_SKILL, category=GI.GC_MAHJONGG, short_name=name, - suits=range(3), ranks=range(ranks), trumps=range(trumps), + suits=list(range(3)), ranks=list(range(ranks)), + trumps=list(range(trumps)), si={"decks": decks, "ncards": gameclass.NCARDS}) gi.ncards = gameclass.NCARDS gi.rules_filename = rules_filename