gnome.utilities.inf_datetime

special datetime objects with -inf and inf times

These are not real datetime objects – simply something that can be compared with one

Note: this is very liberal with comparisons – essentially an infinity time object is greater than anything, so no checking to see what you are comparing to..

Also special constructor for a real datetime that won’t allow values out of range for this application

Module Contents

Classes

InfTime

class representing time into infinity

MinusInfTime

class representing time from infinity in the past

InfDateTime

A special datetime object:

Attributes

min_datetime

max_datetime

gnome.utilities.inf_datetime.min_datetime
gnome.utilities.inf_datetime.max_datetime
class gnome.utilities.inf_datetime.InfTime

Bases: object

class representing time into infinity

compares as greater than any datetime (or any other object..)

__str__()

Return str(self).

__repr__()

Return repr(self).

isoformat()
__lt__(other)

an InfTime object is never less than any other object

__le__(other)

an InfTime object is never less than or equal to any other object otehr than itself.

__eq__(other)

an InfTime object is only equal to itself

__ne__(other)

an InfTime object is only equal to itself

__gt__(other)

an InfTime object is greater than eveything except another InfTime object

__ge__(other)

an InfTime object is greater or equal to anything

__pos__()
__neg__()
class gnome.utilities.inf_datetime.MinusInfTime

Bases: object

class representing time from infinity in the past

compares as less than any datetime (or any other object)

__str__()

Return str(self).

__repr__()

Return repr(self).

isoformat()
__lt__(other)

an MinusInfTime object is always less than any other object except itself

__le__(other)

an MinusInfTime object is always less than or equal to any other object.

__eq__(other)

A MinusInfTime object is only equal to itself

__ne__(other)

A MinusInfTime object is only equal to itself

__gt__(other)

A MinusInfTime object is not greater than anything

__ge__(other)

A Minus InfTime object is not greater than or equal to anything other than itself

__pos__()
__neg__()
class gnome.utilities.inf_datetime.InfDateTime

Bases: datetime.datetime

A special datetime object:

It is either a regular datetime object, with the provision that it can’t be set outside the range given by the module variables:

min_datetime max_datetime

or a MinusInfTime or InfTime object.

create a new InfDateTime object

Parameters:
  • year – integer year of datetime object. year can also be “inf” or “-inf”, and you’ll get a special MinusInfTime or InfTime object.

  • month – integer month of datetime

  • day – integer day of datetime

  • hour=0 – integer hour of datetime

  • minute=0 – integer minute of datetime

  • second=0 – integer second of datetime

  • microsecond=0 – integer microsecond of datetime

  • tzinfo=None – timzoneinfo object. See datetime docs for details.