Skip to content

Commit

Permalink
flake8 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Aug 29, 2016
1 parent f7226b5 commit c3ed301
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pymysql/err.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions pymysql/times.py
Original file line number Diff line number Diff line change
@@ -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])
4 changes: 3 additions & 1 deletion pymysql/util.py
Original file line number Diff line number Diff line change
@@ -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 ""
Expand All @@ -17,4 +20,3 @@ def join_bytes(bs):
for b in bs[1:]:
rv += b
return rv

0 comments on commit c3ed301

Please sign in to comment.