Skip to content

Commit c54cee1

Browse files
committed
chore: add instance check to regex
1 parent 5668b52 commit c54cee1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

siibra/core/region.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"Both",
4545
]
4646

47+
REGEX_TYPE=type(re.compile('test'))
4748

4849
class Region(anytree.NodeMixin, AtlasConcept):
4950
"""
@@ -290,7 +291,7 @@ def splitstr(s):
290291
]
291292
)
292293
# Python 3.6 does not support re.Pattern
293-
elif hasattr(re, 'Pattern') and isinstance(regionspec, re.Pattern):
294+
elif isinstance(regionspec, REGEX_TYPE):
294295
# match regular expression
295296
return any(regionspec.search(s) is not None for s in [self.name, self.key])
296297
else:

0 commit comments

Comments
 (0)