summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2015-11-27 16:39:00 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 06:41:36 (GMT)
commit74b105cd58c66576b688e7315799338c3a637805 (patch)
tree6a0cfe5935050094b8af4b3bb629460e655d2307
parent76b3d7ed5986ab626116ca7afb949fcdc362d56d (diff)
Hand: indent not by hand hierarchy but dynamically in __init__
-rw-r--r--src/hand.py4
-rw-r--r--src/log.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/hand.py b/src/hand.py
index bdedce7..698c0ed 100644
--- a/src/hand.py
+++ b/src/hand.py
@@ -63,6 +63,7 @@ class Hand(object):
was used for rearranging the hiden tiles to melds."""
# pylint: disable=too-many-instance-attributes
+ indent = 0
class __NotWon(UserWarning): # pylint: disable=invalid-name
"""should be won but is not a winning hand"""
@@ -94,7 +95,6 @@ class Hand(object):
self.string = string
self.__robbedTile = Tile.unknown
- self.indent = prevHand.indent + 1 if prevHand else 0
self.prevHand = prevHand
self.__won = None
self.__score = None
@@ -119,6 +119,7 @@ class Hand(object):
if Debug.hand or Debug.mahJongg:
self.debug(fmt('{callers}',
callers=callers(10, exclude=['__init__'])))
+ Hand.indent += 1
_hideString = string
self.debug(fmt('New Hand {_hideString} {self.lenOffset}'))
@@ -138,6 +139,7 @@ class Hand(object):
_hideScore = str(self.score)
self.debug(fmt(
'Fixing {_hideSelf} {self.won} {_hideScore}'))
+ Hand.indent -= 1
def __parseString(self, inString):
"""parse the string passed to Hand()"""
diff --git a/src/log.py b/src/log.py
index c09b7a3..a1bdf2a 100644
--- a/src/log.py
+++ b/src/log.py
@@ -72,7 +72,7 @@ class Fmt(string.Formatter):
Fmt.formatter = Fmt()
def id4(obj):
- return Fmt.num_encode(id(obj))
+ return '.' if Debug.neutral else Fmt.num_encode(id(obj))
def fmt(text, **kwargs):
"""use the context dict for finding arguments.