diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-11-02 23:06:53 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-02 23:06:53 -0600 |
commit | b2c82a7f2f7c8ae426a9208fb79c5abbd5e3181c (patch) | |
tree | ac1e06a266407febfc9c4f108fe79955648d7171 /hwdb | |
parent | b23f2b72bfad53e4420ac661d1771801fc2003f3 (diff) | |
parent | 1258f088981ac62efd846de91922eef033302e76 (diff) |
Merge pull request #4547 from keszybz/two-testsuite-tweaks
Two testsuite tweaks
Diffstat (limited to 'hwdb')
-rwxr-xr-x | hwdb/parse_hwdb.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/hwdb/parse_hwdb.py b/hwdb/parse_hwdb.py index 2540c8c2f6..5d4c5ea64d 100755 --- a/hwdb/parse_hwdb.py +++ b/hwdb/parse_hwdb.py @@ -49,6 +49,12 @@ except ImportError: ecodes = None print('WARNING: evdev is not available') +try: + from functools import lru_cache +except ImportError: + # don't do caching on old python + lru_cache = lambda: (lambda f: f) + EOL = LineEnd().suppress() EMPTYLINE = LineStart() + LineEnd() COMMENTLINE = pythonStyleComment + EOL @@ -62,7 +68,7 @@ TYPES = {'mouse': ('usb', 'bluetooth', 'ps2', '*'), 'keyboard': ('name', ), } -@functools.lru_cache() +@lru_cache() def hwdb_grammar(): ParserElement.setDefaultWhitespaceChars('') @@ -83,7 +89,7 @@ def hwdb_grammar(): return grammar -@functools.lru_cache() +@lru_cache() def property_grammar(): ParserElement.setDefaultWhitespaceChars(' ') |