This file contains hidden or 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 random as random_mod | |
try: | |
import ctypes | |
_long_as_byte_array = ctypes.pythonapi._PyLong_AsByteArray | |
_long_as_byte_array.argtypes = [ | |
ctypes.py_object, | |
ctypes.POINTER(ctypes.c_char), |
This file contains hidden or 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
/* | |
Helper program for resolving the path to the interpreter executable | |
relative to the script location in shebangs. | |
Sample usage: | |
#!/usr/bin/delegate ../my-virtualenv/bin/python | |
import sys | |
def main(): |
This file contains hidden or 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 sys | |
import types | |
def _patched_name(code, name): | |
# argument order is described in help(types.CodeType) | |
return types.CodeType( | |
code.co_argcount, | |
code.co_nlocals, | |
code.co_stacksize, |
This file contains hidden or 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 OrderedDict | |
class EnumMeta(type): | |
def __init__(cls, name, bases, attrs): | |
super(EnumMeta, cls).__init__(name, bases, attrs) | |
if 'Consts' not in attrs: | |
cls.Consts = type( | |
'Consts', | |
(Enum.Consts, ), |