This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright 2013 by Vinay Sajip. | |
# Licensed to the Python Software Foundation under a contributor agreement. | |
# | |
''' | |
Usage: pyzzer.py [options] DIRS | |
Convert Python source directories to runnable zip files. | |
Options: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright (C) 2012 Vinay Sajip. Licensed under the MIT license. | |
# | |
from collections import namedtuple | |
import logging | |
import re | |
class Snapper(object): | |
DEFAULT_CONFIG = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import logging.config | |
import logging.handlers | |
from multiprocessing import Process, Queue, Event, current_process | |
import os | |
import random | |
import time | |
class MyHandler(object): | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
class CustomFormatter(logging.Formatter): | |
def __init__(self, default): | |
self.default = default | |
def format(self, record): | |
if record.levelno in (logging.WARNING, | |
logging.ERROR, | |
logging.CRITICAL): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import random | |
import re | |
class DelegatingHandler(logging.Handler): | |
def __init__(self, *handlers): | |
logging.Handler.__init__(self) | |
self.handlers = handlers | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Copyright (C) 2011 Vinay Sajip. All Rights Reserved. | |
# | |
# Permission to use, copy, modify, and distribute this software and its | |
# documentation for any purpose and without fee is hereby granted, | |
# provided that the above copyright notice appear in all copies and that | |
# both that copyright notice and this permission notice appear in | |
# supporting documentation, and that the name of Vinay Sajip | |
# not be used in advertising or publicity pertaining to distribution | |
# of the software without specific, written prior permission. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license. | |
# | |
import ctypes | |
import logging | |
import os | |
class ColorizingStreamHandler(logging.StreamHandler): | |
# color names to indices | |
color_map = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import sys | |
from logutils.dictconfig import dictConfig | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'formatters': { | |
'standard': { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright (C) 2013 Vinay Sajip. All rights reserved. | |
# | |
import re | |
import sys | |
import unittest | |
from distlib.util import Configurator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codecs | |
import itertools | |
import json | |
import optparse # support 2.6 | |
import os | |
import sys | |
from sqlalchemy import create_engine | |
from sqlalchemy import Column, Date, Integer, String, ForeignKey | |
from sqlalchemy.ext.declarative import declarative_base |