Bases: long
define a size class to allow custom formatting format specifiers supported :
em : formats the size as bits in IEC format i.e. 1024 bits (128 bytes) = 1Kib eM : formats the size as Bytes in IEC format i.e. 1024 bytes = 1KiB sm : formats the size as bits in SI format i.e. 1000 bits = 1kb sM : formats the size as bytes in SI format i.e. 1000 bytes = 1KB cm : format the size as bit in the common format i.e. 1024 bits (128 bytes) = 1Kb cM : format the size as bytes in the common format i.e. 1024 bytes = 1KB
Tools to convert between Python datetime instances and Microsoft times.
Source: http://reliablybroken.com/b/2011/09/free-software-ftw-updated-filetimes-py/
Converts a datetime to Microsoft filetime format. If the object is time zone-naive, it is forced to UTC before conversion.
>>> "%.0f" % dt_to_filetime(datetime(2009, 7, 25, 23, 0))
'128930364000000000'
>>> "%.0f" % dt_to_filetime(datetime(1970, 1, 1, 0, 0, tzinfo=utc))
'116444736000000000'
>>> "%.0f" % dt_to_filetime(datetime(1970, 1, 1, 0, 0))
'116444736000000000'
>>> dt_to_filetime(datetime(2009, 7, 25, 23, 0, 0, 100))
128930364000001000
Converts a Microsoft filetime number to a Python datetime. The new datetime object is time zone-naive but is equivalent to tzinfo=utc.
>>> filetime_to_dt(116444736000000000)
datetime.datetime(1970, 1, 1, 0, 0)
>>> filetime_to_dt(128930364000000000)
datetime.datetime(2009, 7, 25, 23, 0)
>>> filetime_to_dt(128930364000001000)
datetime.datetime(2009, 7, 25, 23, 0, 0, 100)
Bases: object
Helper class used as a parent class for most filesystem structures.
Exports byte array to specified destination
Returns char (1 byte)
Returns unpacked Python struct array.
Returns int (4 bytes)
Returns string (length bytes)
Returns unsigned char (1 byte)
Returns unsigned int (4 bytes)
Returns unsigned int (4 bytes)
Returns unsigned long (4 bytes)
Returns unsigned long (4 bytes)
Returns unsigned long long (8 bytes)
Returns unsigned long long (8 bytes)
Returns unsigned short (2 bytes), assuming source is big-endian.
Returns unsigned short (2 bytes), assuming source is little-endian.
Returns Python uuid object initialized with bytes at specified offset
Returns Python uuid object initialized with bytes at specified offset
Prints structure’s data in hex format.
>>> 00000000: 46 49 4C 45 30 00 03 00 EA 22 20 00 00 00 00 00 FILE0...." .....
>>> 00000010: 01 00 01 00 38 00 01 00 A0 01 00 00 00 04 00 00 ....8...........
>>> 00000020: 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 ................