Skip to content

Instantly share code, notes, and snippets.

exchange = Exchange(CONSUMER_EXCHANGE, type='direct')
lookout_queue = Queue('lookout_rep', exchange, CONSUMER_QUEUE_ROUTING_KEY)
class LookoutConsumerStep(bootsteps.ConsumerStep):
def get_consumers(self, channel):
return [Consumer(channel, queues=[lookout_queue], callbacks=[self.handle_message], accept=['json'])]
def handle_message(self, body, message):
from DNotify.logic.replication import handle_replication_message
@api_view(['GET', 'PUT', 'DELETE', 'HEAD'])
@spy(persist=SPY_PERSIST, log=False, replicate=SPY_REPLICATE, category='site_updates')
def site_detail(request, customer_num):
pass
@curtisforrester
curtisforrester / atom_io_snippet.txt
Created September 25, 2015 14:18
Atom.io snippet to generate a Python method skeleton
'.source.python':
'Class method':
'prefix': 'defs'
'body': """
def ${1:foo}(self$2):
\\"\\"\\" $3
:unit_test:
\\"\\"\\"
"""
class CompileTagsTests(TestCase):
"""Auto-gen by DocTag"""
def setUp(self):
pass
def tearDown(self):
pass
def test_create_instance(self):
@curtisforrester
curtisforrester / doc_tags_code
Created September 25, 2015 13:48
A example of Python code tagged for doc_tags.
class CompileTags(object):
"""
Compiles a source module and extracts our tags from docstrings.
:unit_test_class: CompileTagsTests
"""
re_keyword_line = r':(unit_test[_a-z]*): *([a-zA-Z_]*)'
def __init__(self, module_name, verbose=False):
"""
:unit_test: create_instance
import Foundation
extension String
{
var length: Int {
get {
return count(self)
}
}