From c3ed30135117a13d5e52087d67249a252317c30a Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Mon, 29 Aug 2016 20:58:17 +0900 Subject: [PATCH] flake8 fix --- pymysql/err.py | 2 ++ pymysql/times.py | 4 ++++ pymysql/util.py | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pymysql/err.py b/pymysql/err.py index 9b6f24e..d6bb0f6 100644 --- a/pymysql/err.py +++ b/pymysql/err.py @@ -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, diff --git a/pymysql/times.py b/pymysql/times.py index c47db09..4497dac 100644 --- a/pymysql/times.py +++ b/pymysql/times.py @@ -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]) diff --git a/pymysql/util.py b/pymysql/util.py index f03f080..3e82ac7 100644 --- a/pymysql/util.py +++ b/pymysql/util.py @@ -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 -