flake8 fix
This commit is contained in:
@@ -68,10 +68,12 @@ class NotSupportedError(DatabaseError):
|
|||||||
|
|
||||||
error_map = {}
|
error_map = {}
|
||||||
|
|
||||||
|
|
||||||
def _map_error(exc, *errors):
|
def _map_error(exc, *errors):
|
||||||
for error in errors:
|
for error in errors:
|
||||||
error_map[error] = exc
|
error_map[error] = exc
|
||||||
|
|
||||||
|
|
||||||
_map_error(ProgrammingError, ER.DB_CREATE_EXISTS, ER.SYNTAX_ERROR,
|
_map_error(ProgrammingError, ER.DB_CREATE_EXISTS, ER.SYNTAX_ERROR,
|
||||||
ER.PARSE_ERROR, ER.NO_SUCH_TABLE, ER.WRONG_DB_NAME,
|
ER.PARSE_ERROR, ER.NO_SUCH_TABLE, ER.WRONG_DB_NAME,
|
||||||
ER.WRONG_TABLE_NAME, ER.FIELD_SPECIFIED_TWICE,
|
ER.WRONG_TABLE_NAME, ER.FIELD_SPECIFIED_TWICE,
|
||||||
|
|||||||
@@ -1,16 +1,20 @@
|
|||||||
from time import localtime
|
from time import localtime
|
||||||
from datetime import date, datetime, time, timedelta
|
from datetime import date, datetime, time, timedelta
|
||||||
|
|
||||||
|
|
||||||
Date = date
|
Date = date
|
||||||
Time = time
|
Time = time
|
||||||
TimeDelta = timedelta
|
TimeDelta = timedelta
|
||||||
Timestamp = datetime
|
Timestamp = datetime
|
||||||
|
|
||||||
|
|
||||||
def DateFromTicks(ticks):
|
def DateFromTicks(ticks):
|
||||||
return date(*localtime(ticks)[:3])
|
return date(*localtime(ticks)[:3])
|
||||||
|
|
||||||
|
|
||||||
def TimeFromTicks(ticks):
|
def TimeFromTicks(ticks):
|
||||||
return time(*localtime(ticks)[3:6])
|
return time(*localtime(ticks)[3:6])
|
||||||
|
|
||||||
|
|
||||||
def TimestampFromTicks(ticks):
|
def TimestampFromTicks(ticks):
|
||||||
return datetime(*localtime(ticks)[:6])
|
return datetime(*localtime(ticks)[:6])
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
|
||||||
def byte2int(b):
|
def byte2int(b):
|
||||||
if isinstance(b, int):
|
if isinstance(b, int):
|
||||||
return b
|
return b
|
||||||
else:
|
else:
|
||||||
return struct.unpack("!B", b)[0]
|
return struct.unpack("!B", b)[0]
|
||||||
|
|
||||||
|
|
||||||
def int2byte(i):
|
def int2byte(i):
|
||||||
return struct.pack("!B", i)
|
return struct.pack("!B", i)
|
||||||
|
|
||||||
|
|
||||||
def join_bytes(bs):
|
def join_bytes(bs):
|
||||||
if len(bs) == 0:
|
if len(bs) == 0:
|
||||||
return ""
|
return ""
|
||||||
@@ -17,4 +20,3 @@ def join_bytes(bs):
|
|||||||
for b in bs[1:]:
|
for b in bs[1:]:
|
||||||
rv += b
|
rv += b
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user