File tree Expand file tree Collapse file tree
openedx_content/applets/publishing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010from contextlib import nullcontext
1111from datetime import datetime , timezone
12- from typing import ContextManager , Optional
12+ from typing import ContextManager , Optional , cast
1313
1414from django .core .exceptions import ObjectDoesNotExist
1515from django .db .models import F , Prefetch , Q , QuerySet
@@ -854,7 +854,7 @@ def _create_side_effects_for_change_log(change_log: DraftChangeLog | PublishLog)
854854 # Update the current branch pointer (Draft or Published) for this
855855 # entity to point to the side_effect_change (if it's not already).
856856 if branch_cls == Published :
857- published_obj = affected # 'affected' is the current Published object
857+ published_obj = cast ( Published , affected )
858858 if published_obj .publish_log_record_id != side_effect_change .pk :
859859 published_obj .publish_log_record = side_effect_change
860860 branch_objs_to_update_with_side_effects .append (published_obj )
Original file line number Diff line number Diff line change 1212
1313import hashlib
1414import uuid
15+ from typing import Any
1516
1617from django .db import models
1718
@@ -124,7 +125,7 @@ def key_field(**kwargs) -> MultiCollationCharField:
124125 return case_sensitive_char_field (max_length = 500 , blank = False , ** kwargs )
125126
126127
127- def hash_field (** kwargs ) -> models .CharField :
128+ def hash_field (** kwargs : Any ) -> models .CharField :
128129 """
129130 Holds a hash digest meant to identify a piece of content.
130131
@@ -145,13 +146,14 @@ def hash_field(**kwargs) -> models.CharField:
145146 didn't seem worthwhile, particularly the possibility of case-sensitivity
146147 related bugs.
147148 """
148- default_kwargs = {
149+ default_kwargs : dict [ str , Any ] = {
149150 "max_length" : 40 ,
150151 "blank" : False ,
151152 "null" : False ,
152153 "editable" : False ,
153154 }
154- return models .CharField (** (default_kwargs | kwargs ))
155+ merged : dict [str , Any ] = {** default_kwargs , ** kwargs }
156+ return models .CharField (** merged )
155157
156158
157159def manual_date_time_field () -> models .DateTimeField :
You can’t perform that action at this time.
0 commit comments