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 traceback | |
from contextlib import contextmanager | |
from sqlalchemy import create_engine, inspect, Column, Integer, String, DateTime, ForeignKey, Table, MetaData | |
from sqlalchemy.orm import sessionmaker, relationship, aliased, contains_eager, scoped_session, backref, mapper | |
engine = create_engine('sqlite:///:memory:', echo=True) | |
metadata = MetaData(bind=engine) | |
objecttypes = Table('objecttypes', metadata, | |
Column('id', Integer, primary_key=True), | |
Column('name', String) |
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 traceback | |
from contextlib import contextmanager | |
from sqlalchemy import create_engine, inspect, Column, Integer, String, DateTime, ForeignKey, Table, MetaData | |
from sqlalchemy.orm import sessionmaker, relationship, aliased, contains_eager, scoped_session, backref, mapper | |
engine = create_engine('sqlite:///:memory:', echo=False) | |
metadata = MetaData(bind=engine) | |
objecttypes = Table('objecttypes', metadata, | |
Column('id', Integer, primary_key=True), | |
Column('name', String) |
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 as sa | |
from sqlalchemy import create_engine, inspect, Column, Integer, String, DateTime, ForeignKey | |
from sqlalchemy.orm import sessionmaker, relationship, aliased, contains_eager, scoped_session | |
from sqlalchemy.ext.declarative import declarative_base | |
Base = declarative_base() | |
class ObjectType(Base): | |
__tablename__ = "objecttypes" | |
id=Column(Integer, primary_key=True) |
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 sqlalchemy import * | |
from sqlalchemy.orm import * | |
from sqlalchemy.ext.associationproxy import association_proxy | |
from sqlalchemy.ext.declarative import declarative_base | |
def buildConnectionString(db_type, server, port, name, user, password): | |
# We're using an in-memory data | |
if db_type == "sqlite": | |
return "sqlite://" |
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 yaml | |
import datetime | |
import sqlalchemy as sa | |
import sqlalchemy.orm as saOrm | |
class Run(object): | |
def __init__(self, **kwds): | |
for key in kwds: | |
setattr(self, key, kwds[key]) | |
return |
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 sqlalchemy import * | |
from sqlalchemy.orm import * | |
from sqlalchemy.ext.associationproxy import association_proxy | |
metadata = MetaData() | |
fruitTypesTable = Table( | |
'FruitTypes', metadata, | |
Column('type_id', Integer, primary_key=True), | |
Column('name', String(256)) |
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 sqlalchemy import * | |
from sqlalchemy.orm import * | |
from sqlalchemy.ext.associationproxy import association_proxy | |
from utils import deco, hashFunc, queryFunc | |
metadata = MetaData() | |
fruitTypesTable = Table( | |
'FruitTypes', metadata, | |
Column('type_id', Integer, primary_key=True), |
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 python:3 | |
COPY . /app | |
WORKDIR /app | |
RUN pip install -r requirements.txt | |
ENV FLASK_APP=/app/app.py |
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 asyncio | |
import threading | |
import time | |
import queue | |
from aiohttp import web | |
class Worker: | |
def __init__(self, queue): | |
self.queue = queue | |
self._t = threading.Thread(target=self._doStuff) |
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
// Uses retrofit to generate an implementation | |
public interface ICloud { | |
static String serviceProviderHeader = "X-Auth-Service-Provider"; | |
static String credentialsAuthorizationHeader = "X-Verify-Credentials-Authorization"; | |
@GET("/verify_credentials?provider=digits") | |
void verifyCredentials( | |
@Header(serviceProviderHeader) String serviceProvider, | |
@Header(credentialsAuthorizationHeader) String authorization, | |
@Query("id") long id, |