Skip to content

Commit def16a7

Browse files
committed
Flake8 all the things
Now that submodules are added to the flake8 target, fix the many errors it spots. Signed-off-by: David Gibson <[email protected]>
1 parent e5e4e9f commit def16a7

File tree

6 files changed

+18
-21
lines changed

6 files changed

+18
-21
lines changed

smadata2/db/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919

2020
from __future__ import print_function
2121

22-
from base import *
23-
from sqlite import *
22+
from .base import WrongSchema
23+
from .sqlite import SQLiteDatabase

smadata2/db/sqlite.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,25 @@
1919

2020
from __future__ import print_function
2121

22-
import os
2322
import shutil
2423
import re
2524
import sqlite3
25+
import time
26+
import datetime
2627

27-
from base import *
28+
from base import BaseDatabase, WrongSchema
2829

2930

3031
all = ['SQLiteDatabase']
3132

32-
_whitespace = re.compile('\s+')
33+
_whitespace = re.compile('\\s+')
3334

3435

3536
def squash_schema(sqls):
36-
l = []
37+
tmp = []
3738
for sql in sqls:
38-
l.append(_whitespace.sub(' ', sql.strip()))
39-
return frozenset(l)
39+
tmp.append(_whitespace.sub(' ', sql.strip()))
40+
return frozenset(tmp)
4041

4142

4243
def sqlite_schema(conn):

smadata2/db/tests.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
from __future__ import print_function
44

5-
import StringIO
65
import os
76
import os.path
87
import errno
98
import sqlite3
109

11-
from nose.tools import *
10+
from nose.tools import assert_equals, raises
1211

1312
import smadata2.db
1413
import smadata2.db.mock
@@ -199,7 +198,7 @@ def test_aggregate(self):
199198
#
200199
# Tests for sqlite schema updating
201200
#
202-
class UpdateSQLiteChecker(Test_SimpleChecks_SQLiteDBChecker):
201+
class UpdateSQLiteChecker(SQLiteDBChecker):
203202
PRESERVE_RECORD = ("PRESERVE", 0, 31415)
204203

205204
def test_backup(self):
@@ -291,4 +290,4 @@ def prepopulate(self):
291290

292291
@raises(smadata2.db.WrongSchema)
293292
def test_update(self):
294-
db = smadata2.db.sqlite.create_or_update(self.dbname)
293+
smadata2.db.sqlite.create_or_update(self.dbname)

smadata2/inverter/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@
1818
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1919

2020
from __future__ import print_function
21-
22-
from base import *

smadata2/inverter/mock.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ def daily_yield(self):
3333
return 0
3434

3535
def historic(self, fromtime, totime):
36-
l = []
36+
tmp = []
3737
for timestamp in range(fromtime, totime, 5*60):
38-
l.append((timestamp, 0))
39-
return l
38+
tmp.append((timestamp, 0))
39+
return tmp
4040

4141
def historic_daily(self, fromtime, totime):
42-
raise NotImplemented
42+
raise NotImplementedError

smadata2/inverter/smabluetooth.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
import time
2626

2727
import bluetooth
28-
import readline
2928

3029
import base
30+
from base import Error
3131
from smadata2.datetimeutil import format_time
3232

3333
__all__ = ['Connection',
@@ -420,7 +420,6 @@ def tx_historic_daily(self, fromtime, totime):
420420

421421
def wait(self, class_, cond=None):
422422
self.waitvar = None
423-
fn = getattr(self, 'rx_' + class_)
424423
setattr(self, '__waitcond_rx_' + class_, cond)
425424
while self.waitvar is None:
426425
self.rx()
@@ -546,7 +545,7 @@ def historic_daily(self, fromtime, totime):
546545
return points
547546

548547
def set_time(self, newtime, tzoffset):
549-
tag = self.tx_set_time(newtime, tzoffset)
548+
self.tx_set_time(newtime, tzoffset)
550549

551550

552551
def ptime(str):

0 commit comments

Comments
 (0)