Permalink
Browse files

split bisque into a separate package

Ignore-this: cabe24f41202259043625ab4f7179668

darcs-hash:20130716155411-3a4db-ba0378d51979ceeed086cd16ae776cbe10408c46
  • Loading branch information...
1 parent 33be6a6 commit bb014a2a7a7bc73d862f6a149f2a2944637cc728 @MattShannon committed Jul 16, 2013
No changes.
@@ -9,7 +9,7 @@
from __future__ import division
from armspeech.util.iterhelp import chunkList
-from armspeech.bisque.distribute import liftLocal, lit, lift
+from bisque.distribute import liftLocal, lit, lift
from codedep import codeDeps
@codeDeps(chunkList)
@@ -9,7 +9,7 @@
from __future__ import division
import armspeech.modelling.dist as d
-from armspeech.bisque.distribute import liftLocal, lit, lift
+from bisque.distribute import liftLocal, lit, lift
from codedep import codeDeps
@codeDeps()
@@ -15,12 +15,12 @@
import transform as xf
import cluster
import wnet
-from armspeech.util import persist
from armspeech.util.mathhelp import logSum
from armspeech.util.iterhelp import chunkList
from armspeech.util.mathhelp import assert_allclose
from armspeech.util.mathhelp import AsArray
from armspeech.util.util import MapElem
+from bisque import persist
from codedep import codeDeps, ForwardRef
import test_transform_questions
@@ -1,4 +1,4 @@
-"""Runs all tests."""
+"""Runs all tests for armspeech."""
# Copyright 2011, 2012, 2013 Matt Shannon
@@ -8,43 +8,34 @@
from __future__ import division
-from armspeech.bisque import test_queuer
from armspeech.modelling import test_dist
from armspeech.modelling import test_minimize
from armspeech.modelling import test_transform
from armspeech.modelling import test_wnet
-from armspeech.modelling.bisque import test_modelling_bisque
+from armspeech.modelling import test_modelling_jobs
from armspeech.util import test_iterhelp
from armspeech.util import test_mathhelp
from armspeech.util import test_memoize
-from armspeech.util import test_persist
from codedep import codeDeps
import unittest
import sys
import argparse
-@codeDeps()
-class ShouldNotPickle(object):
- pass
-
-@codeDeps(ShouldNotPickle, test_dist.suite, test_iterhelp.suite,
- test_mathhelp.suite, test_memoize.suite, test_minimize.suite,
- test_modelling_bisque.suite, test_persist.suite, test_queuer.suite,
+@codeDeps(test_dist.suite, test_iterhelp.suite, test_mathhelp.suite,
+ test_memoize.suite, test_minimize.suite, test_modelling_jobs.suite,
test_transform.suite, test_wnet.suite
)
def suite(deepTest = False):
return unittest.TestSuite([
- test_queuer.suite(),
test_dist.suite(deepTest = deepTest),
test_minimize.suite(),
test_transform.suite(),
test_wnet.suite(),
- test_modelling_bisque.suite(),
+ test_modelling_jobs.suite(),
test_iterhelp.suite(),
test_mathhelp.suite(),
test_memoize.suite(),
- test_persist.suite(createShouldNotPickle = ShouldNotPickle),
])
@codeDeps(suite)
File renamed without changes.
@@ -9,7 +9,7 @@
from __future__ import division
import codedep
-from armspeech.util import persist
+from bisque import persist
from codedep import codeDeps, ForwardRef
import os
@@ -17,11 +17,12 @@
@codeDeps()
class TempDir(object):
- def __init__(self, removeOnException = False):
+ def __init__(self, prefix = 'bisque.', removeOnException = False):
+ self.prefix = prefix
self.removeOnException = removeOnException
def __enter__(self):
- self.location = tempfile.mkdtemp(prefix = 'armspeech.')
+ self.location = tempfile.mkdtemp(prefix = self.prefix)
return self
def remove(self):
File renamed without changes.
File renamed without changes.
@@ -8,7 +8,7 @@
from __future__ import division
-from armspeech.util import persist
+from bisque import persist
from codedep import codeDeps, ForwardRef
import os
@@ -14,13 +14,13 @@
import queuer as qr
import sge_runner
import mock_sge
-from armspeech.util import persist
+from bisque import persist
from codedep import codeDeps
import re
import os
import sys
-from armspeech.util import subprocesshelp
+from bisque import subprocesshelp
import inspect
@codeDeps(qr.Queuer)
@@ -8,16 +8,16 @@
from __future__ import division
-from armspeech.util.timing import timed
+from bisque.timing import timed
import os
import sys
import traceback
from datetime import datetime
def main(args):
- import armspeech.bisque.queuer as qr
- from armspeech.util import persist
+ import bisque.queuer as qr
+ from bisque import persist
assert len(args) == 2
liveJobDir = args[1]
File renamed without changes.
View
@@ -0,0 +1,51 @@
+"""Runs all tests for bisque."""
+
+# Copyright 2011, 2012, 2013 Matt Shannon
+
+# This file is part of armspeech.
+# See `License` for details of license and warranty.
+
+
+from __future__ import division
+
+from bisque import test_queuer
+from bisque import test_persist
+from codedep import codeDeps
+
+import unittest
+import sys
+import argparse
+
+@codeDeps()
+class ShouldNotPickle(object):
+ pass
+
+@codeDeps(ShouldNotPickle, test_persist.suite, test_queuer.suite)
+def suite():
+ return unittest.TestSuite([
+ test_queuer.suite(),
+ test_persist.suite(createShouldNotPickle = ShouldNotPickle),
+ ])
+
+@codeDeps(suite)
+def main(rawArgs):
+ parser = argparse.ArgumentParser(
+ description = 'Runs all tests for bisque.',
+ formatter_class = argparse.ArgumentDefaultsHelpFormatter
+ )
+ parser.add_argument(
+ '--verbosity', dest = 'verbosity', type = int, default = 1,
+ metavar = 'VERB',
+ help = 'verbosity level'
+ )
+ args = parser.parse_args(rawArgs[1:])
+
+ testResult = unittest.TextTestRunner(
+ verbosity = args.verbosity
+ ).run(suite())
+
+ return 0 if testResult.wasSuccessful() else 1
+
+if __name__ == '__main__':
+ retCode = main(sys.argv)
+ sys.exit(retCode)
File renamed without changes.
@@ -13,12 +13,12 @@
# jobs don't contain the fully-qualified names for any modules imported below
# using implicit relative imports, which leads to problems when these jobs
# are unpickled to be run.)
-from armspeech.bisque import distribute
-import armspeech.bisque.queuer as qr
-from armspeech.bisque import sge_queuer
-from armspeech.bisque.distribute import lift
-import armspeech.bisque.test_queuer_jobs as jobs
-from armspeech.util.filehelp import TempDir
+from bisque import distribute
+import bisque.queuer as qr
+from bisque import sge_queuer
+from bisque.distribute import lift
+import bisque.test_queuer_jobs as jobs
+from bisque.filehelp import TempDir
from codedep import codeDeps
import unittest
File renamed without changes.
View
@@ -0,0 +1,24 @@
+"""Time and timing helper functions."""
+
+# This file is part of armspeech.
+# See `License` for details of license and warranty.
+
+
+from __future__ import division
+
+from codedep import codeDeps
+
+import time
+
+@codeDeps()
+def timed(func, msg = None):
+ """(probably based on http://www.daniweb.com/software-development/python/code/216610)"""
+ if msg is None:
+ msg = func.func_name+' took'
+ def ret(*args, **kwargs):
+ t1 = time.time()
+ res = func(*args, **kwargs)
+ t2 = time.time()
+ print '%s %0.3f ms' % (msg, (t2 - t1) * 1000.0)
+ return res
+ return ret
Oops, something went wrong.

0 comments on commit bb014a2

Please sign in to comment.