From: Joe Wreschnig Date: Tue, 16 Mar 2010 02:21:42 +0000 (-0700) Subject: INumberDef: Rounding version of NumberDef. X-Git-Url: https://git.yukkurigames.com/?a=commitdiff_plain;h=3674933e0881e379e9945f5477cbef187abfc871;p=python-bulletml.git INumberDef: Rounding version of NumberDef. --- diff --git a/bulletml/__init__.py b/bulletml/__init__.py index e69de29..9dc15d1 100644 --- a/bulletml/__init__.py +++ b/bulletml/__init__.py @@ -0,0 +1,6 @@ +"""BulletML parser. + +http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html +""" + +from bulletml.parser import BulletML diff --git a/bulletml/expr.py b/bulletml/expr.py index 8022476..9ca82ec 100644 --- a/bulletml/expr.py +++ b/bulletml/expr.py @@ -62,3 +62,8 @@ class NumberDef(object): def __repr__(self): return "%s(%r)" % (type(self).__name__, self.__original) + +class INumberDef(NumberDef): + """A NumberDef, but returns rounded integer results.""" + def __call__(self, params, rank): + return int(round(super(INumberDef, self).__call__(params, rank)))