BadWords & Nickometer: Use 'future' divisions.

This commit is contained in:
Valentin Lorentz 2012-08-04 18:54:14 +02:00
parent 8b7d16c850
commit 88c2c130ca
2 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,8 @@
# POSSIBILITY OF SUCH DAMAGE.
###
from __future__ import division
import time
import supybot.conf as conf
@ -64,7 +66,7 @@ conf.registerChannelValue(BadWords,'requireWordBoundaries',
class String256(registry.String):
def __call__(self):
s = registry.String.__call__(self)
return s * (1024/len(s))
return s * (1024//len(s))
def __str__(self):
return self.value

View File

@ -45,6 +45,8 @@
# #
###
from __future__ import division
import supybot
import re
@ -220,7 +222,7 @@ class Nickometer(callbacks.Plugin):
# Use an appropriate function to map [0, +inf) to [0, 100)
percentage = 100 * (1 + math.tanh((score - 400.0) / 400.0)) * \
(1 - 1 / (1 + score / 5.0)) / 2
(1 - 1 / (1 + score / 5.0)) // 2
# if it's above 99.9%, show as many digits as is interesting
score_string=re.sub('(99\\.9*\\d|\\.\\d).*','\\1',`percentage`)