Skip to content

Instantly share code, notes, and snippets.

View justanr's full-sized avatar
🏴

anr (they/them) justanr

🏴
View GitHub Profile
@justanr
justanr / deprecate.py
Last active April 16, 2018 03:03
Setting up deprecations of Pluggy Hooks
import sys
import warnings
import inspect
from pluggy import HookimplMarker, HookspecMarker, PluginManager, _HookCaller, normalize_hookimpl_opts, HookImpl
class MetadataHookspecMarker(HookspecMarker):
"""
Allows storing arbitrary metadata on the hookspec options
instead of what Pluggy sets by default.
"""
#!/usr/bin/env python3
import random as _rng
class ShuffleQueue:
def __init__(self, items, rng=None):
self._idx = 0
self._items = items
self._rng = rng or _rng