- Update HISTORY.rst
- Update version number in
my_project/__init__.py
- Update version number in
setup.py
- Install the package again for local development, but with the new version number:
python setup.py develop
- Run the tests:
python setup.py test
my_project/__init__.py
setup.py
python setup.py develop
python setup.py test
class GzipBuffer(object): | |
def __init__(self): | |
self.len = 0 | |
self.buffer = io.BytesIO() | |
self.writer = gzip.GzipFile(fileobj=self.buffer, mode='wb') | |
def append(self, thing): | |
self.len += 1 | |
self.writer.write(thing) |
class GzipBuffer(object): | |
def __init__(self): | |
self.len = 0 | |
self.buffer = io.BytesIO() | |
self.writer = gzip.GzipFile(fileobj=self.buffer, mode='wb') | |
def append(self, thing): | |
self.len += 1 | |
self.writer.write(thing) |
# It's not pretty, but it get's the job done. JSON is valid Python, so you can eval it, | |
# provided that you have the proper names in scope, like ObjectId and ISODate | |
from dateutil import parser | |
NumberLong = int | |
ObjectId = str | |
false = False |
""" Caches expensive function calls in pickled bytes on disk. """ | |
import os | |
import shutil | |
import subprocess | |
import dill | |
from functools import wraps | |
import hashlib | |
import base64 |
I hereby claim:
To claim this, I am signing this object:
object implicits { | |
implicit class ESFuture[Response <: ActionResponse](future: ListenableActionFuture[Response]) | |
extends Future[Response] { | |
override def onComplete[U](f: (Try[Response]) => U)(implicit executor: ExecutionContext): Unit = { | |
future.addListener(new ActionListener[Response] { | |
override def onFailure(e: Throwable): Unit = throw e | |
override def onResponse(response: Response): Unit = f(Try(response)) | |
}) |
#!/usr/bin/env bash | |
# Usage: $ ec2ssh cassandra-i-3 | |
ssh $(aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value | [0], PrivateIpAddress]' --output text | grep $1 | head -n 1 | python -c 'import sys; print(sys.stdin.read().split("\t")[1].strip())') |
from gensim.models import Phrases | |
import sys | |
assert len(sys.argv) > 2, "Need gensim model path and output filename!" | |
in_path, out_path = sys.argv[:2] | |
class PrefixTree(object): | |
def __init__(self, words, impl=dict, suffix_impl=list): | |
self.word = words[0] |
import scala.sys.process._ | |
object BetaDistributionFit { | |
val distName: String = "beta" | |
def fitCommand(samples: Seq[Double]): Seq[String] = | |
Seq("python", "-c", | |
s""" | |
|from scipy import stats |