Browse Source

Misc cleanups, fix some pylint issues

git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10642 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/bxinterval-last
Jim Paris 12 years ago
parent
commit
ec25eac697
6 changed files with 30 additions and 18 deletions
  1. +6
    -1
      Makefile
  2. +5
    -5
      nilmdb/__init__.py
  3. +0
    -4
      nilmdb/client.py
  4. +8
    -6
      nilmdb/printf.py
  5. +2
    -2
      nilmdb/server.py
  6. +9
    -0
      tests/test_client.py

+ 6
- 1
Makefile View File

@@ -1,4 +1,9 @@
all:
all: test

lint:
pylint -f parseable nilmdb

test:
nosetests

profile:


+ 5
- 5
nilmdb/__init__.py 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

+ 0
- 4
nilmdb/client.py 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"""


+ 8
- 6
nilmdb/printf.py 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)

+ 2
- 2
nilmdb/server.py 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({


+ 9
- 0
tests/test_client.py 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

Loading…
Cancel
Save