| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,12 @@ | |||
| 1 | 1 | # vim: sw=2 ts=2 sts=2 expandtab | |
| 2 | 2 | ||
| 3 | - sudo: required | ||
| 3 | + dist: xenial | ||
| 4 | 4 | language: python | |
| 5 | + cache: pip | ||
| 6 | + | ||
| 5 | 7 | services: | |
| 6 | 8 | - docker | |
| 7 | 9 | ||
| 8 | - cache: pip | ||
| 9 | - | ||
| 10 | 10 | matrix: | |
| 11 | 11 | include: | |
| 12 | 12 | - env: | |
@@ -17,7 +17,7 @@ matrix: | |||
| 17 | 17 | python: "3.6" | |
| 18 | 18 | - env: | |
| 19 | 19 | - DB=mariadb:10.1 | |
| 20 | - python: "pypy" | ||
| 20 | + python: "pypy3.5" | ||
| 21 | 21 | - env: | |
| 22 | 22 | - DB=mariadb:10.2 | |
| 23 | 23 | python: "2.7" | |
@@ -32,7 +32,7 @@ matrix: | |||
| 32 | 32 | python: "3.6" | |
| 33 | 33 | - env: | |
| 34 | 34 | - DB=mysql:5.7 | |
| 35 | - python: "3.4" | ||
| 35 | + python: "3.7" | ||
| 36 | 36 | - env: | |
| 37 | 37 | - DB=mysql:8.0 | |
| 38 | 38 | - TEST_AUTH=yes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ Requirements | |||
| 38 | 38 | ||
| 39 | 39 | * Python -- one of the following: | |
| 40 | 40 | ||
| 41 | - - CPython_ : 2.7 and >= 3.4 | ||
| 41 | + - CPython_ : 2.7 and >= 3.5 | ||
| 42 | 42 | - PyPy_ : Latest version | |
| 43 | 43 | ||
| 44 | 44 | * MySQL Server -- one of the following: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,7 +18,7 @@ Requirements | |||
| 18 | 18 | ||
| 19 | 19 | * Python -- one of the following: | |
| 20 | 20 | ||
| 21 | - - CPython_ >= 2.7 or >= 3.4 | ||
| 21 | + - CPython_ >= 2.7 or >= 3.5 | ||
| 22 | 22 | - Latest PyPy_ | |
| 23 | 23 | ||
| 24 | 24 | * MySQL Server -- one of the following: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -301,46 +301,6 @@ def convert_date(obj): | |||
| 301 | 301 | return obj | |
| 302 | 302 | ||
| 303 | 303 | ||
| 304 | - def convert_mysql_timestamp(timestamp): | ||
| 305 | - """Convert a MySQL TIMESTAMP to a Timestamp object. | ||
| 306 | - | ||
| 307 | - MySQL >= 4.1 returns TIMESTAMP in the same format as DATETIME: | ||
| 308 | - | ||
| 309 | - >>> mysql_timestamp_converter('2007-02-25 22:32:17') | ||
| 310 | - datetime.datetime(2007, 2, 25, 22, 32, 17) | ||
| 311 | - | ||
| 312 | - MySQL < 4.1 uses a big string of numbers: | ||
| 313 | - | ||
| 314 | - >>> mysql_timestamp_converter('20070225223217') | ||
| 315 | - datetime.datetime(2007, 2, 25, 22, 32, 17) | ||
| 316 | - | ||
| 317 | - Illegal values are returned as None: | ||
| 318 | - | ||
| 319 | - >>> mysql_timestamp_converter('2007-02-31 22:32:17') is None | ||
| 320 | - True | ||
| 321 | - >>> mysql_timestamp_converter('00000000000000') is None | ||
| 322 | - True | ||
| 323 | - | ||
| 324 | - """ | ||
| 325 | - if not PY2 and isinstance(timestamp, (bytes, bytearray)): | ||
| 326 | - timestamp = timestamp.decode('ascii') | ||
| 327 | - if timestamp[4] == '-': | ||
| 328 | - return convert_datetime(timestamp) | ||
| 329 | - timestamp += "0"*(14-len(timestamp)) # padding | ||
| 330 | - year, month, day, hour, minute, second = \ | ||
| 331 | - int(timestamp[:4]), int(timestamp[4:6]), int(timestamp[6:8]), \ | ||
| 332 | - int(timestamp[8:10]), int(timestamp[10:12]), int(timestamp[12:14]) | ||
| 333 | - try: | ||
| 334 | - return datetime.datetime(year, month, day, hour, minute, second) | ||
| 335 | - except ValueError: | ||
| 336 | - return timestamp | ||
| 337 | - | ||
| 338 | - def convert_set(s): | ||
| 339 | - if isinstance(s, (bytes, bytearray)): | ||
| 340 | - return set(s.split(b",")) | ||
| 341 | - return set(s.split(",")) | ||
| 342 | - | ||
| 343 | - | ||
| 344 | 304 | def through(x): | |
| 345 | 305 | return x | |
| 346 | 306 | ||
@@ -388,11 +348,10 @@ def through(x): | |||
| 388 | 348 | FIELD_TYPE.LONGLONG: int, | |
| 389 | 349 | FIELD_TYPE.INT24: int, | |
| 390 | 350 | FIELD_TYPE.YEAR: int, | |
| 391 | - FIELD_TYPE.TIMESTAMP: convert_mysql_timestamp, | ||
| 351 | + FIELD_TYPE.TIMESTAMP: convert_datetime, | ||
| 392 | 352 | FIELD_TYPE.DATETIME: convert_datetime, | |
| 393 | 353 | FIELD_TYPE.TIME: convert_timedelta, | |
| 394 | 354 | FIELD_TYPE.DATE: convert_date, | |
| 395 | - FIELD_TYPE.SET: convert_set, | ||
| 396 | 355 | FIELD_TYPE.BLOB: through, | |
| 397 | 356 | FIELD_TYPE.TINY_BLOB: through, | |
| 398 | 357 | FIELD_TYPE.MEDIUM_BLOB: through, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,11 +99,6 @@ def _map_error(exc, *errors): | |||
| 99 | 99 | ||
| 100 | 100 | def raise_mysql_exception(data): | |
| 101 | 101 | errno = struct.unpack('<h', data[1:3])[0] | |
| 102 | - is_41 = data[3:4] == b"#" | ||
| 103 | - if is_41: | ||
| 104 | - # client protocol 4.1 | ||
| 105 | - errval = data[9:].decode('utf-8', 'replace') | ||
| 106 | - else: | ||
| 107 | - errval = data[3:].decode('utf-8', 'replace') | ||
| 102 | + errval = data[9:].decode('utf-8', 'replace') | ||
| 108 | 103 | errorclass = error_map.get(errno, InternalError) | |
| 109 | 104 | raise errorclass(errno, errval) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,12 +9,6 @@ | |||
| 9 | 9 | class TestRaiseException(unittest2.TestCase): | |
| 10 | 10 | ||
| 11 | 11 | def test_raise_mysql_exception(self): | |
| 12 | - data = b"\xff\x15\x04Access denied" | ||
| 13 | - with self.assertRaises(err.OperationalError) as cm: | ||
| 14 | - err.raise_mysql_exception(data) | ||
| 15 | - self.assertEqual(cm.exception.args, (1045, 'Access denied')) | ||
| 16 | - | ||
| 17 | - def test_raise_mysql_exception_client_protocol_41(self): | ||
| 18 | 12 | data = b"\xff\x15\x04#28000Access denied" | |
| 19 | 13 | with self.assertRaises(err.OperationalError) as cm: | |
| 20 | 14 | err.raise_mysql_exception(data) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,7 +25,6 @@ | |||
| 25 | 25 | 'Programming Language :: Python :: 2', | |
| 26 | 26 | 'Programming Language :: Python :: 2.7', | |
| 27 | 27 | 'Programming Language :: Python :: 3', | |
| 28 | - 'Programming Language :: Python :: 3.4', | ||
| 29 | 28 | 'Programming Language :: Python :: 3.5', | |
| 30 | 29 | 'Programming Language :: Python :: 3.6', | |
| 31 | 30 | 'Programming Language :: Python :: 3.7', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments