Skip to content

Commit 8fe1b5a

Browse files
committed
general cleanups of the main modules
1 parent 1cb8ebc commit 8fe1b5a

12 files changed

Lines changed: 68 additions & 13 deletions

File tree

can/CAN.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
14
"""
25
This module was once the core of python-can, containing
36
implementations of all the major classes in the library, now
4-
however all functionality has been refactored out. This api
7+
however all functionality has been refactored out. This API
58
is left intact for version 2.0 to aide with migration.
69
"""
10+
711
from __future__ import absolute_import
812

913
from can.message import Message

can/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
14
"""
25
can is an object-orient Controller Area Network interface module.
36
"""
7+
48
from __future__ import absolute_import
59

610
import logging

can/broadcastmanager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
24
"""
35
Exposes several methods for transmitting cyclic messages.
4-
20/09/13
56
"""
67

78
import can

can/bus.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
# -*- coding: utf-8 -*-
1+
#!/usr/bin/env python
2+
# coding: utf-8
23

34
"""
45
Contains the ABC bus implementation.
56
"""
67

78
from __future__ import print_function, absolute_import
9+
810
import abc
911
import logging
1012
import threading
11-
from can.broadcastmanager import ThreadBasedCyclicSendTask
1213

14+
from can.broadcastmanager import ThreadBasedCyclicSendTask
1315

1416
logger = logging.getLogger(__name__)
1517

can/ctypesutil.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# -*- coding: utf-8 -*-
1+
#!/usr/bin/env python
2+
# coding: utf-8
23

3-
" Common ctypes utils "
4+
"""
5+
This module contains common `ctypes` utils.
6+
"""
47

58
import binascii
69
import ctypes
@@ -11,6 +14,11 @@
1114

1215
__all__ = ['CLibrary', 'HANDLE', 'PHANDLE']
1316

17+
try:
18+
_LibBase = ctypes.WinDLL
19+
except AttributeError:
20+
_LibBase = ctypes.CDLL
21+
1422

1523
class LibraryMixin:
1624
def map_symbol(self, func_name, restype=None, argtypes=(), errcheck=None):
@@ -46,11 +54,6 @@ def map_symbol(self, func_name, restype=None, argtypes=(), errcheck=None):
4654
return symbol
4755

4856

49-
try:
50-
_LibBase = ctypes.WinDLL
51-
except AttributeError:
52-
_LibBase = ctypes.CDLL
53-
5457
class CLibrary_Win32(_LibBase, LibraryMixin):
5558
" Basic ctypes.WinDLL derived class + LibraryMixin "
5659

can/interface.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
4+
"""
5+
This module contains the base implementation of `can.Bus` as well
6+
as a list of all avalibale backends and some implemented
7+
CyclicSendTasks.
8+
"""
9+
110
from __future__ import absolute_import
211

312
import can

can/listener.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
4+
"""
5+
This module contains the implementation of `can.Listener` and some readers.
6+
"""
7+
18
try:
9+
# Python 3
210
import queue
311
except ImportError:
12+
# Python 2
413
import Queue as queue
514

615

can/logger.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env python
2+
# coding: utf-8
3+
24
"""
35
logger.py logs CAN traffic to the terminal and to a file on disk.
46
@@ -14,7 +16,9 @@
1416
1517
Dynamic Controls 2010
1618
"""
19+
1720
from __future__ import print_function
21+
1822
import datetime
1923
import argparse
2024
import socket

can/message.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
4+
"""
5+
This module contains the implementation of `can.Message`.
6+
"""
7+
18
import logging
29
logger = logging.getLogger(__name__)
310

can/notifier.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#!/usr/bin/env python
2+
# coding: utf-8
3+
4+
"""
5+
This module contains the implementation of `can.Notifier`.
6+
"""
7+
18
import threading
29
import logging
310

0 commit comments

Comments
 (0)