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

View File

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

View File

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

View File

@ -1,9 +1,8 @@
"""Run the copycat program"""
import unittest import unittest
from context import Context from context import Context
def pnormaldist(p): def pnormaldist(p):
table = { table = {
0.80: 1.2815, 0.80: 1.2815,
@ -23,6 +22,7 @@ def pnormaldist(p):
} }
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): def lower_bound_on_probability(hits, attempts, confidence=0.95):
if attempts == 0: if attempts == 0:
return 0 return 0
@ -33,6 +33,7 @@ def lower_bound_on_probability(hits, attempts, confidence=0.95):
denominator = (1 + zsqr / attempts) denominator = (1 + zsqr / attempts)
return (phat + zsqr / (2*attempts) - z * (under_sqrt ** 0.5)) / denominator return (phat + zsqr / (2*attempts) - z * (under_sqrt ** 0.5)) / denominator
def upper_bound_on_probability(hits, attempts, confidence=0.95): def upper_bound_on_probability(hits, attempts, confidence=0.95):
misses = attempts - hits misses = attempts - hits
return 1.0 - lower_bound_on_probability(misses, attempts, confidence) return 1.0 - lower_bound_on_probability(misses, attempts, confidence)
@ -131,5 +132,6 @@ class TestCopycat(unittest.TestCase):
'kitten': {'count': 4, 'avgtemp': 68}, 'kitten': {'count': 4, 'avgtemp': 68},
}) })
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()