Skip to content

Instantly share code, notes, and snippets.

View multiprocessing_terminator.py
import multiprocessing
import time
class ChildThread(multiprocessing.Process):
def __init__(self, stopper, counter, **kwargs):
super().__init__(**kwargs)
self.stopper = stopper
self.counter = counter
def run(self):
View sql_alchemy_demo.py
import sqlalchemy as sa
from sqlalchemy.orm import create_session
engine = sa.create_engine('postgresql://localhost:5432/dedupeapi')
db_session = create_session(bind=engine,
autocommit=False,
autoflush=False)
@evz
evz / lead_tests.py
Created Jul 5, 2016
Download and extract data about CPS lead tests
View lead_tests.py
import subprocess
import sys
from io import StringIO
import csv
if __name__ == "__main__":
proc = subprocess.Popen(['java',
'-jar',
'../tabula-java/target/tabula-0.9.0-jar-with-dependencies.jar',
View ralston_training.json
{
"distinct": [
[
{
"payer_address": "950 f. street nw, suite 300, washington, dc, 20004",
"payer_name": "pharmaceutical research & manufacturers of america (phrma)",
"record_id": 500
},
{
"payer_address": "950 e paces ferry rd ne, ste 2450, atlanta, ga, 30326",
@evz
evz / load_data.py
Created Mar 10, 2016
Faster loader for open ee meter datastore
View load_data.py
import csv
import sqlalchemy as sa
import os
import pytz
from datetime import datetime
import itertools
tz = pytz.timezone('America/Chicago')
# DB_CONN = os.environ['DATABASE_URL']
@evz
evz / trees.py
Created Feb 9, 2016
Edgelist to Tree
View trees.py
if __name__ == "__main__":
import pprint
import copy
engine = init_engine(DB_CONN)
children = [(1,2),(1,3),(2,4)]
edgelist = engine.execute(children)
View matching_traceback.txt
INFO:dedupe.api:reading training from file
^CTraceback (most recent call last):
File "run_queue.py", line 2, in <module>
queue_daemon()
File "/home/eric/code/dedupe-api/api/queue.py", line 144, in queue_daemon
processMessage()
File "/home/eric/code/dedupe-api/api/queue.py", line 88, in processMessage
upd_args['return_value'] = func(*args, **kwargs)
File "/home/eric/code/dedupe-api/api/tasks/review_tasks.py", line 35, in bulkMarkClusters
initializeMatching(session_id)
@evz
evz / nyc_loaddata_traceback.txt
Created Oct 8, 2015
NYC loaddata 2015-10-08
View nyc_loaddata_traceback.txt
Traceback (most recent call last):
File "/home/datamade/.virtualenvs/nyc/lib/python3.4/site-packages/django/db/models/query.py", line 405, in get_or_create
return self.get(**lookup), False
File "/home/datamade/.virtualenvs/nyc/lib/python3.4/site-packages/django/db/models/query.py", line 334, in get
self.model._meta.object_name
core.models.DoesNotExist: Event matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
View ynr_traceback.txt
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8001/election/council-member-2015/post/ocd-division,country:us,state:mn,place:st_paul,ward:1/council-member-for-ward-1
Django Version: 1.8.3
Python Version: 2.7.9
Installed Applications:
('django.contrib.admin',
@evz
evz / appveyor.log
Created Oct 1, 2015
Just in case the appveyor log is not persistent ...
View appveyor.log
[00:00:00] Build started
[00:00:02] git clone -q https://github.com/datamade/dedupe.git C:\projects\dedupe
[00:00:05] git fetch -q origin +refs/pull/416/merge:
[00:00:06] git checkout -qf FETCH_HEAD
[00:00:06] Running Install scripts
[00:00:06] SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
[00:00:06] powershell .\\appveyor\\install.ps1
[00:00:07] Installing Python
[00:00:07] 2.7 for
[00:00:07]
You can’t perform that action at this time.