@@ -775,17 +775,19 @@ def __init__(self, intervals, sub_iterators=None, directions=None):
775775 super ().__init__ (intervals )
776776
777777 # Normalize sub-iterators
778- sub_iterators = dict ([(k , tuple (filter_ordered (as_tuple (v ))))
779- for k , v in (sub_iterators or {}).items ()])
778+ sub_iterators = sub_iterators or {}
779+ sub_iterators = {d : tuple (filter_ordered (as_tuple (v )))
780+ for d , v in sub_iterators .items () if d in self .intervals }
780781 sub_iterators .update ({i .dim : () for i in self .intervals
781782 if i .dim not in sub_iterators })
782783 self ._sub_iterators = frozendict (sub_iterators )
783784
784785 # Normalize directions
785- if directions is None :
786- self ._directions = frozendict ([(i .dim , Any ) for i in self .intervals ])
787- else :
788- self ._directions = frozendict (directions )
786+ directions = directions or {}
787+ directions = {d : v for d , v in directions .items () if d in self .intervals }
788+ directions .update ({i .dim : Any for i in self .intervals
789+ if i .dim not in directions })
790+ self ._directions = frozendict (directions )
789791
790792 def __repr__ (self ):
791793 ret = ', ' .join (["%s%s" % (repr (i ), repr (self .directions [i .dim ]))
@@ -807,8 +809,7 @@ def __lt__(self, other):
807809 return len (self .itintervals ) < len (other .itintervals )
808810
809811 def __hash__ (self ):
810- return hash ((super ().__hash__ (), self .sub_iterators ,
811- self .directions ))
812+ return hash ((super ().__hash__ (), self .sub_iterators , self .directions ))
812813
813814 def __contains__ (self , d ):
814815 try :
0 commit comments