Skip to content

Commit a832264

Browse files
committed
Add missing import and fix documentation of wrapped methods
1 parent 9612254 commit a832264

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

evdev/device.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import os
44
import fcntl
5-
6-
from select import select
7-
from collections import namedtuple
5+
import functools
6+
import select
7+
import collections
88

99
from evdev import _input, _uinput, ecodes, util
1010
from evdev.events import InputEvent
@@ -15,9 +15,14 @@ class EvdevError(Exception):
1515
pass
1616

1717
#--------------------------------------------------------------------------
18-
_AbsInfo = namedtuple('AbsInfo', ['value', 'min', 'max', 'fuzz', 'flat', 'resolution'])
19-
_KbdInfo = namedtuple('KbdInfo', ['repeat', 'delay'])
20-
_DeviceInfo = namedtuple('DeviceInfo', ['bustype', 'vendor', 'product', 'version'])
18+
_AbsInfo = collections.namedtuple(
19+
'AbsInfo', ['value', 'min', 'max', 'fuzz', 'flat', 'resolution'])
20+
21+
_KbdInfo = collections.namedtuple(
22+
'KbdInfo', ['repeat', 'delay'])
23+
24+
_DeviceInfo = collections.namedtuple(
25+
'DeviceInfo', ['bustype', 'vendor', 'product', 'version'])
2126

2227

2328
class AbsInfo(_AbsInfo):
@@ -219,6 +224,7 @@ def need_write(func):
219224
Decorator that raises :class:`EvdevError` if there is no write access to the
220225
input device.
221226
'''
227+
@functools.wraps(func)
222228
def wrapper(*args):
223229
fd = args[0].fd
224230
if fcntl.fcntl(fd, fcntl.F_GETFL) & os.O_RDWR:

evdev/uinput.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import stat
55
import time
6+
import select
67

78
from evdev import _input, _uinput
89
from evdev import ecodes, util, device
@@ -160,7 +161,7 @@ def read_loop(self):
160161
'''
161162

162163
while True:
163-
r, w, x = select([self.fd], [], [])
164+
r, w, x = select.select([self.fd], [], [])
164165
for event in self.read():
165166
yield event
166167

0 commit comments

Comments
 (0)