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 functools import lru_cache | |
@lru_cache(None) | |
def getvalue() -> List[Set[int]]: | |
return [{1, 2}, {3}] | |
x = getvalue() | |
x.append({4}) | |
y = getvalue() |
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 __future__ import absolute_import, print_function | |
import logging | |
import datetime | |
from google.protobuf import duration_pb2 | |
from apache_beam.coders import coders | |
from apache_beam.portability import common_urns | |
from apache_beam.portability.api import standard_window_fns_pb2 |
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
""" | |
Demo of a bunch of asyncio + gevent scenarios using aiogevent. | |
These are not tests in the sense that there are no assertions, but pytest | |
is a nice way to run them in bulk or choose a specific "test" | |
Run like this: | |
python3 -m pytest test_coexist.py -s -v |
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 __future__ import absolute_import, print_function | |
from typing import Generic | |
# MRO code adapted from https://gist.github.com/pendulm/2271366 | |
def head(l): | |
return l[0] | |
def tail(l): |
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 sqlalchemy | |
from sqlalchemy import event | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import create_engine, Table, Column, Integer, String, ForeignKey | |
from sqlalchemy.orm import sessionmaker, scoped_session, relationship, backref | |
import datetime | |
Base = declarative_base() | |
engine = create_engine('sqlite://', echo=False) | |
Session = scoped_session(sessionmaker(bind=engine)) |
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 sqlalchemy | |
from sqlalchemy import event | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import create_engine, Table, Column, Integer, String, ForeignKey | |
from sqlalchemy.orm import sessionmaker, scoped_session, relationship, backref | |
import datetime | |
Base = declarative_base() | |
engine = create_engine('sqlite://', echo=False) | |
Session = scoped_session(sessionmaker(bind=engine)) |
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 sqlalchemy | |
from sqlalchemy import event | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import create_engine, Table, Column, Integer, String, ForeignKey | |
from sqlalchemy.orm import sessionmaker, scoped_session, relationship, backref | |
import datetime | |
Base = declarative_base() |
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
print "top foo" | |
f = open("/Volumes/newhome/chad/python/multiproc.py", 'r') | |
exec f |