@@ -843,7 +843,7 @@ def _compile_window_sort_by(self, order_by_list, sort_fields):
843843 Compile Window.order_by to a MongoDB sortBy document and any pre-sort
844844 $addFields.
845845
846- sort_fields is a shared dict ( expr_mql_key → field_name) across all
846+ sort_fields is a shared dict { expr_mql_key: field_name} across all
847847 windows in the same query, so that identical expressions reuse the same
848848 field name and different expressions get distinct names.
849849 """
@@ -877,7 +877,7 @@ def _compile_window_sort_by(self, order_by_list, sort_fields):
877877 # so {ind: 0, val: v} vs {ind: 1, val: null} is decided by
878878 # "ind" before "val", giving clean null positioning.
879879 # null_ind=1 puts null AFTER non-null in ASC / BEFORE in DESC.
880- # nulls_last!= descending means we want null last in ASC or
880+ # nulls_last != descending means nulls will be last in ASC or
881881 # first in DESC — both require the higher ind value (1).
882882 null_ind = int (bool (item .nulls_last ) != bool (item .descending ))
883883 null_field = f"__wsort{ len (sort_fields ) + 1 } "
@@ -961,7 +961,7 @@ def _prepare_window_annotations_for_pipeline(self):
961961 """
962962 Build $setWindowFields pipeline stages for window annotations.
963963
964- Returns (stages, replacements) where stages is a list of pipeline dicts
964+ Return (stages, replacements) where stages is a list of pipeline dicts
965965 and replacements maps Window sub-expressions and full over-clause
966966 annotations to Ref objects for use in $project.
967967 """
@@ -997,7 +997,7 @@ def _collect_windows_from_expr(expr, target=None):
997997 # $setWindowFields.
998998 groups = {}
999999 pre_add_fields = {}
1000- sort_fields = {} # shared across all windows: expr_mql_key → field_name
1000+ sort_fields = {} # shared across all windows, expr_mql_key: field_name
10011001 for alias , window in window_list :
10021002 partition_mql = self ._compile_window_partition_by (window .partition_by )
10031003 sort_doc , pre_add_fields_ = self ._compile_window_sort_by (window .order_by , sort_fields )
0 commit comments