Skip to content

Commit 281101f

Browse files
committed
Document list_device_names(), list_devices(), list_motors()
See #262
1 parent 994637a commit 281101f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/spec.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ Each class in ev3dev module inherits from the base :py:class:`Device` class.
55

66
.. autoclass:: ev3dev.core.Device
77

8+
.. autofunction:: ev3dev.core.list_device_names
9+
10+
.. autofunction:: ev3dev.core.list_devices
11+
12+
.. autofunction:: ev3dev.core.list_motors
13+
814
.. rubric:: Contents:
915

1016
.. toctree::

ev3dev/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@
6565

6666
# -----------------------------------------------------------------------------
6767
def list_device_names(class_path, name_pattern, **kwargs):
68-
69-
if not os.path.isdir(class_path):
70-
return
71-
7268
"""
7369
This is a generator function that lists names of all devices matching the
7470
provided parameters.
@@ -84,6 +80,10 @@ def list_device_names(class_path, name_pattern, **kwargs):
8480
is a list, then a match against any entry of the list is
8581
enough.
8682
"""
83+
84+
if not os.path.isdir(class_path):
85+
return
86+
8787
def matches(attribute, pattern):
8888
try:
8989
with io.FileIO(attribute) as f:

0 commit comments

Comments
 (0)