This file contains 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 functools | |
import inspect | |
# my_meta = { | |
# "a": "ay", | |
# "b": "bee", | |
# } | |
# | |
# | |
# def metadecorator(name, meta=None): |
This file contains 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 typing import Any, Union, Dict | |
from typing_extensions import TypedDict, Protocol | |
class FooMeta: | |
meta = dict(a=1) | |
class BarMeta: |
This file contains 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 collections | |
import logging, pathlib | |
import csv | |
log = logging.getLogger(__name__) | |
def read_dat(path): | |
with path.open("r", encoding="latin1") as f: |
This file contains 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 sds | |
import random | |
import functools | |
def microtest(hyp, offset, search_space, model): | |
""" Performs a partial evaluation of a hypothesis. | |
- hyp: A location in the search space. | |
- offset: The part of the hypothesis to be evaluated. | |
- search_space: The full search space. |
This file contains 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 | |
from collections import Counter | |
search_space = "xxxhelxxxelloxxxxxxhelloxxxxx" | |
model = "hello" | |
tests = [ | |
lambda hyp: search_space[hyp] == model[0], | |
lambda hyp: search_space[hyp + 1] == model[1], |
This file contains 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
# Tail recursive fibonacci | |
def get_fib(final, num=1, current=1, prev=0): | |
if final == 0: | |
return 0 | |
if num < final: | |
prev, current = current, prev + current | |
return get_fib(final, num + 1, current, prev) | |
else: | |
return current |
This file contains 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 | |
class Poison: | |
_artist = "Alice Cooper" | |
_album = "Trash" | |
_released = 1989 | |