This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import doctest | |
import work | |
suite = DocTestSuite(work) | |
# What goes here? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
from foo.datetime import something |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ coverage run --branch ./thefile.py ; coverage report | |
Name Stmts Miss Branch BrPart Cover | |
------------------------------------------- | |
thefile 8 0 4 1 92% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[matt] ~ $ sftp -oPort=8022 foo@10.1.15.5:/somefile /tmp/somefile | |
Connecting to 10.1.15.5... | |
foo@10.1.15.5's password: | |
Fetching /somefile to /tmp/somefile | |
Cannot download non-regular file: /somefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import sqlite3 | |
>>> from decimal import Decimal as D | |
>>> | |
>>> | |
>>> db = sqlite3.connect(':memory:') | |
>>> | |
>>> cur = db.cursor() | |
>>> _ = cur.execute('''create table foo ( | |
... id integer primary key, | |
... val decimal(12,2) default 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Chart</title> | |
<style> | |
path { | |
stroke: #f00; | |
} | |
.line { | |
stroke: #0f0; | |
fill: none; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Bite-sized Twisted: Introduction and the Reactor</title> | |
<style> | |
body { | |
font: normal normal 16px Crimson Text; | |
color: #666666; | |
background: #ffffff none repeat scroll top left; | |
padding: 0 0 0 0; | |
} |