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

Module phonebook

A widget for displaying/editting the phone information

The format for a phonebook entry is standardised. It is a dict with the following fields. Each field is a list, most important first, with each item in the list being a dict.

names: categories: emails: maillist: urls: ringtones: addresses: wallpapers: flags: memos: numbers: serials:
Classes
ColumnSelectorDialog  
EntryMatcher  
ImportCellRenderer  
ImportDataTable  
ImportDialog  
ImportedEntryMatchDialog  
phonebookdataobject  
PhonebookPrintDialog  
PhoneDataTable  
PhoneEntryDetailsView  
PhoneWidget  

Function Summary
  cleanemail(email, mode)
Returns lowercase email
  cleannumber(num)
Returns num (a phone number) with all non-digits removed
  cleanurl(url, mode)
Returns lowercase url with the "http://" prefix removed and in lower case
  compareallfields(s, a, fields, threshold, lookat)
Like comparefields, but for source and against lists where multiple keys have values in each item
  comparefields(s, a, valuekey, threshold, lookat)
Compares the valuekey field in source and against lists returning a score for closeness of match
  comparenames(s, a)
Give a score on two names
  comparenumbers(s, a)
Give a score on two phone numbers
  comparestrings(origfield, impfield)
Compares two strings and returns the score using winkler routine from Febrl (stringcmp.py)
  default_cleaner(x)
  dictintersection(one, two)
  formataddress(address)
  formatcategories(cats)
  formatnumber(number)
  formatsecret(flag)
  formatstorage(flag)
  formattypenumber(number)
  getdata(column, entry, default)
Returns the value in a particular column.
  getdatainfo(column, entry)
Similar to getdata except returning higher level information.
  htmlify(string)
  mergefields(orig, imp, field, threshold, cleaner)
Return the results of merging two lists of fields
  mergenumberlists(orig, imp)
Return the results of merging two lists of numbers
  normalise_data(entries)
  workaroundyetanotherwxpythonbug(method, *args)

Function Details

cleanemail(email, mode='compare')

Returns lowercase email

cleannumber(num)

Returns num (a phone number) with all non-digits removed

cleanurl(url, mode='compare')

Returns lowercase url with the "http://" prefix removed and in lower case
Parameters:
mode - If the value is compare (default), it removes ""http://www."" in preparation for comparing entries. Otherwise, if the value is pb, the result is formatted for writing to the phonebook.

compareallfields(s, a, fields, threshold=0.80000000000000004, lookat=3)

Like comparefields, but for source and against lists where multiple keys have values in each item
Parameters:
fields - This should be a list of keys from the entries that are in the order the human would write them down.

comparefields(s, a, valuekey, threshold=0.80000000000000004, lookat=3)

Compares the valuekey field in source and against lists returning a score for closeness of match

comparenames(s, a)

Give a score on two names

comparenumbers(s, a)

Give a score on two phone numbers

comparestrings(origfield, impfield)

Compares two strings and returns the score using winkler routine from Febrl (stringcmp.py)

Return value is between 0.0 and 1.0, where 0.0 means no similarity whatsoever, and 1.0 means the strings match exactly.

getdata(column, entry, default=None)

Returns the value in a particular column. Note that the data is appropriately formatted.
Parameters:
column - column name
entry - the dict representing a phonebook entry
default - what to return if the entry has no data for that column

getdatainfo(column, entry)

Similar to getdata except returning higher level information.

Returns the key name and which index from the list corresponds to the column.
Parameters:
column - Column name
entry - The dict representing a phonebook entry
Returns:
(keyname, index) tuple. index will be None if the entry doesn't have the relevant column value and -1 if all of them apply

mergefields(orig, imp, field, threshold=0.88, cleaner=<function <lambda> at 0x02015BF0>)

Return the results of merging two lists of fields

We compare the fields. If they are the same, then the original is kept (since the name is the same, and the original most likely has the correct punctuation).

Otherwise the imported entries overwrite the originals

mergenumberlists(orig, imp)

Return the results of merging two lists of numbers

We compare the sanitised numbers (ie after punctuation etc is stripped out). If they are the same, then the original is kept (since the number is the same, and the original most likely has the correct punctuation).

Otherwise the imported entries overwrite the originals

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