Fix some flake8 spam. NFC.

This commit is contained in:
Arthur O'Dwyer
2017-04-17 23:21:44 -07:00
parent 7388eaec54
commit f08c57fac3
4 changed files with 10 additions and 3 deletions

View File

@ -14,6 +14,7 @@ from correspondence import Correspondence
from workspaceFormulas import chooseUnmodifiedObject
from workspaceFormulas import chooseBondFacet
def codelet(name):
"""Decorator for otherwise-unused functions that are in fact used as codelet behaviors"""
def wrap(f):
@ -23,6 +24,7 @@ def codelet(name):
return f
return wrap
# some methods common to the codelets
def __showWhichStringObjectIsFrom(structure):
if not structure:

View File

@ -2,12 +2,14 @@ import bisect
import math
import random
def accumulate(iterable):
total = 0
for v in iterable:
total += v
yield total
class Randomness(object):
def __init__(self, seed=None):
self.rng = random.Random(seed)

View File

@ -1,5 +1,6 @@
import math
class Temperature(object):
def __init__(self):
self.reset()

View File

@ -1,9 +1,8 @@
"""Run the copycat program"""
import unittest
from context import Context
def pnormaldist(p):
table = {
0.80: 1.2815,
@ -21,7 +20,8 @@ def pnormaldist(p):
0.99999999: 5.7307,
0.999999999: 6.1094,
}
return max(v for k,v in table.iteritems() if k <= p)
return max(v for k, v in table.iteritems() if k <= p)
def lower_bound_on_probability(hits, attempts, confidence=0.95):
if attempts == 0:
@ -33,6 +33,7 @@ def lower_bound_on_probability(hits, attempts, confidence=0.95):
denominator = (1 + zsqr / attempts)
return (phat + zsqr / (2*attempts) - z * (under_sqrt ** 0.5)) / denominator
def upper_bound_on_probability(hits, attempts, confidence=0.95):
misses = attempts - hits
return 1.0 - lower_bound_on_probability(misses, attempts, confidence)
@ -131,5 +132,6 @@ class TestCopycat(unittest.TestCase):
'kitten': {'count': 4, 'avgtemp': 68},
})
if __name__ == '__main__':
unittest.main()