Package client :: Package Dock :: Module DataGuesser
[hide private]
[frames] | no frames]

Module DataGuesser

source code

Overview

The data guessing module was created so that functions in in the dock widget would make somewhat intelligent guesses at what the user might want to use ahead of time. This functionality is negelcted if the user wants it to be, however, even guesses it does make are overwritable. This is purely meant as a time saver for users.

Functions [hide private]
 
GenerateRegExpFromName(name)
This function will take the name provided and produce a regular expression that accepts strings very similar to the name provided.
source code
 
GenerateRegExpFromWord(word)
This function is currently the exact same as GenerateRegExpFromName.
source code
 
GuessAttributes(object, guessList)
This function takes a DockWidget and a list of regular expressions.
source code
Function Details [hide private]

GenerateRegExpFromName(name)

source code 

Overview

This function will take the name provided and produce a regular expression that accepts strings very similar to the name provided. The regular expression may start with a number, underscore, or nothing. Then it must contain the name provided, in any mixture of capital and lower case letters. Finally it may end with a number or underscore, or nothing of course.

Parameters:
  • name (string) - The name which you want turned into a regular expression.
Returns:
_sre.SRE_Pattern, a compiled regular expression retrieved from the re.compile () method.

GenerateRegExpFromWord(word)

source code 

Overview

This function is currently the exact same as GenerateRegExpFromName. Originally there was going to be a distinction in the types of regular expression objects returned. As of now, the appropriate dock widgets still make use of this method, so if a compiled regular expression is ever desired, only this function must be changed.

Parameters:
  • word (string) - The word which you want turned into a regular expression.
Returns:
_sre.SRE_Pattern, a compiled regular expression retrieved from the re.compile () method.

GuessAttributes(object, guessList)

source code 

Overview

This function takes a DockWidget and a list of regular expressions. It will run down the Basin Object Tree, attempting to add any object that fits into the regular expression. When that occurs, it starts at the top the Basin Object Tree again and does the same for the second regular expression until all of the regular expressions have been tried. Normal rules apply for adding objects to a Dock Widget's Holder. This means that if the first two regular expressions find objects with different parents lists, the second will kick the first one out.

Parameters:
  • object (DockWidget) - This is the dock widget for which the guesses are being made on.
  • guessList (list <_sre.SRE_Pattern>) - A list of all the compiled regular expressions for which guesses are being made