Skip to content

Instantly share code, notes, and snippets.

View mcdonc's full-sized avatar

Chris McDonough mcdonc

View GitHub Profile
from pyramid.config import Configurator
from pyramid.view import view_config
from waitress import serve
import colander
from pyramid_deform import SessionFileUploadTempStore, CSRFSchema
import deform
from deform import widget
@colander.deferred
### Keybase proof
I hereby claim:
* I am mcdonc on github.
* I am mcdonc (https://keybase.io/mcdonc) on keybase.
* I have a public key ASB_WBs_JoroZ76SlZJvQGbzm5lCeNzVubCGoYEj9Pu3sAo
To claim this, I am signing this object:
diff --git a/firestore/google/cloud/firestore_v1beta1/watch.py b/firestore/google/cloud/firestore_v1beta1/watch.py
index bc2b237bc1..a11313d6c3 100644
--- a/firestore/google/cloud/firestore_v1beta1/watch.py
+++ b/firestore/google/cloud/firestore_v1beta1/watch.py
@@ -619,10 +619,10 @@ class Watch(object):
assert name in updated_map, 'Document to delete does not exist'
old_document = updated_map.get(name)
# XXX probably should not expose IndexError when doc doesnt exist
- existing = updated_tree.find(old_document)
+ existing = updated_tree.find(name)
=================================== FAILURES ===================================
_________ TestWatch.test__compute_snapshot_operation_relative_ordering _________
self = <tests.unit.test_watch.TestWatch testMethod=test__compute_snapshot_operation_relative_ordering>
def test__compute_snapshot_operation_relative_ordering(self):
from google.cloud.firestore_v1beta1.watch import WatchDocTree
doc_tree = WatchDocTree()
class DummyDoc(object):
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid import httpexceptions
def nocontent(request):
return httpexceptions.HTTPNoContent()
if __name__ == '__main__':
config = Configurator()
config.add_view(nocontent, route_name='nocontent')
_____________________________ test_watch_document ______________________________
client = <google.cloud.firestore_v1beta1.client.Client object at 0x7f5b1b24ca90>
cleanup = <built-in method append of list object at 0x7f5b18983d88>
def test_watch_document(client, cleanup):
db = client
doc_ref = db.collection(u'users').document(
u'alovelace' + unique_resource_id())
@mcdonc
mcdonc / gist:1270482
Created October 7, 2011 15:11
apidoc messing around
# framework
from pyramid.view import view_config
from pyramid.interfaces import IRoutesMapper
class api(view_config):
def __init__(self, **kw):
view_config.__init__(self, **kw)
def __call__(self, func):
@mcdonc
mcdonc / gist:3898894
Created October 16, 2012 12:11
oh my god i'm using emacs to reindent html in sublime text 2
# Sublime's HTML reindenting is currently pretty bad. And Tidy and xmllint
# change my code in ways I don't really like or need. I just need the thing
# reindented sanely. Emacs did that pretty well.
#
# One thing led to another. A few drinks later and now I'm using Emacs to
# reindent HTML from within Sublime.
#
# Save the contents of this file as ohmygodemacs.py in your User directory.
# Then save the contents of the following docstring as ohmygodemacs.elsip in your
# User directory
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@agendaless.com
ServerName bokehtest.agendaless.com
ErrorLog /var/log/apache2/bokeh-error.log
CustomLog /var/log/apache2/bokeh-access.log combined
RewriteEngine On
RewriteRule ^/(.*) http://127.0.0.1:5006/$1 [L,P]
ProxyPreserveHost On
@mcdonc
mcdonc / hello.py
Last active December 29, 2015 20:29 — forked from offby1/hello.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from chameleon import PageTemplate
template = PageTemplate("Hello, ${name}.")
for name in ('Fred', u'ἃc', '\xf8'):
print(template(name=name))