Skip to content

Instantly share code, notes, and snippets.

Bradley M. Froehle bfroehle

Block or report user

Report or block bfroehle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bfroehle
bfroehle / docstring_property.py
Created Nov 8, 2012
Property decorator for the `__doc__` attribute.
View docstring_property.py
"""Property decorator for the `__doc__` attribute.
Useful for when you want a custom docstring for class instances
while still showing a generic docstring for the class itself.
A naive attempt using `@property` generally breaks Sphinx as
`cls.__doc__` returns the property object itself, and not a string.
See the documentation for `docstring_property` for an example.
"""
@bfroehle
bfroehle / .gitignore
Created Aug 25, 2012
Bitey Magic, an IPython extension
View aster.build.log
$ LLVM_CONFIG_PATH=llvm-config-3.1 python setup.py build
LLVM version = 3.1
Generate intrinsic IDs
Using PTX
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/llvm
copying llvm/__init__.py -> build/lib.linux-x86_64-2.7/llvm
View ipython-stripped.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head><body>
<p>Python 2.7.3 (default, Aug 1 2012, 05:14:39) </p>
<p>Type &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p>
<p><br /></p>
<p>IPython 0.14.dev -- An enhanced Interactive Python.</p>
<p>? -&gt; Introduction and overview of IPython's features.</p>
<p>%quickref -&gt; Quick reference.</p>
View Cython Magic.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bfroehle
bfroehle / results.log
Created Jul 31, 2012
IPython test log
View results.log
..............................................
----------------------------------------------------------------------
Ran 46 tests in 0.060s
OK
....................................................E.....................................................................................................................................................................................................................................................................................................................................................................................................................................K.........
======================================================================
ERROR: test format constraint, and validity of jpeg and png
----------------------------------------------------------------------
Traceback (most recent call last):
@bfroehle
bfroehle / gist:3153959
Created Jul 21, 2012
IPython #2179 Failure
View gist:3153959
..............................................
----------------------------------------------------------------------
Ran 46 tests in 0.066s
OK
..................................................................................................................................................................................................................S....................................................................................................................................K.........
----------------------------------------------------------------------
Ran 353 tests in 23.375s
OK (KNOWNFAIL=1, SKIP=1)
@bfroehle
bfroehle / 00README.rst
Created Jun 13, 2012 — forked from GaelVaroquaux/00README.rst
Copy-less bindings of C-generated arrays with Cython
View 00README.rst

Cython example of exposing C-computed arrays in Python without data copies

The goal of this example is to show how an existing C codebase for numerical computing (here c_code.c) can be wrapped in Cython to be exposed in Python.

The meat of the example is that the data is allocated in C, but exposed in Python without a copy using the PyArray_SimpleNewFromData numpy

View test_oinspect.py
import sys
import nose.tools as nt
from IPython.core import oinspect
def test_oinspect_f2py():
from numpy import f2py
# This is FORTRAN, so the indentation is important:
source = \
@bfroehle
bfroehle / knee.py
Created Feb 29, 2012
knee.py for Python 2.6, 2.7, and 3.2
View knee.py
"""
An Python re-implementation of hierarchical module import.
Function names and arguments have been chosen to mimic the C code in
`Python/import.c` whenever possible.
This code is intended to be read, not executed. However, it does work
-- all you need to do to enable it is "import knee".
(The name is a pun on the klunkier predecessor of this module, "ni".)
You can’t perform that action at this time.