def _overwrite_special_dates(midnight_utcs, opens_or_closes, special_opens_or_closes):
 if (not len(special_opens_or_closes)):
  return
 (len_m, len_oc) = (len(midnight_utcs), len(opens_or_closes))
 if (len_m != len_oc):
  raise ValueError(('Found misaligned dates while building calendar.\nExpected midnight_utcs to be the same length as open_or_closes,\nbut len(midnight_utcs)=%d, len(open_or_closes)=%d' % len_m), len_oc)
 indexer = midnight_utcs.get_indexer(special_opens_or_closes.normalize())
 if ((-1) in indexer):
  bad_dates = list(special_opens_or_closes[(indexer == (-1))])
  raise ValueError(('Special dates %s are not trading days.' % bad_dates))
 opens_or_closes.values[indexer] = special_opens_or_closes.values

def _overwrite_special_dates ( midnight_utcs , opens_or_closes , special_opens_or_closes ) : if ( not len ( special_opens_or_closes ) ) : return ( len_m , len_oc ) = ( len ( midnight_utcs ) , len ( opens_or_closes ) ) if ( len_m != len_oc ) : raise ValueError ( ( 'Found misaligned dates while building calendar.\nExpected midnight_utcs to be the same length as open_or_closes,\nbut len(midnight_utcs)=%d, len(open_or_closes)=%d' % len_m ) , len_oc ) indexer = midnight_utcs . get_indexer ( special_opens_or_closes . normalize ( ) ) if ( ( - 1 ) in indexer ) : bad_dates = list ( special_opens_or_closes [ ( indexer == ( - 1 ) ) ] ) raise ValueError ( ( 'Special dates %s are not trading days.' % bad_dates ) ) opens_or_closes . values [ indexer ] = special_opens_or_closes . values
overwrite dates in open_or_closes with corresponding dates in special_opens_or_closes .