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
# License: MIT | |
from argparse import ArgumentParser | |
from itertools import product | |
import numpy as np | |
import pandas as pd | |
_r = 8750 | |
_c = 15 | |
_sizes = { |
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 create_engine, Column, Integer, String, ForeignKey, inspect | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import relationship, with_polymorphic, selectinload | |
from sqlalchemy.orm import sessionmaker | |
engine = create_engine('sqlite:///:memory:', echo=True) | |
Session = sessionmaker(bind=engine) | |
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
server_port = testing.get_unused_port() | |
base_url = 'http://{}:{}/'.format(_SERVER_HOST, server_port) | |
with _run_server_isolated(process_factory, _SERVER_HOST, server_port) as server: | |
# NOTE(kgriffs): Let the server start up. Give up after 5 seconds. | |
start_ts = time.time() | |
while (time.time() - start_ts) < 5: | |
try: | |
requests.get(base_url, timeout=0.2) |
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
#!/usr/bin/env python | |
# | |
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to | |
# compress e. g. bookmark backups (*.jsonlz4). | |
# | |
# This file format is in fact just plain LZ4 data with a custom header (magic number [8 bytes] and | |
# uncompressed file size [4 bytes, little endian]). | |
# | |
# This Python 3 script requires the LZ4 bindings for Python, see: https://pypi.python.org/pypi/lz4 | |
# |
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
/** | |
* Custom logger that saves the logging. | |
* The console logging logic if from BrowserDomAdapter | |
* https://github.com/angular/angular/blob/master/modules/@angular/platform-browser/src/browser/browser_adapter.ts#L69 | |
*/ | |
class CustomLogger { | |
errorLog: any[] = []; | |
logError(error: any) { | |
this.errorLog.push(error); | |
if (window.console.error) { |