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
[buildout] | |
eggs-directory = /home/ralf/.buildout/cache/eggs | |
download-cache = /home/ralf/.buildout/cache/download | |
extends-cache = /home/ralf/.buildout/extends | |
index = http://pypi/simple/ |
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
# demo file showing how to serve multiple collections under different | |
# paths and replacing the root view | |
# run 'gunicorn -w4 multi_pypi_custom_root:app_public' | |
import pypiserver | |
app_public = pypiserver.app("/home/ralf/packages/private") | |
app_private = pypiserver.app("/home/ralf/packages/public") | |
app_public.mount("/private", app_private) |
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/python | |
"""WSGI server example""" | |
from gevent.pywsgi import WSGIServer | |
def application(env, start_response): | |
if env['PATH_INFO'] == '/': | |
start_response('200 OK', [('Content-Type', 'text/html')]) |
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 py.test | |
import pytest | |
class Client(object): | |
def __init__(self, url): | |
self.usable = True | |
self.url = url | |
def __repr__(self): | |
return "Client %r" % self.__dict__ |
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 | |
"""reproduce https://github.com/majek/puka/issues/34 | |
starting 2 instances of this program reproduces the error in less than | |
20s on my machine | |
""" | |
import puka, os |
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 gevent | |
from gevent.hub import get_hub | |
lst = [] | |
def _on_async(): | |
oldlen = len(lst) | |
for fun, args, kw in lst[:]: | |
gevent.spawn(fun, *args, **kw) | |
del lst[:oldlen] |
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 threading | |
def pytest_runtest_setup(item): | |
item.activeCount = threading.activeCount() | |
item.session._setupstate.prepare(item) | |
def pytest_runtest_teardown(item, nextitem): | |
item.session._setupstate.teardown_exact(item, nextitem) | |
after = threading.activeCount() | |
before = item.activeCount | |
assert after == before, "number of threads changed from %s to %s" % (before, after) |
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/sh | |
# helper script for gevent .git repository | |
# setup private ignore file and a custom script to build a versioned sdist | |
test -e gevent/__init__.py -a -e .git || exit "run this inside the gevent git repository" | |
cat >.git/make-sdist <<'EOF' | |
#! /bin/sh -e | |
test -e gevent/__init__.py -a -e .git || exit "run this inside the gevent git repository" |
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
# py.test fails with "TypeError: unorderable types: NoneType() < int()" | |
import unittest | |
class TestJoinEmpty(unittest.TestCase): | |
pass | |
def make_test(): | |
class Test(unittest.TestCase): | |
pass | |
Test.__name__ = "TestFoo" |
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
#include <exception> | |
#include <iostream> | |
class fopen_failed: public std::exception | |
{ | |
public: | |
const char *what() const throw() { | |
return "fopen failed"; | |
} | |
}; |