1.1 --- a/imiptools/data.py Sun Jul 26 02:01:24 2015 +0200
1.2 +++ b/imiptools/data.py Sun Jul 26 23:43:26 2015 +0200
1.3 @@ -418,12 +418,6 @@
1.4
1.5 return is_same_sequence and partstat_set or not is_old_sequence
1.6
1.7 -# NOTE: Need to expose the 100 day window for recurring events in the
1.8 -# NOTE: configuration.
1.9 -
1.10 -def get_window_end(tzid, window_size=100):
1.11 - return to_timezone(datetime.now(), tzid) + timedelta(window_size)
1.12 -
1.13 def get_periods(obj, tzid, window_end, inclusive=False):
1.14
1.15 """
1.16 @@ -504,4 +498,34 @@
1.17
1.18 return periods
1.19
1.20 +def get_sender_identities(mapping):
1.21 +
1.22 + """
1.23 + Return a mapping from actual senders to the identities for which they
1.24 + have provided data, extracting this information from the given
1.25 + 'mapping'.
1.26 + """
1.27 +
1.28 + senders = {}
1.29 +
1.30 + for value, attr in mapping.items():
1.31 + sent_by = attr.get("SENT-BY")
1.32 + if sent_by:
1.33 + sender = get_uri(sent_by)
1.34 + else:
1.35 + sender = value
1.36 +
1.37 + if not senders.has_key(sender):
1.38 + senders[sender] = []
1.39 +
1.40 + senders[sender].append(value)
1.41 +
1.42 + return senders
1.43 +
1.44 +# NOTE: Need to expose the 100 day window for recurring events in the
1.45 +# NOTE: configuration.
1.46 +
1.47 +def get_window_end(tzid, window_size=100):
1.48 + return to_timezone(datetime.now(), tzid) + timedelta(window_size)
1.49 +
1.50 # vim: tabstop=4 expandtab shiftwidth=4