File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,14 @@ Changelog
5
5
Unreleased
6
6
====================
7
7
8
- - Support path protocol in ``InputDevice ``.
8
+ - ``InputDevice `` now accepts objects that support the path protocol. For
9
+ example::
10
+
11
+ pth = pathlib.Path('/dev/input/event0')
12
+ dev = evdev.InputDevice(pth)
13
+
14
+ - Support path protocol in ``InputDevice ``. This means that ``InputDevice ``
15
+ instances can be passed to callers that expect a ``os.PathLike `` object.
9
16
10
17
- Exceptions raised during ``InputDevice.async_read() `` (and similar) are now
11
18
handled properly (i.e. an exception is set on the returned future instead of
Original file line number Diff line number Diff line change @@ -114,12 +114,12 @@ def __init__(self, dev):
114
114
'''
115
115
Arguments
116
116
---------
117
- dev : str
117
+ dev : str|bytes|PathLike
118
118
Path to input device
119
119
'''
120
120
121
121
#: Path to input device.
122
- self .fn = dev
122
+ self .fn = dev if not hasattr ( dev , '__fspath__' ) else dev . __fspath__ ()
123
123
124
124
# Certain operations are possible only when the device is opened in
125
125
# read-write mode.
You can’t perform that action at this time.
0 commit comments