refactor: pyupgrade second iteration (#27453)

This commit is contained in:
Usama Sadiq
2021-05-10 13:48:34 +05:00
committed by GitHub
parent ea550c06a5
commit 2409ea22be
15 changed files with 76 additions and 77 deletions

View File

@@ -81,14 +81,14 @@ def context_dict_for_learning_context(context_key):
"""
context_dict = {
'context_id': text_type(context_key) if context_key else '',
'context_id': str(context_key) if context_key else '',
'course_id': '',
'org_id': '',
}
if context_key is not None:
assert isinstance(context_key, LearningContextKey)
if context_key.is_course:
context_dict['course_id'] = text_type(context_key)
context_dict['course_id'] = str(context_key)
if hasattr(context_key, 'org'):
context_dict['org_id'] = context_key.org
return context_dict