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 __future__ import print_function | |
import queue | |
import threading | |
from contextlib import contextmanager | |
from collections import Counter | |
import time | |
import traceback | |
class Warn(object): | |
""" |
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
""" | |
Simple caching. | |
This module contains a `Cache` class that allows for simple caching that is invalidated by a timeout or an | |
exception while the user attempts to apply the value. | |
""" | |
import sqlite3 | |
import time | |
import threading |
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
import operator | |
class Vector(object): | |
def __init__(self, data, typ=None, copy=True): | |
self._type = typ | |
if isinstance(data, int): | |
self.data = [self._type() for _ in range(data)] | |
elif copy: | |
self.data = list(data) # copy the data | |
else: # This is (probably) a slice or copy is unnecessary for some other reason |
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
""" | |
This is a short library to help connecting to a MySQL database from the command line. | |
You'll need MySQLdb (or its fork, mysql-client) to use this. | |
""" | |
from getpass import getpass | |
try: | |
import MySQLdb | |
except ImportError as e: | |
print(e) |