2015-02-27
Caution: these (.reg) files change a registry entry of your PC and will affect its behavior. You should not apply them unless you understand the consequence.
# event.py (improved) | |
class Event(object): | |
def __init__(self, doc=None): | |
self.__doc__ = doc | |
def __get__(self, obj, objtype=None): | |
if obj is None: | |
return self |
# event.py (simple) | |
class Event(object): | |
def __init__(self): | |
self.handlers = [] | |
def add(self, handler): | |
self.handlers.append(handler) | |
return self |
#!/usr/bin/env python | |
"""Sample script which uses event.py (simple). """ | |
import event | |
class Publisher(object): | |
def __init__(self): |
#!/usr/bin/env python | |
"""Sample script which uses event.py (improved). """ | |
import event | |
class Publisher(object): | |
# Set event object in class declaration. |
#!/usr/bin/env python | |
import binascii | |
import socket | |
PORT_DEFAULT = 9 | |
IPADDR_DEFAULT = '<broadcast>' | |
_USAGE = """Usage: | |
python wol.py [options] <MAC address>... |
#!/usr/bin/env python | |
# | |
# Create hard links / junctions to the system-installed packages in | |
# a given virtualenv ("site-packages") directory. | |
# | |
# | |
# Background | |
# ========== | |
# | |
# Some libraries such as wxPython do not support pip installation yet. |
@echo off | |
setlocal enabledelayedexpansion | |
set TemplateDir=new-templates | |
REM # If no args are given, show help (and exit). | |
if "%1"=="" goto HELP | |
REM # Options | |
if /i "%1" == "/?" goto HELP |
#!/usr/bin/env python | |
from __future__ import (absolute_import, | |
division, | |
print_function, | |
unicode_literals) | |
import math | |
import time | |
import wx |
def iterlines_backword(s): | |
""" Iterate lines of `s` from its tail to its top. | |
>>> list(iterlines_backword('a')) | |
['a'] | |
>>> list(iterlines_backword('a\\n')) | |
['a\\n'] | |
>>> list(iterlines_backword('a\\nb')) | |
['b', 'a\\n'] |