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 codetransformer import CodeTransformer, pattern | |
from codetransformer.patterns import matchany, var, option | |
from codetransformer.instructions import ( | |
CALL_FUNCTION, | |
LOAD_CONST, | |
NOP, | |
POP_TOP, | |
POP_JUMP_IF_FALSE, | |
) | |
from codetransformer.utils.instance import instance |
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
$ ./ts < ts.c | |
2016-12-13 14:52:33-0500 #include <stdlib.h> | |
2016-12-13 14:52:33-0500 #include <stdio.h> | |
2016-12-13 14:52:33-0500 #include <time.h> | |
2016-12-13 14:52:33-0500 | |
2016-12-13 14:52:33-0500 int main(void) { | |
2016-12-13 14:52:33-0500 char c; | |
2016-12-13 14:52:33-0500 time_t t; | |
2016-12-13 14:52:33-0500 struct tm *tm; | |
2016-12-13 14:52:33-0500 char buf[BUFSIZ]; |
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
#include <type_traits> | |
#include <utility> | |
namespace association_list { | |
template<typename... Ps> | |
struct alist {}; | |
namespace dispatch { | |
template<typename A, typename K> | |
struct lookup {}; |
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
"""Example | |
.. code-block:: python | |
In [1]: a = Expensive(1, b=2) | |
In [2]: type(a) | |
Out[2]: __main__.LazyProxy | |
In [3]: a.method(3) |
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
/** C++ implementation of a memory arena with no knowledge of the CPython API. | |
*/ | |
#pragma once | |
#include <algorithm> | |
#include <array> | |
#include <exception> | |
#include <forward_list> | |
#include <iterator> | |
#include <new> |
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
#![feature(use_extern_macros)] | |
use std::io::Read; | |
struct State { | |
program: Vec<u8>, | |
ipt: usize, | |
tape: [u8; 30000], | |
ptr: usize, | |
control_stack: Vec<usize>, |
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
>>>> platform.python_implementation() | |
'PyPy' | |
>>>> sys.version_info | |
(major=2, minor=7, micro=13, releaselevel='final', serial=42) | |
>>>> def f(): | |
.... a = 'ayy' | |
.... def g(): | |
.... cell_set((lambda: a).__closure__[0], 'lmao') | |
.... g() | |
.... return a |
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
#include <array> | |
#include <tuple> | |
#include <type_traits> | |
#include <utility> | |
namespace cdict { | |
template<char... cs> | |
using string = std::integer_sequence<char, cs...>; |
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 itertools import chain, repeat | |
import sys | |
import types | |
# byte offsets for structures | |
if hasattr(sys, 'gettotalrefcount'): | |
# under PyDEBUG builds | |
_f_localsplus_offset = 392 | |
_ob_item_offset = 40 | |
else: |
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
""" | |
In [1]: class C: | |
...: __slots__ = 'a', 'b' | |
...: | |
In [2]: C.__slots__ | |
Out[2]: ('a', 'b') | |
In [3]: from deslot import deslot |