- Nice shortcut to create a list of strings
fields = '''\
test1,
test2,
test3,
test4'''.split()
# Copied from http://etienned.github.io/posts/extract-text-from-word-docx-simply/ | |
try: | |
from xml.etree.cElementTree import XML | |
except ImportError: | |
from xml.etree.ElementTree import XML | |
import zipfile | |
""" |
{ | |
"metadata": { | |
"name": "NikePlus data exploration" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
# This is a raw listing of the imports that take place dynamically by calling | |
# the pyqtgraph/__init__.py:importAll() in the following scenarios: | |
#importAll('graphicsItems', globals(), locals()) | |
#importAll('widgets', globals(), locals(), excludes=['MatplotlibWidget', 'RemoteGraphicsView']) | |
from .graphicsItems.ArrowItem import ArrowItem | |
from .graphicsItems.GraphicsWidgetAnchor import GraphicsWidgetAnchor | |
from .graphicsItems.GraphicsWidgetAnchor import Point | |
from .graphicsItems.GraphicsWidgetAnchor import QtCore |
Development Status :: 1 - Planning | |
Development Status :: 2 - Pre-Alpha | |
Development Status :: 3 - Alpha | |
Development Status :: 4 - Beta | |
Development Status :: 5 - Production/Stable | |
Development Status :: 6 - Mature | |
Development Status :: 7 - Inactive | |
Environment :: Console | |
Environment :: Console :: Curses | |
Environment :: Console :: Framebuffer |
# Snippet taken from: https://github.com/JakeWharton/pidcat/blob/master/pidcat.py | |
# unpack the current terminal width/height | |
data = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234') | |
HEIGHT, WIDTH = struct.unpack('hh',data) |
I recently spent a little time reviewing a Python bug report and determining if I was running with a fixed version of the Python interpreter. I think this is a useful exercise for someone who is overly curious and not a core developer of the language.
This post is a rundown of my thought process while trying to figure this out.
class mycontext(object): | |
def __enter__(self, *args, **kwargs): | |
print 'enter' | |
def __exit__(self, *args, **kwargs): | |
print 'exit' | |
def myfunc(): | |
with mycontext(): | |
# Gee what will happen here? |
# Taken from: http://qt-project.org/doc/qt-4.8/qevent.html#type | |
# Reformatted with: cat /tmp/events.txt | sort -t$'\t' -k2 -n | column -t -s $'\t' | |
QEvent::None 0 Not an event. | |
QEvent::Timer 1 Regular timer events (QTimerEvent). | |
QEvent::MouseButtonPress 2 Mouse press (QMouseEvent). | |
QEvent::MouseButtonRelease 3 Mouse release (QMouseEvent). | |
QEvent::MouseButtonDblClick 4 Mouse press again (QMouseEvent). | |
QEvent::MouseMove 5 Mouse move (QMouseEvent). | |
QEvent::KeyPress 6 Key press (QKeyEvent). |