View gist:511519
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 redisco.containers import List | |
class TypedList(object): | |
"""Create a container to store a list of objects in Redis. | |
Arguments: | |
key -- the Redis key this container is stored at | |
target_type -- can be a Python object or a redisco model class. | |
Optional Arguments: |
View gist:521191
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
:~/devenv/celery/src/celery/tests$ nosetests test_task.py | |
........EE.E............................................. | |
====================================================================== | |
ERROR: test_is_due (celery.tests.test_task.TestPeriodicTask) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/clayg/workspace/celery/celery/tests/test_task.py", line 479, in test_is_due | |
due, remaining = p.is_due(datetime.now() - p.run_every.run_every) | |
AttributeError: 'datetime.timedelta' object has no attribute 'run_every' |
View gist:527661
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
(eventlet)clayg@clayg-desktop:~/devenv/eventlet/app$ cat magic.py | |
from eventlet import spawn | |
from eventlet.debug import hub_exceptions | |
#hub_exceptions(False) | |
def deadz(): | |
raise Exception('u r deadz') | |
try: | |
deadz() |
View gist:603968
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 time import time | |
class StopWatch(): | |
""" | |
Like using a stopwatch to time things, use start and stop methods, | |
restart will reset the timer | |
""" | |
def __init__(self, start=False): | |
"""New timers are not started by default |
View expected_failure decorator
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
#!/usr/bin/env python | |
import unittest | |
from functools import wraps | |
def something_that_returns_true(): | |
return True | |
def something_else_that_returns_true(): | |
return False |
View server.py
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
#! /usr/bin/env python | |
""" | |
My take on resource CRUD mapped to RESTful url handling | |
""" | |
import errno | |
import json | |
import os | |
from optparse import OptionParser | |
import sys | |
import time |
View gist:978791
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
$ ./storage/server.py | |
starting storage server on port 8081... | |
Traceback (most recent call last): | |
File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run | |
self.result = application(self.environ, self.start_response) | |
File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 147, in __call__ | |
resp = self.call_func(req, *args, **self.kwargs) | |
File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 208, in call_func | |
return self.func(req, *args, **kwargs) | |
File "./storage/server.py", line 102, in __call__ |
View gist:980938
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
Traceback (most recent call last): | |
File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run | |
self.result = application(self.environ, self.start_response) | |
File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 147, in __call__ | |
resp = self.call_func(req, *args, **self.kwargs) | |
File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 208, in call_func | |
return self.func(req, *args, **kwargs) | |
File "./storage/server.py", line 110, in __call__ | |
print self.mapper.match(req.path) | |
AttributeError: 'StorageServer' object has no attribute 'mapper' |
View gist:980947
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
starting storage server on port 8081... | |
Traceback (most recent call last): | |
File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run | |
self.result = application(self.environ, self.start_response) | |
File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 147, in __call__ | |
resp = self.call_func(req, *args, **self.kwargs) | |
File "/usr/local/lib/python2.6/dist-packages/webob/dec.py", line 208, in call_func | |
return self.func(req, *args, **kwargs) | |
File "./storage/server.py", line 116, in __call__ | |
controller = self.controller_map.get(controller, None)() |
View gist:988941
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
clayg@lunr1:~$ lunr-api | |
starting api server on port 8000... | |
Traceback (most recent call last): | |
File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run | |
self.result = application(self.environ, self.start_response) | |
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 147, in __call__ | |
resp = self.call_func(req, *args, **self.kwargs) | |
File "/usr/lib/pymodules/python2.6/webob/dec.py", line 208, in call_func | |
return self.func(req, *args, **kwargs) | |
File "/mnt/workspace/lunr/lunr/api/server.py", line 33, in __call__ |
OlderNewer