From aa24701c305dfe65f9b88a8315713dedef859487 Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Wed, 3 Oct 2012 10:50:53 -0400 Subject: [PATCH] Removes 'core' submodule. The last use of AddressAllocator has been removed. (since zipline no longer uses zmq) Also removes unused command line harness. --- zipline/core/__init__.py | 1 - zipline/core/devsimulator.py | 36 ---------------- zipline/core/interpreter.py | 82 ------------------------------------ 3 files changed, 119 deletions(-) delete mode 100644 zipline/core/__init__.py delete mode 100644 zipline/core/devsimulator.py delete mode 100644 zipline/core/interpreter.py diff --git a/zipline/core/__init__.py b/zipline/core/__init__.py deleted file mode 100644 index 8b137891..00000000 --- a/zipline/core/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/zipline/core/devsimulator.py b/zipline/core/devsimulator.py deleted file mode 100644 index 6e273f8c..00000000 --- a/zipline/core/devsimulator.py +++ /dev/null @@ -1,36 +0,0 @@ -""" -Simulator hosts all the components necessary to execute a simulation. -See :py:method"" -""" - -import logbook - -log = logbook.Logger('Dev Simulator') - -DEPRECATION_WARNING = """ -WARNING WARNING WARNING -THE DEVSIMULATOR IS DEPRECATED, IT WILL NOT BEHAVE LIKE ANY OTHER -SYSTEM USED IN TESTS OR IN PRODUCTION -""" - - -class AddressAllocator(object): - """ - Produces a iterator of 10000 sockets to allocate as needed. - Emulates the API of Qexec's socket allocator. - """ - - def __init__(self, ns): - self.idx = 0 - self.sockets = [ - 'tcp://127.0.0.1:%s' % (10000 + n) - for n in xrange(ns) - ] - - def lease(self, n): - sockets = self.sockets[self.idx: self.idx + n] - self.idx += n - return sockets - - def reaquire(self, *conn): - pass diff --git a/zipline/core/interpreter.py b/zipline/core/interpreter.py deleted file mode 100644 index 6bcd4eed..00000000 --- a/zipline/core/interpreter.py +++ /dev/null @@ -1,82 +0,0 @@ -import sys -import yaml -import argparse -import fileinput -from cStringIO import StringIO -from zipline.utils.date_utils import EPOCH, date_to_datetime - -def interpret(args): - print 'Reading {ifile}'.format(ifile=args.file) - - metastart = False - metadone = False - - metadata = StringIO() - algorithm = StringIO() - - for line in fileinput.input(args.file): - if line.startswith('---'): - if metastart: - metastart = False - metadone = False - else: - metastart = True - metadone = False - metadata.write(line) - - elif metastart: - metadata.write(line) - else: - algorithm.write(line) - - #print 'Metadata:' - #print metadata.getvalue() - - #print 'Algorithm:' - #print algorithm.getvalue() - - try: - meta = yaml.load_all(metadata.getvalue()) - except yaml.error.YAMLError, e: - print e - sys.exit(0) - - try: - meta = meta.next() - except StopIteration: - raise RuntimeError("No metadata in file.") - - algocode = algorithm.getvalue() - - start = meta['start_date'] - end = meta['end_date'] - - meta['start_date'] = EPOCH(date_to_datetime(start)) - meta['end_date'] = EPOCH(date_to_datetime(end)) - meta['algocode'] = algocode - - print end - start - - ns = {} - - # -- Sanity check -- - exec(algocode) in ns - - assert ns['initialize'] - assert ns['get_sid_filter'] - assert ns['handle_data'] - - return algocode, meta - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('file', metavar='file', help='Algorithm file.') - args = parser.parse_args() - - if not args.file: - print parser.print_help() - sys.exit(0) - interpret(args) - -if __name__ == '__main__': - main()