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
from collections import namedtuple | |
from datetime import datetime | |
from itertools import groupby | |
from operator import attrgetter | |
import re | |
import sys | |
import pylab as pl | |
Log = namedtuple("Log", ("url", "date", "ip", "code", "verb")) |
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
from collections import namedtuple | |
from datetime import datetime | |
from itertools import groupby | |
from operator import attrgetter | |
import re | |
import sys | |
import pylab as pl | |
Log = namedtuple("Log", ("url", "date", "ip", "status", "verb")) |
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
>>> from Crypto import Hash | |
>>> Hash.MD5 | |
Traceback (most recent call last): | |
File "<ipython-input-3-cffbba359383>", line 1, in <module> | |
Hash.MD5 | |
AttributeError: 'module' object has no attribute 'MD5' | |
>>> from Crypto.Hash import MD5 | |
>>> MD5 | |
<module 'Crypto.Hash.MD5' from '/home/alexis/dev/python/venv/crypto/local/lib/python2.7/site-packages/Crypto/Hash/MD5.pyc'> |
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
# This doesn't work (self isn't passed when calling obj.bar or obj.baz | |
class MyClass(object): | |
def foo(self, foo=None): | |
# do something with foo | |
bar = functools.partial(foo="bar") | |
baz = functools.partial(foo="baz") | |
# This works |
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
class Assertions(object): | |
"""Custom class to deal with assertions. it provides some hight level | |
methods that you can call to get valid or invalid assertions. | |
If many assertions are contained, then it will loop on them. | |
""" | |
def __init__(self, assertions): | |
self._assertions = assertions | |
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
try: | |
cache['foo'] | |
except KeyError: | |
pass | |
else: | |
self.assertTrue(False, "KeyError hadn't been thrown") |
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 time | |
import sys | |
from tokenserver.tests.support import (MockCryptoWorker, PurePythonRunner, | |
sign_data) | |
def timed(msg): | |
def _timed(func): | |
def __timed(*args, **kw): | |
sys.stdout.write(msg + '...') |
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
[powerhose] | |
backend = tokenserver.crypto.master.PowerHoseRunner | |
endpoint = ipc:///tmp/powerhose-front.ipc |
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
pint(self.conf_get('main', 'vusers')) |
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
./index.js | |
node.js:201 | |
throw e; // process.nextTick error, or 'error' event on first tick | |
^ | |
Error: Cannot find module './_mapnik.node' | |
at Function._resolveFilename (module.js:332:11) | |
at Function._load (module.js:279:25) | |
at Module.require (module.js:354:17) | |
at require (module.js:370:17) |