python: Use Pattern from typing

Python <3.7 must import Pattern from typing not re

Change-Id: I56acb466aef40b7188e4cd58d3ba5d0b0cc9b090
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42643
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Jason Lowe-Power
2021-03-09 11:12:21 -08:00
committed by Jason Lowe-Power
parent ee1837d313
commit 89ec39a147

View File

@@ -25,7 +25,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import re
from typing import Callable, Dict, Iterator, List, Optional, Union
from typing import Callable, Dict, Iterator, List, Optional, Pattern, Union
from .jsonserializable import JsonSerializable
from .statistic import Scalar, Statistic
@@ -99,7 +99,7 @@ class Group(JsonSerializable):
"""
yield from self.children(lambda _name: _name in name)
def find_re(self, regex: Union[str, re.Pattern]
def find_re(self, regex: Union[str, Pattern]
) -> Iterator[Union["Group", Statistic]]:
""" Find all stats that match the name