1.1 --- a/EventAggregatorSupport.py Mon Jan 17 02:26:17 2011 +0100
1.2 +++ b/EventAggregatorSupport.py Tue Jan 18 00:15:53 2011 +0100
1.3 @@ -252,9 +252,9 @@
1.4
1.5 def getHTTPTimeString(tmtuple):
1.6 return "%s, %02d %s %04d %02d:%02d:%02d GMT" % (
1.7 - weekday_labels[tmtuple.tm_wday],
1.8 + getDayLabel(tmtuple.tm_wday),
1.9 tmtuple.tm_mday,
1.10 - month_labels[tmtuple.tm_mon -1], # zero-based labels
1.11 + getMonthLabel(tmtuple.tm_mon),
1.12 tmtuple.tm_year,
1.13 tmtuple.tm_hour,
1.14 tmtuple.tm_min,
1.15 @@ -1023,6 +1023,15 @@
1.16 return tuple(self.data)
1.17
1.18 def __cmp__(self, other):
1.19 +
1.20 + """
1.21 + The result of comparing this instance with 'other' is derived from a
1.22 + comparison of the instances' date(time) data at the highest common
1.23 + resolution, meaning that if a date is compared to a datetime, the
1.24 + datetime will be considered as a date. Thus, a date and a datetime
1.25 + referring to the same date will be considered equal.
1.26 + """
1.27 +
1.28 if not isinstance(other, Temporal):
1.29 return NotImplemented
1.30 else:
1.31 @@ -1240,6 +1249,15 @@
1.32 return self
1.33
1.34 def __cmp__(self, other):
1.35 +
1.36 + """
1.37 + The result of comparing this instance with 'other' is, if both instances
1.38 + are datetime instances, derived from a comparison of the datetimes
1.39 + converted to UTC. If one or both datetimes cannot be converted to UTC,
1.40 + the datetimes are compared using the basic temporal comparison which
1.41 + compares their raw time data.
1.42 + """
1.43 +
1.44 this = self.as_datetime_or_date()
1.45
1.46 if isinstance(this, DateTime) and isinstance(other, DateTime):
1.47 @@ -1460,25 +1478,37 @@
1.48 return self.start, self.end
1.49
1.50 def is_before(self, a, b):
1.51 +
1.52 + """
1.53 + Return whether 'a' is before 'b'. Since the end datetime of one period
1.54 + may be the same as the start datetime of another period, and yet the
1.55 + first period is intended to be concluded by the end datetime and not
1.56 + overlap with the other period, a different test is employed for datetime
1.57 + comparisons.
1.58 + """
1.59 +
1.60 if isinstance(a, DateTime) and a.has_time() and isinstance(b, DateTime) and b.has_time():
1.61 return a <= b
1.62 else:
1.63 return a < b
1.64
1.65 - def is_after_or_during(self, a, b):
1.66 - if isinstance(a, DateTime) and a.has_time() and isinstance(b, DateTime) and b.has_time():
1.67 - return a > b
1.68 - else:
1.69 - return a >= b
1.70 -
1.71 def __contains__(self, other):
1.72 +
1.73 + """
1.74 + This instance is considered to contain 'other' if one is not before or
1.75 + after the other. If this instance overlaps or coincides with 'other',
1.76 + then 'other' is regarded as belonging to this instance's time period.
1.77 + """
1.78 +
1.79 return self == other
1.80
1.81 def __cmp__(self, other):
1.82
1.83 """
1.84 Return whether this timespan occupies the same period of time as the
1.85 - 'other'.
1.86 + 'other'. Timespans are considered less than others if their end points
1.87 + precede the other's start point, and are considered greater than others
1.88 + if their start points follow the other's end point.
1.89 """
1.90
1.91 if isinstance(other, Timespan):
1.92 @@ -1502,7 +1532,10 @@
1.93
1.94 class TimespanCollection:
1.95
1.96 - "A collection of timespans with a particular resolution."
1.97 + """
1.98 + A collection of timespans with a particular resolution, providing list-like
1.99 + instances which can maintain a coherent ordering of their timespan elements.
1.100 + """
1.101
1.102 def __init__(self, resolution, values=None):
1.103