mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
BadWords & Nickometer: Use 'future' divisions.
This commit is contained in:
parent
8b7d16c850
commit
88c2c130ca
@ -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
|
||||
|
@ -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`)
|
||||
|
Loading…
Reference in New Issue
Block a user