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:
parent
09340d543d
commit
ec25eac697
7
Makefile
7
Makefile
|
@ -1,4 +1,9 @@
|
|||
all:
|
||||
all: test
|
||||
|
||||
lint:
|
||||
pylint -f parseable nilmdb
|
||||
|
||||
test:
|
||||
nosetests
|
||||
|
||||
profile:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"""
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user