lethe.utils – Miscellaneous functions

These functions are used by various modules of Lethe, while they have no relation to the design and aims of the package.

lethe.utils.is_subclass(base, klass)

Return True if klass is a subclass of base.

lethe.utils.is_subclass_replacing_method(base, klass, method_name)

Return True if klass is a subclass of base with a different implementation of method named method_name.


Return a string representation of date in the W3C date and time format.

Parameters:date – a datetime.date or datetime.datetime instance

Return a datetime.datetime representation of string which is in the W3C date and time format.

Parameters:string – a string like what format_date returns
Returns:an object representing the parsed date: datetime.datetime if the date has time of day, otherwise datetime.date if the date has day, a tuple of year and month, or an int of year if no month is given
Raises ValueError:
 if the input is not a correct date
class lethe.utils.UTC

datetime.tzinfo implementation for UTC.

lethe.utils.mock = <module 'mock' from '/home/mtjm/.local/lib/python2.7/site-packages/mock.pyc'>

The unittest.mock or mock module, imported here for compatibility with both module locations.

Previous topic

lethe.binmeta – Binary file metadata extraction

Next topic

Missing features and work in progress

This Page