diff options
author | ptmcg <ptmcg@austin.rr.com> | 2021-09-22 08:39:08 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2021-09-22 08:39:08 -0500 |
commit | b9b466bf59e6227a51c4c796e2c17dec40f679f9 (patch) | |
tree | 45502ba3199c1dc7f4833db71c87382f417dcb95 /pyparsing/results.py | |
parent | 6854842356ba17c11d5164320c1f6a1d332e89c5 (diff) | |
download | pyparsing-git-b9b466bf59e6227a51c4c796e2c17dec40f679f9.tar.gz |
Add return types in results.py, and small perf change in __bool__
Diffstat (limited to 'pyparsing/results.py')
-rw-r--r-- | pyparsing/results.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/pyparsing/results.py b/pyparsing/results.py index d4e023f..f82ceb7 100644 --- a/pyparsing/results.py +++ b/pyparsing/results.py @@ -1,6 +1,5 @@ # results.py - -from collections.abc import MutableMapping, Mapping, MutableSequence +from collections.abc import MutableMapping, Mapping, MutableSequence, Iterator import pprint from weakref import ref as wkref from typing import Tuple, Any @@ -240,12 +239,12 @@ class ParseResults: return len(self._toklist) def __bool__(self) -> bool: - return not not self._toklist or not not self._tokdict + return not not (self._toklist or self._tokdict) - def __iter__(self): + def __iter__(self) -> Iterator: return iter(self._toklist) - def __reversed__(self): + def __reversed__(self) -> Iterator: return iter(self._toklist[::-1]) def keys(self): |