Misc cleanups, fix some pylint issues

git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10642 ddd99763-3ecb-0310-9145-efcb8ce7c51f
This commit is contained in:
Jim Paris 2012-03-23 15:50:33 +00:00
parent 09340d543d
commit ec25eac697
6 changed files with 30 additions and 18 deletions

View File

@ -1,4 +1,9 @@
all:
all: test
lint:
pylint -f parseable nilmdb
test:
nosetests
profile:

View File

@ -1,5 +1,5 @@
from nilmdb import NilmDB, StreamError
from server import Server
from client import Client, ClientError, ServerError
from layout import *
from serializer import WrapObject
"""Main NilmDB import"""
from .nilmdb import NilmDB, StreamError
from .server import Server
from .client import Client, ClientError, ServerError

View File

@ -11,12 +11,8 @@ import os
import json
import urlparse
import urllib
import urllib2
from urllib2 import urlopen, HTTPError
import pycurl
import cStringIO
import re
import collections
class NilmCommError(Exception):
"""Base exception for both ClientError and ServerError responses"""

View File

@ -1,7 +1,9 @@
"""printf, fprintf, sprintf"""
from __future__ import print_function
def printf(str, *args):
print(str % args, end='')
def fprintf(file, str, *args):
print(str % args, end='', file=file)
def sprintf(str, *args):
return (str % args)
def printf(_str, *args):
print(_str % args, end='')
def fprintf(_file, _str, *args):
print(_str % args, end='', file=_file)
def sprintf(_str, *args):
return (_str % args)

View File

@ -11,7 +11,6 @@ import cherrypy
import sys
import os
import json
import traceback
try:
import cherrypy
@ -173,7 +172,8 @@ class Server(object):
def __init__(self, db, host = '127.0.0.1', port = 8080,
stoppable = False, embedded = True,
fast_shutdown = False):
# Need to wrap DB object in a serializer because we'll call into it from separate threads.
# Need to wrap DB object in a serializer because we'll call
# into it from separate threads.
self.embedded = embedded
self.db = nilmdb.serializer.WrapObject(db)
cherrypy.config.update({

View File

@ -123,6 +123,15 @@ class TestClient(object):
client.stream_update_metadata("/newton/prep", [1,2,3])
def test_client_insert(self):
client = nilmdb.Client(url = "http://localhost:12380/")
# with open("data/prep-20120323T1000") as prepdata:
# client.stream_insert("/newton/prep", prepdata) # dunno
# ret = client.stream_insert
# TODO: Just start writing the client side of this as if it works.
# Then fill things in to make it so!
pass