Skip to content

Instantly share code, notes, and snippets.

View dhermes's full-sized avatar

Danny Hermes dhermes

View GitHub Profile
>>> class A(object):
... bar = None
... def __fu(self, bar):
... self.bar = bar
... def public_fu(self, bar):
... self.__fu(bar)
...
>>> a = A()
>>> print (a, a.bar)
(<__main__.A object at 0x7fd5d0274810>, None)
def _require_loaded(method):
"""Wrapper for an instance method to allow lazy loading."""
@functools.wraps(method)
def wrapped_method(self, *args, **kwargs):
"""Wrapped version of an instance method which requires loaded.
If the instance value of loaded is not True, then this will
reload before calling the method.
"""
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-9-c32065d02054> in <module>()
----> 1 get_ipython().run_cell_magic(u'octave', u'-s 500,500', u'b = [0.292893218813452 0.585786437626905 0.292893218813452];\na = [1 0 0.171572875253810];\nfreqz(b, a, 32);')
/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in run_cell_magic(self, magic_name, line, cell)
2160 magic_arg_s = self.var_expand(line, stack_depth)
2161 with self.builtin_trap:
-> 2162 result = fn(magic_arg_s, cell)
@dhermes
dhermes / new_acl.py
Created November 11, 2014 01:35
gcloud/storage/new_acl.py test case
"""Module docstring."""
def foo_acl(too):
"""Function docstring."""
return 42
# Diff base not specified, listing all files in repository.
# ************* Module gcloud.storage.new_acl
# W: 4,12: Unused argument 'too' (unused-argument)
#!/usr/bin/env python
import os
import sys
hooks_dir = os.path.dirname(os.path.abspath(__file__))
relative_dir = os.path.join(hooks_dir, '../..')
project_root = os.path.abspath(relative_dir)
git_included_config = os.path.join(project_root, 'config.js')
#!/usr/bin/env python
import os
hooks_dir = os.path.dirname(os.path.abspath(__file__))
relative_dir = os.path.join(hooks_dir, '../..')
project_root = os.path.abspath(relative_dir)
git_included_config = os.path.join(project_root, 'config.js')
confidential_config = os.path.join(project_root, '_config.js')
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# From https://www.googleapis.com/discovery/v1/apis/storage/v1/rest
"BucketAccessControls": {
"id": "BucketAccessControls",
"type": "object",
"description": "An access-control list.",
"properties": {
"items": {
"type": "array",
"description": "The list of items.",
From a966cfb54442605980e89c4c411472a617877092 Mon Sep 17 00:00:00 2001
From: Danny Hermes <daniel.j.hermes@gmail.com>
Date: Tue, 25 Nov 2014 18:17:42 -0800
Subject: [PATCH] Patch for gcloud-python.
---
apitools/__init__.py | 8 ++++----
apitools/base/__init__.py | 5 +----
apitools/base/py/__init__.py | 16 +---------------
apitools/base/py/http_wrapper.py | 4 ++--
@dhermes
dhermes / HTTP_REQUEST.txt
Last active August 29, 2015 14:10
endpoints-proto-datastore issue 114
POST http://localhost:8080/_ah/api/sbapi/v1/report
Content-Type: application/json
X-JavaScript-User-Agent: Google APIs Explorer
{
"account": "8239472394",
"compare": true,
"name": "Testreport",
"modules": [