Skip to content
Snippets Groups Projects
Unverified Commit 975352b0 authored by Awais Qureshi's avatar Awais Qureshi Committed by GitHub
Browse files

Merge pull request #24240 from eduNEXT/lmm/re_py38

[BD-6] Fix python 3.8 compatibility
parents 47c0f3de 398a8a2b
Branches
Tags
No related merge requests found
......@@ -32,6 +32,12 @@ from xmodule.errortracker import make_error_tracker
from .exceptions import InsufficientSpecificationError, InvalidLocationError
# The name of the type for patterns in re changed in Python 3.7.
try:
Pattern = re._pattern_type # pylint: disable=protected-access
except AttributeError:
Pattern = re.Pattern # pylint: disable=no-member
log = logging.getLogger('edx.modulestore')
new_contract('CourseKey', CourseKey)
......@@ -899,7 +905,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
"""
if isinstance(target, list):
return any(self._value_matches(ele, criteria) for ele in target)
elif isinstance(criteria, re._pattern_type): # pylint: disable=protected-access
elif isinstance(criteria, Pattern):
return criteria.search(target) is not None
elif callable(criteria):
return criteria(target)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment