Contents
Your challenge is to write a bot to play the Hexagon dots game. Your bot will
| $ python | |
| Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51) | |
| [GCC 4.0.1 (Apple Inc. build 5493)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> from storm.locals import Store, create_database | |
| >>> from skmodel import Student, Class, Grade | |
| >>> | |
| >>> # use test db | |
| ... db = create_database('sqlite:test.db') | |
| >>> store = Store(db) |
| def getRecords(kw=None): | |
| """ | |
| @param kw: A dictionary of narrowing criteria for the records. For example, | |
| if you wanted to only show records for student's named "Bill" you would | |
| pass:: | |
| {'first': 'Bill'} | |
| """ | |
| if not kw: |
| import doctest | |
| import work | |
| suite = DocTestSuite(work) | |
| # What goes here? |
| from datetime import datetime, timedelta | |
| from foo.datetime import something |
| $ python patcher.py | |
| -- UPDATE customer to version 1 | |
| create table customer ( | |
| id integer primary key, | |
| ); | |
| update _schema_version set version='1' where what='customer'; | |
| -- UPDATE customer to version 2 | |
| alter table customer add column (email text); | |
| create unique index foo on customer(email); | |
| update _schema_version set version='2' where what='customer'; |
| $ coverage run --branch ./thefile.py ; coverage report | |
| Name Stmts Miss Branch BrPart Cover | |
| ------------------------------------------- | |
| thefile 8 0 4 1 92% |
| [matt] /tmp $ python | |
| Python 2.6.6 (r266:84374, Aug 31 2010, 11:00:51) | |
| [GCC 4.0.1 (Apple Inc. build 5493)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> from subprocess import Popen, PIPE | |
| >>> | |
| >>> f = open('dafile', 'w') | |
| >>> f.write('import sys\n' | |
| ... 'raise Exception("hey")') | |
| >>> f.close() |
| [matt] ~ $ sftp -oPort=8022 [email protected]:/somefile /tmp/somefile | |
| Connecting to 10.1.15.5... | |
| [email protected]'s password: | |
| Fetching /somefile to /tmp/somefile | |
| Cannot download non-regular file: /somefile |
| Python 2.6.2 (r262:71600, Sep 14 2009, 13:43:10) | |
| [GCC 4.3.2] on linux2 | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> from psycopg2 import connect | |
| >>> from psycopg2.extras import DictCursor | |
| >>> from psycopg2 import extensions | |
| >>> | |
| >>> # do what you need to get these: | |
| ... from sm.db import connstr | |
| >>> |