Ejemplo n.º 1
0
def get_package(name=None, data_path=None):
    if data_path is None:
        if os.environ.get('SPACY_DATA'):
            data_path = os.environ.get('SPACY_DATA')
        else:
            data_path = os.path.abspath(
                os.path.join(os.path.dirname(__file__), 'data'))

    sputnik = Sputnik('spacy', '0.100.0')  # TODO: retrieve version
    pool = sputnik.pool(data_path)
    return pool.get(name or 'en_default')
Ejemplo n.º 2
0
def get_package(name=None, data_path=None):
    if data_path is None:
        if os.environ.get('SPACY_DATA'):
            data_path = os.environ.get('SPACY_DATA')
        else:
            data_path = os.path.abspath(
                os.path.join(os.path.dirname(__file__), 'data'))

    sputnik = Sputnik('spacy', '0.100.0')  # TODO: retrieve version
    pool = sputnik.pool(data_path)
    return pool.get(name or 'en_default')
Ejemplo n.º 3
0
 def __init__(self, name, color, participants, spawn, planet):
     self.guys = []
     self.deaths = 0
     self.name = name
     self.planet = planet
     self.color = color
     self.maxfrags = 0
     for i in xrange(participants):
         guy = Sputnik(color,
                       spawn[0] + random.randint(0, 300)-100,
                       spawn[1] + random.randint(0, 600)-300,
                       planet, is_ai=True)
         guy.initialspeed(planet.m, planet.x, planet.y)
         print "%s entered %s team" % (guy.name, self.name)
         self.guys.append(guy)
Ejemplo n.º 4
0
def main(data_size='all', force=False):
    # TODO read version from the same source as the setup
    sputnik = Sputnik('spacy', '0.100.0', console=sys.stdout)

    path = os.path.dirname(os.path.abspath(__file__))

    data_path = os.path.abspath(os.path.join(path, '..', 'data'))
    if not os.path.isdir(data_path):
        os.mkdir(data_path)

    command = sputnik.command(data_path=data_path,
                              repository_url='https://index.spacy.io')

    if force:
        command.purge()

    package = command.install('en_default')

    # FIXME clean up old-style packages
    migrate(path)
Ejemplo n.º 5
0
                if qty_to_add > total_qty:
                    if side == 'BUY':
                        price = market['bid']
                    else:
                        price = market['ask']

                    self.placeOrder(ticker, qty_to_add - total_qty, price, side)

if __name__ == '__main__':
    logging.basicConfig(format='%(asctime)s - %(levelname)s - %(funcName)s() %(lineno)d:\t %(message)s', level=logging.INFO)
    log.startLogging(sys.stdout)

    import argparse
    parser = argparse.ArgumentParser(description="Run sputnik sample marketmaker client")
    parser.add_argument("-c", "--config", dest="config", action="store",
                        help="Configuration file", default="client.ini")
    parser.add_argument("--debug", dest="debug", action="store_true",
                        help="Enable debugging output", default=False)
    args = parser.parse_args()
    config = ConfigParser()
    config.read(args.config)

    params = dict(config.items("sputnik"))
    params.update(dict(config.items("market_maker")))

    sputnik = Sputnik(debug=args.debug, bot=MarketMakerBot, **params)
    sputnik.on("disconnect", lambda x: reactor.stop())
    sputnik.connect()

    reactor.run()
Ejemplo n.º 6
0
        format=
        '%(asctime)s - %(levelname)s - %(funcName)s() %(lineno)d:\t %(message)s',
        level=logging.INFO)
    log.startLogging(sys.stdout)

    import argparse
    parser = argparse.ArgumentParser(
        description="Run sputnik sample marketmaker client")
    parser.add_argument("-c",
                        "--config",
                        dest="config",
                        action="store",
                        help="Configuration file",
                        default="client.ini")
    parser.add_argument("--debug",
                        dest="debug",
                        action="store_true",
                        help="Enable debugging output",
                        default=False)
    args = parser.parse_args()
    config = ConfigParser()
    config.read(args.config)

    params = dict(config.items("sputnik"))
    params.update(dict(config.items("market_maker")))

    sputnik = Sputnik(debug=args.debug, bot=MarketMakerBot, **params)
    sputnik.on("disconnect", lambda x: reactor.stop())
    sputnik.connect()

    reactor.run()