Skip to content

Commit fb9b63f

Browse files
committed
remove support for Python < 3.6 from can/interfaces/*/*
1 parent 71d9fa4 commit fb9b63f

10 files changed

Lines changed: 6 additions & 33 deletions

File tree

‎can/interfaces/ixxat/canlib.py‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
1414
"""
1515

16-
from __future__ import absolute_import, division
17-
1816
import ctypes
1917
import functools
2018
import logging
@@ -32,11 +30,7 @@
3230

3331
log = logging.getLogger('can.ixxat')
3432

35-
try:
36-
# since Python 3.3
37-
from time import perf_counter as _timer_function
38-
except ImportError:
39-
from time import clock as _timer_function
33+
from time import perf_counter as _timer_function
4034

4135
# Hack to have vciFormatError as a free function, see below
4236
vciFormatError = None

‎can/interfaces/kvaser/canlib.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
Copyright (C) 2010 Dynamic Controls
99
"""
1010

11-
from __future__ import absolute_import
12-
1311
import sys
1412
import time
1513
import logging

‎can/interfaces/pcan/pcan.py‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
Enable basic CAN over a PCAN USB device.
55
"""
66

7-
from __future__ import absolute_import, print_function, division
8-
97
import logging
108
import sys
119
import time
@@ -16,9 +14,8 @@
1614
from can.util import len2dlc, dlc2len
1715
from .basic import *
1816

19-
boottimeEpoch = 0
2017
try:
21-
import uptime
18+
import uptime # isn't this from a library?
2219
import datetime
2320
boottimeEpoch = (uptime.boottime() - datetime.datetime.utcfromtimestamp(0)).total_seconds()
2421
except:
@@ -39,13 +36,6 @@
3936
# Use polling instead
4037
HAS_EVENTS = False
4138

42-
try:
43-
# new in 3.3
44-
timeout_clock = time.perf_counter
45-
except AttributeError:
46-
# deprecated in 3.3
47-
timeout_clock = time.clock
48-
4939
# Set up logging
5040
log = logging.getLogger('can.pcan')
5141

@@ -277,7 +267,7 @@ def _recv_internal(self, timeout):
277267
timeout_ms = int(timeout * 1000) if timeout is not None else INFINITE
278268
elif timeout is not None:
279269
# Calculate max time
280-
end_time = timeout_clock() + timeout
270+
end_time = time.perf_counter() + timeout
281271

282272
#log.debug("Trying to read a msg")
283273

@@ -293,7 +283,7 @@ def _recv_internal(self, timeout):
293283
val = WaitForSingleObject(self._recv_event, timeout_ms)
294284
if val != WAIT_OBJECT_0:
295285
return None, False
296-
elif timeout is not None and timeout_clock() >= end_time:
286+
elif timeout is not None and time.perf_counter() >= end_time:
297287
return None, False
298288
else:
299289
result = None

‎can/interfaces/serial/serial_can.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
recording CAN traces.
88
"""
99

10-
from __future__ import absolute_import, division
11-
1210
import logging
1311
import struct
1412

‎can/interfaces/socketcan/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
See: https://www.kernel.org/doc/Documentation/networking/can.txt
55
"""
66

7-
from can.interfaces.socketcan.socketcan import SocketcanBus, CyclicSendTask, MultiRateCyclicSendTask
7+
from .socketcan import SocketcanBus, CyclicSendTask, MultiRateCyclicSendTask

‎can/interfaces/systec/ucanbus.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Ucan(UcanServer):
1616
"""
1717
Wrapper around UcanServer to read messages with timeout using events.
1818
"""
19+
1920
def __init__(self):
2021
super(Ucan, self).__init__()
2122
self._msg_received_event = Event()

‎can/interfaces/usb2can/__init__.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
"""
44
"""
55

6-
from __future__ import absolute_import
7-
86
from .usb2canInterface import Usb2canBus
97
from .usb2canabstractionlayer import Usb2CanAbstractionLayer

‎can/interfaces/usb2can/serial_selector.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
"""
44
"""
55

6-
from __future__ import division, print_function, absolute_import
7-
86
import logging
97

108
try:

‎can/interfaces/usb2can/usb2canInterface.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
This interface is for Windows only, otherwise use socketCAN.
55
"""
66

7-
from __future__ import division, print_function, absolute_import
8-
97
import logging
108
from ctypes import byref
119

‎can/interfaces/usb2can/usb2canabstractionlayer.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
Socket CAN is recommended under Unix/Linux systems.
66
"""
77

8-
from __future__ import division, print_function, absolute_import
9-
108
from ctypes import *
119
from struct import *
1210
import logging

0 commit comments

Comments
 (0)