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 array | |
import tracemalloc | |
from contextlib import contextmanager | |
@contextmanager | |
def tracemem(msg): | |
tracemalloc.start() | |
snapshot1 = tracemalloc.take_snapshot() | |
yield | |
snapshot2 = tracemalloc.take_snapshot() |
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 inspect | |
class n_partialable(object): | |
@staticmethod | |
def arity_evaluation_checker(function): | |
is_class = inspect.isclass(function) | |
if is_class: | |
function = function.__init__ |
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 | |
import os | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.web | |
import subprocess | |
import shlex | |
import fcntl | |
import errno | |
from cStringIO import StringIO |
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
""" | |
module mydjangolib.bigint_patch | |
A fix for the rather well-known ticket #399 in the django project. | |
Create and link to auto-incrementing primary keys of type bigint without | |
having to reload the model instance after saving it to get the ID set in | |
the instance. | |
Logs: |
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 | |
# -*- coding: utf-8 -*- | |
""" | |
Build a pip-compatible sdist for the flit package in the current directory. | |
""" | |
import flit, zipfile, os.path | |
def build_sdist(): | |
# build wheel |
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
language: python | |
python: '3.5' | |
sudo: false | |
env: | |
global: | |
LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so | |
matrix: | |
- TOXENV=check | |
{% for env, config in tox_environments|dictsort %} | |
- TOXENV={{ env }}{% if config.cover %},extension-coveralls,coveralls,codecov{% endif %} |
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
# The MIT License (MIT) | |
# | |
# Copyright (c) 2013 Daniel Watkins <daniel@daniel-watkins.co.uk> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of | |
# this software and associated documentation files (the Software), to deal in | |
# the Software without restriction, including without limitation the rights to | |
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
# the Software, and to permit persons to whom the Software is furnished to do so, | |
# subject to the following conditions: |
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
#!/bin/bash -eEx | |
if ! which gpg-agent; then | |
sudo apt-get install gnupg-agent | |
fi | |
if ! which pull-lp-source; then | |
sudo apt-get install ubuntu-dev-tools | |
fi | |
gpg-agent || eval `gpg-agent --daemon` |
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 sys | |
try: | |
from sqlparse import format as sqlformat | |
except ImportError: | |
sqlformat = lambda s, reindent=None: s | |
from traceback import format_stack | |
class WithStacktrace(object): | |
def __init__(self, skip=[], limit=5): | |
self.skip = [__name__, 'logging'] |
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 sys | |
import warnings | |
from types import ModuleType | |
from importlib import import_module | |
try: | |
basestring | |
except NameError: | |
basestring = str |
OlderNewer