flake8 fix

This commit is contained in:
INADA Naoki
2016-08-29 20:58:17 +09:00
parent f7226b5eff
commit c3ed301351
3 changed files with 9 additions and 1 deletions

View File

@@ -68,10 +68,12 @@ class NotSupportedError(DatabaseError):
error_map = {}
def _map_error(exc, *errors):
for error in errors:
error_map[error] = exc
_map_error(ProgrammingError, ER.DB_CREATE_EXISTS, ER.SYNTAX_ERROR,
ER.PARSE_ERROR, ER.NO_SUCH_TABLE, ER.WRONG_DB_NAME,
ER.WRONG_TABLE_NAME, ER.FIELD_SPECIFIED_TWICE,

View File

@@ -1,16 +1,20 @@
from time import localtime
from datetime import date, datetime, time, timedelta
Date = date
Time = time
TimeDelta = timedelta
Timestamp = datetime
def DateFromTicks(ticks):
return date(*localtime(ticks)[:3])
def TimeFromTicks(ticks):
return time(*localtime(ticks)[3:6])
def TimestampFromTicks(ticks):
return datetime(*localtime(ticks)[:6])

View File

@@ -1,14 +1,17 @@
import struct
def byte2int(b):
if isinstance(b, int):
return b
else:
return struct.unpack("!B", b)[0]
def int2byte(i):
return struct.pack("!B", i)
def join_bytes(bs):
if len(bs) == 0:
return ""
@@ -17,4 +20,3 @@ def join_bytes(bs):
for b in bs[1:]:
rv += b
return rv