I hereby claim:
- I am danielhfrank on github.
- I am df (https://keybase.io/df) on keybase.
- I have a public key whose fingerprint is 6627 401D 1986 3A54 3235 A733 5B08 4339 A82D F24E
To claim this, I am signing this object:
import asyncio | |
import trio | |
import sys | |
async def fib(n: int) -> int: | |
if n < 0: | |
raise ValueError('boom') | |
elif n in {0, 1}: |
from typing import Generic, TypeVar | |
import numpy as np | |
from pydantic.fields import ModelField | |
JSON_ENCODERS = { | |
np.ndarray: lambda arr: arr.tolist() | |
} | |
DType = TypeVar('DType') |
package com.stripe.danielhfrank | |
import com.twitter.algebird.Monoid | |
import scala.annotation.tailrec | |
import scala.collection.mutable | |
class OverTimeMonoid[V: Monoid] extends Monoid[ Seq[(Long, V)]] { | |
override def zero: Seq[(Long, V)] = Seq.empty |
#!/usr/bin/env ruby | |
PENDING=2 | |
NO_STATUS=3 | |
return_txt = "" | |
loop do | |
return_txt = `hub ci-status -v` | |
break unless [PENDING, NO_STATUS].include?($?.exitstatus) | |
sleep(1) |
#!/usr/bin/env sh | |
while [ `hub ci-status` = "pending" ]; do | |
sleep 5 | |
done | |
terminal-notifier -message "Build finished" |
I hereby claim:
To claim this, I am signing this object:
def passthrough_errors(method): | |
@functools.wraps(method) | |
def wrapper(*args, **kwargs): | |
callback = kwargs['callback'] | |
data = args[0] | |
# Check if an error is being passed in, somehow | |
error = None | |
if isinstance(data, tornado.httpclient.HTTPResponse) and data.error: | |
error = data.error |
def retry_with_backoff(method): | |
""" | |
The idea was to use this to decorate a method that makes some kind of request and has a callback | |
kwarg. The callback will be decorated to retry the calling function a few times, | |
with backoff, if it receives an error. | |
""" | |
@functools.wraps(method) | |
def caller_wrapper(self, *args, **kwargs): | |
callback = kwargs['callback'] | |
attempts = kwargs.pop('attempts', 0) |
class UnitIntervalScaler(object): | |
def fit(self, xs): | |
self._floor = np.min(xs) | |
self._range = np.max(xs) - self._floor | |
return self | |
def transform(self, x): | |
return (x - self._floor) / self._range |
class X(object): | |
def __str__(self): | |
return 'x' | |
def my_print_arg(*args): | |
print args[0] | |
def print_arg(*args): | |
print args[0] |