Skip to content

Commit a4e59d6

Browse files
authored
Remove Python2 compatibility (julien-duponchelle#480)
1 parent 942a0b5 commit a4e59d6

24 files changed

+6
-74
lines changed

docs/conf.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# Python MySQL Replication documentation build configuration file, created by
42
# sphinx-quickstart on Sun Sep 30 15:04:27 2012.
53
#

examples/dump_events.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32

43
#
54
# Dump all replication events from a remote mysql server

examples/logstash/mysql_to_logstash.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32

43
#
54
# Output logstash events to the console from MySQL replication stream

examples/redis_cache.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32

43
#
54
# Update a redis server cache when an evenement is trigger

pymysqlreplication/_compat.py

-1
This file was deleted.

pymysqlreplication/binlogstream.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import struct
42
import logging
53
from distutils.version import LooseVersion

pymysqlreplication/bitmap.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
bitCountInByte = [
42
0,
53
1,

pymysqlreplication/column.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import struct
42

53
from .constants import FIELD_TYPE

pymysqlreplication/constants/BINLOG.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
UNKNOWN_EVENT = 0x00
42
START_EVENT_V3 = 0x01
53
QUERY_EVENT = 0x02

pymysqlreplication/constants/FIELD_TYPE.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
# Original code from PyMySQL
42
# Copyright (c) 2010 PyMySQL contributors
53
#
-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
from .BINLOG import *
42
from .FIELD_TYPE import *
53
from .STATUS_VAR_KEY import *

pymysqlreplication/event.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import binascii
42
import struct
53
import datetime

pymysqlreplication/gtid.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import re
42
import struct
53
import binascii

pymysqlreplication/packet.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import struct
42

53
from pymysqlreplication import constants, event, row_event

pymysqlreplication/row_event.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
31
import struct
42
import decimal
53
import datetime

pymysqlreplication/table.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
3-
41
class Table(object):
52
def __init__(
63
self, table_id, schema, table, columns, primary_key=None, column_name_flag=False

pymysqlreplication/tests/__init__.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
# -*- coding: utf-8 -*-
2-
31
from pymysqlreplication.tests.test_basic import *
42
from pymysqlreplication.tests.test_data_type import *
53
from pymysqlreplication.tests.test_data_objects import *
4+
import unittest
65

76
if __name__ == "__main__":
8-
if sys.version_info < (2, 7):
9-
import unittest2 as unittest
10-
else:
11-
import unittest
127
unittest.main()

pymysqlreplication/tests/base.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
# -*- coding: utf-8 -*-
2-
31
import pymysql
42
import copy
53
from pymysqlreplication import BinLogStreamReader
64
import os
7-
import sys
8-
9-
if sys.version_info < (2, 7):
10-
import unittest2 as unittest
11-
else:
12-
import unittest
5+
import unittest
136

147
base = unittest.TestCase
158

pymysqlreplication/tests/benchmark.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# This is a sample script in order to make benchmark
42
# on library speed.
53
#

pymysqlreplication/tests/test_abnormal.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""Test abnormal conditions, such as caused by a MySQL crash
32
"""
43
import os.path

pymysqlreplication/tests/test_basic.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
# -*- coding: utf-8 -*-
21
import copy
32
import io
43
import os
5-
import sys
64
import time
7-
85
import pymysql
9-
10-
if sys.version_info < (2, 7):
11-
import unittest2 as unittest
12-
else:
13-
import unittest
6+
import unittest
147

158
from pymysqlreplication.tests import base
169
from pymysqlreplication import BinLogStreamReader

pymysqlreplication/tests/test_data_objects.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import sys
2-
3-
if sys.version_info < (2, 7):
4-
import unittest2 as unittest
5-
else:
6-
import unittest
7-
1+
import unittest
82
from pymysqlreplication.column import Column
93
from pymysqlreplication.table import Table
104
from pymysqlreplication.event import GtidEvent

pymysqlreplication/tests/test_data_type.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
1-
# -*- coding: utf-8 -*-
2-
31
import copy
42
import platform
5-
import sys
63
import json
7-
84
from pymysqlreplication import BinLogStreamReader
9-
10-
if sys.version_info < (2, 7):
11-
import unittest2 as unittest
12-
else:
13-
import unittest
5+
import unittest
146

157
from decimal import Decimal
168

179
from pymysqlreplication.tests import base
1810
from pymysqlreplication.constants.BINLOG import *
1911
from pymysqlreplication.row_event import *
2012
from pymysqlreplication.event import *
21-
from pymysqlreplication._compat import text_type
22-
2313

2414
__all__ = ["TestDataType", "TestDataTypeVersion8"]
2515

2616

2717
def to_binary_dict(d):
2818
def encode_value(v):
29-
if isinstance(v, text_type):
19+
if isinstance(v, str):
3020
return v.encode()
3121
if isinstance(v, list):
3222
return [encode_value(x) for x in v]

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32

43
try:
54
from setuptools import setup, Command

0 commit comments

Comments
 (0)