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
# current method | |
obj = session.query(Foo).get(id) # select * from foo where id=? | |
obj.bar = session.query(Bar).get(bar_id) # select * from bar where id=? | |
# what i want: | |
obj = session.query(Foo).get(id) # select * from foo where id=? | |
obj.bar = session.hollow(Bar, bar_id) # invented name, no query should happen until i use attributes of obj.bar | |
# what i want to avoid |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<h1> stuff</h1> | |
</body> | |
</html> |
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
# this does not work since docs is not a factor | |
$ tox -e docs-html # will build html docs | |
$ tox -e docs-pdf # will build pdf docs |
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
def parse_payload(data): | |
assert data, "Invalid data to parse, it's empty." | |
length, extra = data.split(':', 1) | |
length = int(length) | |
payload, extra = extra[:length], extra[length:] | |
assert extra, "No payload type: %r, %r" % (payload, extra) | |
payload_type, remain = extra[0], extra[1:] | |
assert len(payload) == length, "Data is wrong length %d vs %d" % (length, len(payload)) |
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
detox | |
Traceback (most recent call last): | |
File "/usr/local/bin/detox", line 9, in <module> | |
load_entry_point('detox==0.4.dev3', 'console_scripts', 'detox')() | |
File "/home/ronny/Projects/codespeak/detox/detox/main.py", line 17, in main | |
detox.startloopreport() | |
File "/home/ronny/Projects/codespeak/detox/detox/proc.py", line 106, in startloopreport | |
if self.toxsession.report.tw.hasmarkup: | |
File "/home/ronny/Projects/codespeak/detox/detox/proc.py", line 115, in toxsession | |
self._toxconfig, Report=ToxReporter, popen=Popen) |
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
rake plugin="git://github.com/iriscouch/browserid_couchdb origin/master" |
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
% pypy-bin -m unittest test.test_oddball.ThreadingTest | |
MainThread: <TestThread(Thread-1, initial)>.start(): starting thread | |
<OS thread 139821105706752>: <Condition(<thread.lock object at 0x0000000003154260>, 0)>.notify(): no waiters | |
Thread-1: <TestThread(Thread-1, started 139821105706752)>.__bootstrap(): thread started | |
Thread-1: <TestThread(Thread-1, started 139821105706752)>.__bootstrap(): registering trace hook | |
Thread-1: <TestThread(Thread-1, started 139821105706752)>.__bootstrap(): normal return | |
Thread-1: <Condition(<thread.lock object at 0x0000000003154270>, 0)>.notify(): no waiters | |
MainThread: <TestThread(Thread-1, stopped 139821105706752)>.join(): thread stopped | |
Coverage.py warning: Trace function changed, measurement is likely wrong: None | |
FMainThread: <Thread(Thread-2, initial)>.start(): starting thread |
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
- name: test | |
hosts: application | |
roles: | |
- {role: deployment, app: "{{applications[0]}}", } | |
- {role: deployment, app: "{{applications[1]}}", when: '{{applications|length > 1}}' } | |
- {role: deployment, app: "{{applications[2]}}", when: '{{applications|length > 2}}' } | |
- {role: deployment, app: "{{applications[3]}}", when: '{{applications|length > 3}}' } | |
- {role: deployment, app: "{{applications[4]}}", when: '{{applications|length > 4}}' } | |
- {role: deployment, app: "{{applications[5]}}", when: '{{applications|length > 5}}' } | |
- {role: deployment, app: "{{applications[6]}}", when: '{{applications|length > 6}}' } |
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
# coding: utf-8 | |
import pytest | |
import os | |
import random | |
@pytest.fixture(params=xrange(10)) | |
def password(): | |
return os.urandom(random.randrange(6, 10)).encode("hex") |
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
#!/bin/bash | |
# A hacky command for a common task: | |
# - stash away all changes in working branch | |
# - update master from SVN | |
# - rebase working branch on master | |
# - flush all committed changes from working branch to master | |
# - push them to SVN | |
# - update working branch again | |
# - patch in changes |
OlderNewer