Module common
[show private | hide private]
[frames | no frames]

Module common

Various classes and functions that are used by GUI and command line versions of BitPim
Classes
exceptionwrap A debugging assist class that helps in tracking down functions returning exceptions
FileCache  

Exceptions
AutoPortsFailure Failed to auto detect a useful port
CommandExecutionFailed  
CommsDataCorruption There was some form of data corruption
CommsDeviceNeedsAttention The communication port or device attached to it needs some manual intervention
CommsException Generic commmunications exception
CommsNeedConfiguring The communication settings need to be configured
CommsOpenFailure Failed to open the communications port/device
CommsTimeout Timeout while reading or writing the commport
CommsWrongPort The wrong port has been selected, typically the modem port on an LG composite device
ConversionNotSupported  
FeatureNotAvailable The device doesn't support the feature
HelperBinaryNotFound  
InSafeModeException  
IntegrityCheckFailed  
PhoneBookBusyException The phonebook is busy on the phone
PhoneStringDecodeException  
PhoneStringEncodeException  

Function Summary
  basename(name)
  crc(data, initial)
CRC calculation - returns 16 bit integer
  crcs(data, initial)
CRC calculation - returns 2 byte string LSB
string datatohexstring(data)
Returns a pretty printed hexdump of the data
  decodecharacterbits(bytes, bitsperchar, charconv, terminator)
Decodes the characters out of a string of bytes where each character takes a fixed number of bits (eg 7)
  dirname(name)
  encode_with_degrade(uni_string, codec, error_handling)
  forceascii(s)
  formatexception(excinfo, lastframes)
Pretty print exception, including local variable information.
  formatexceptioneh(*excinfo)
  frombinary(v)
  get_ascii_string(uni_string, error_handling)
converts any type into an ascii byte string, for unicode string it will degrade if possible
  get_main_dir()
Return the absoluate path of the main BitPim dir
  get_version_number(filename)
Return the version of a Windows DLL or EXE file
  getext(name)
  GetFileVersionInfo(...)
  getfullname(name)
Returns the object corresponding to name.
  getkv(dict, key, updates)
Gets a key and value from a dict, returning as a dict potentially applying updates
  gettempfilename(extension)
Returns a filename to be used for a temporary file
  hexify(data)
Turns binary data into a hex string (like the output of MD5/SHA hexdigest)
  HIWORD(...)
  importas(name)
  list_union(*lists)
  LOWORD(...)
  LSBstr16(v)
  LSBstr32(v)
  LSBUint16(v)
  LSBUint32(v)
  main_is_frozen()
Return T if running from an exe, F otherwise
  MSBstr16(v)
  MSBstr32(v)
  MSBUint16(v)
  MSBUint32(v)
  obfus_decode(str)
  obfus_encode(str)
  opentextfile(name)
This function detects unicode byte order markers and if present uses the codecs module instead to open the file instead with appropriate unicode decoding, else returns the file using standard open function
  pppescape(data)
  pppunescape(d)
string prettyprintdict(dictionary, indent)
Returns a pretty printed version of the dictionary
  readversionedindexfile(filename, dict, versionhandlerfunc, currentversion)
  statinfo(filename)
Returns a simplified version of os.stat results that can be used to tell if a file has changed.
  stripext(name)
  tobinary(v)
  unicode_execfile(filename, dict1, dict2)
  writeversionindexfile(filename, dict, currentversion)

Function Details

crc(data, initial=65535)

CRC calculation - returns 16 bit integer

crcs(data, initial=65535)

CRC calculation - returns 2 byte string LSB

datatohexstring(data)

Returns a pretty printed hexdump of the data
Returns:
string

decodecharacterbits(bytes, bitsperchar, charconv=<built-in function chr>, terminator=None)

Decodes the characters out of a string of bytes where each character takes a fixed number of bits (eg 7)
Parameters:
bytes - atring containing the raw bytes
bitsperchar - number of bits making up each character
charconv - the function used to convert the integer value into a character
terminator - if this character is seen then it and the remaining bits are ignored

formatexception(excinfo=None, lastframes=8)

Pretty print exception, including local variable information.

See Python Cookbook, recipe 14.4.
Parameters:
excinfo - tuple of information returned from sys.exc_info when the exception occurred. If you don't supply this then information about the current exception being handled is used
lastframes - local variables are shown for these number of frames
Returns:
A pretty printed string

get_ascii_string(uni_string, error_handling='strict')

converts any type into an ascii byte string, for unicode string it will degrade if possible

get_main_dir()

Return the absoluate path of the main BitPim dir

get_version_number(filename)

Return the version of a Windows DLL or EXE file

getfullname(name)

Returns the object corresponding to name. Imports will be done as necessary to resolve every part of the name

getkv(dict, key, updates=None)

Gets a key and value from a dict, returning as a dict potentially applying updates

gettempfilename(extension=None)

Returns a filename to be used for a temporary file

hexify(data)

Turns binary data into a hex string (like the output of MD5/SHA hexdigest)

main_is_frozen()

Return T if running from an exe, F otherwise

opentextfile(name)

This function detects unicode byte order markers and if present uses the codecs module instead to open the file instead with appropriate unicode decoding, else returns the file using standard open function

prettyprintdict(dictionary, indent=0)

Returns a pretty printed version of the dictionary

The elements are sorted into alphabetical order, and printed one per line. Dictionaries within the values are also pretty printed suitably indented.
Returns:
string

statinfo(filename)

Returns a simplified version of os.stat results that can be used to tell if a file has changed. The normal structure returned also has things like last access time which should not be used to tell if a file has changed.

Generated by Epydoc 2.1 on Fri Aug 15 18:58:25 2008 http://epydoc.sf.net