Skip to content

Commit 7ba6a49

Browse files
author
fbeitler
committed
Remove Python2 checks
Remove Python2 code snippets
1 parent c5772b3 commit 7ba6a49

File tree

116 files changed

+714
-1000
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+714
-1000
lines changed

doc/api/doxygen/build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
'''
33
Doxygen API Builder
44
---------------------
@@ -29,8 +29,8 @@ def which(program):
2929
return None
3030

3131
if which('doxygen') is not None:
32-
print "Building Doxygen API Documentation"
32+
print("Building Doxygen API Documentation")
3333
os.system("doxygen .doxygen")
3434
if os.path.exists('../../../build'):
3535
shutil.move("html", "../../../build/doxygen")
36-
else: print "Doxygen not available...not building"
36+
else: print("Doxygen not available...not building")

doc/api/epydoc/build.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
'''
33
Epydoc API Runner
44
------------------
@@ -27,12 +27,12 @@
2727
if not os.path.exists("./html"):
2828
os.mkdir("./html")
2929

30-
print "Building Epydoc API Documentation"
30+
print( "Building Epydoc API Documentation")
3131
cli()
3232

3333
if os.path.exists('../../../build'):
3434
shutil.move("html", "../../../build/epydoc")
35-
except Exception, ex:
35+
except Exception as ex:
3636
import traceback,sys
3737
traceback.print_exc(file=sys.stdout)
38-
print "Epydoc not avaliable...not building"
38+
print( "Epydoc not avaliable...not building")

doc/api/pydoc/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Pydoc sub-class for generating documentation for entire packages.
44
@@ -447,7 +447,7 @@ def recurseScan(self, objectList):
447447
if not os.path.exists("./html"):
448448
os.mkdir("./html")
449449

450-
print "Building Pydoc API Documentation"
450+
print( "Building Pydoc API Documentation")
451451
PackageDocumentationGenerator(
452452
baseModules = ['pymodbus', '__builtin__'],
453453
destinationDirectory = "./html/",

doc/api/pydoctor/build.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
'''
33
Pydoctor API Runner
44
---------------------
@@ -19,9 +19,10 @@
1919
--html-output=html
2020
--html-write-function-pages --make-html'''.split()
2121

22-
print "Building Pydoctor API Documentation"
22+
print( "Building Pydoctor API Documentation")
2323
main(sys.argv[1:])
2424

2525
if os.path.exists('../../../build'):
2626
shutil.move("html", "../../../build/pydoctor")
27-
except: print "Pydoctor unavailable...not building"
27+
except:
28+
print( "Pydoctor unavailable...not building")

examples/common/async_asyncio_client.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Pymodbus Asynchronous Client Examples
44
--------------------------------------------------------------------------
@@ -8,22 +8,16 @@
88
99
The example is only valid on Python3.4 and above
1010
"""
11-
from pymodbus.compat import IS_PYTHON3, PYTHON_VERSION
12-
if IS_PYTHON3 and PYTHON_VERSION >= (3, 4):
13-
import asyncio
14-
import logging
15-
# ----------------------------------------------------------------------- #
16-
# Import the required asynchronous client
17-
# ----------------------------------------------------------------------- #
18-
from pymodbus.client.asynchronous.tcp import AsyncModbusTCPClient as ModbusClient
19-
# from pymodbus.client.asynchronous.udp import (
20-
# AsyncModbusUDPClient as ModbusClient)
21-
from pymodbus.client.asynchronous import schedulers
22-
23-
else:
24-
import sys
25-
sys.stderr("This example needs to be run only on python 3.4 and above")
26-
sys.exit(1)
11+
import asyncio
12+
import logging
13+
# ----------------------------------------------------------------------- #
14+
# Import the required asynchronous client
15+
# ----------------------------------------------------------------------- #
16+
from pymodbus.client.asynchronous.tcp import AsyncModbusTCPClient as ModbusClient
17+
# from pymodbus.client.asynchronous.udp import (
18+
# AsyncModbusUDPClient as ModbusClient)
19+
from pymodbus.client.asynchronous import schedulers
20+
2721

2822
from threading import Thread
2923
import time

examples/common/async_asyncio_serial_client.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Pymodbus Asynchronous Client Examples
44
--------------------------------------------------------------------------
@@ -8,17 +8,12 @@
88
99
The example is only valid on Python3.4 and above
1010
"""
11-
from pymodbus.compat import IS_PYTHON3, PYTHON_VERSION
12-
if IS_PYTHON3 and PYTHON_VERSION >= (3, 4):
13-
import logging
14-
import asyncio
15-
from pymodbus.client.asynchronous.serial import (
16-
AsyncModbusSerialClient as ModbusClient)
17-
from pymodbus.client.asynchronous import schedulers
18-
else:
19-
import sys
20-
sys.stderr("This example needs to be run only on python 3.4 and above")
21-
sys.exit(1)
11+
import logging
12+
import asyncio
13+
from pymodbus.client.asynchronous.serial import (
14+
AsyncModbusSerialClient as ModbusClient)
15+
from pymodbus.client.asynchronous import schedulers
16+
2217

2318
# --------------------------------------------------------------------------- #
2419
# configure the client logging

examples/common/async_tornado_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Pymodbus Asynchronous Client Examples
44
--------------------------------------------------------------------------

examples/common/async_tornado_client_serial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Pymodbus Asynchronous Client Examples
44
--------------------------------------------------------------------------

examples/common/async_twisted_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Pymodbus Asynchronous Client Examples
44
--------------------------------------------------------------------------

examples/common/async_twisted_client_serial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
Pymodbus Asynchronous Client Examples
44
--------------------------------------------------------------------------

0 commit comments

Comments
 (0)