Package picalo :: Package base :: Module Global
[show private | hide private]
[frames | no frames]

Module picalo.base.Global

Classes
AbstractDecorator An abstract decorator that directs all attribute/method access first here, then to the decorated object, then back here (for the first time something is set).
MessageProgressBarWidget Extension to display a message

Function Summary
  check_valid_table(table, *columns)
Checks to ensure the table is a valid table object, and that the columns are valid columns in the table.
  clear_progress(force)
Clears the progress bar from the screen.
float count(sequence)
Returns the number of items in the sequence.
  create_directory(directory)
Creates the given directory, including all required directories.
  ensure_unique_colname(table, name)
Ensures the name is unique for the columns in the table.
  ensure_unique_list_value(lst, name)
Ensures that the name is unique for the names already in the list.
  ensure_valid_variables(lst, repl)
Ensures the strings in the list are valid Picalo/Python variables.
  is_valid_variable(varname)
Returns whether the given varname is a valid python variablename
  make_unique_colnames(columns)
Takes a list of names and adds the appropriate values to each value to ensure each is unique
  make_valid_variable(varname, repl)
Makes the given variable a valid variable name
object max(*args, **kargs)
With a single sequence argument, return its largest item.
float mean(sequence, default)
Returns the average of the given sequence, or the default if the sequence is empty.
object min(*args, **kargs)
With a single sequence argument, return its smallest item.
  run_tablearray(msg, func, tablearray, *args, **kargs)
Runs the given function on every table in the TableArray.
  show_progress(msg, progress, title, force)
Updates the progress bar with a message and a percentage progress between 0 and 1.
float stdev(sequence, default)
Returns the standard deviation of the given sequence, or the default if the sequence contains zero or one items.
int sum(sequence, start)
Returns the sum of the given sequence of numbers plus the value of start.
  use_progress_indicators(show)
Sets whether Picalo shows progress dialogs in text or GUI mode.
float variance(sequence, default)
Returns the variance of the given sequence, or the default if the sequence contains zero or one items.

Variable Summary
SRE_Pattern FIRST_LETTER_RE = [A-Za-z_]
NoneType guiUpdateProgressDialog = None                                                                  
NoneType lastcaller = None                                                                  
float lastprogress = 0.0                                                                   
SRE_Pattern LETTER_RE = [A-Za-z0-9_]
NoneType mainframe = None                                                                  
MessageProgressBarWidget message_widget = <picalo.base.Global.MessageProgressBarW...
_RLock progress_lock = <_RLock(None, 0)>
NoneType progressDialog = None                                                                  
dict RESERVED_COLUMN_NAMES = {'__module__': None, '__str__': ...
dict TYPE_TO_DB = {<class 'picalo.base.Calendar.Date'>: 'DATE...
bool useProgress = True
SRE_Pattern VARIABLE_RE = ^[A-Za-z_][A-Za-z0-9_]*$
list VARIABLE_TYPES_RE = [[<_sre.SRE_Pattern object at 0x7162...
tuple widgets = (<picalo.base.Global.MessageProgressBarWidget ...

Function Details

check_valid_table(table, *columns)

Checks to ensure the table is a valid table object, and that the columns are valid columns in the table. Throws an AssertionError if anything is wrong.

clear_progress(force=False)

Clears the progress bar from the screen.

Sometimes multiple functions try to show or clear a progress bar. For example, a top-level script might show a master progress bar and then call load(). The load() function tries to show another progress bar, which Picalo normally circumvents or the load() function would take over the top-level script's progress bar. In other words, the first script to show a progress bar is the only one that can update and/or clear the dialog. By setting force to True, you can override this default behavior. This should not normally be used as it takes control when the top-level script should keep control.
Parameters:
force - Whether to force control of the dialog to the calling code.
           (type=boolean)

count(sequence)

Returns the number of items in the sequence. The built in function "len" also gives this value.
Parameters:
sequence - A sequence of items of any type. If not a sequence, returns 1.
           (type=list)
Returns:
The number of items in the sequence
           (type=float)

create_directory(directory)

Creates the given directory, including all required directories. This works equally well on Windows and Unix (the os.mkdirs doesn't seem to like c: in paths).

ensure_unique_colname(table, name)

Ensures the name is unique for the columns in the table. It adds _1, _2, _3, and so forth if needed to the name.

ensure_unique_list_value(lst, name)

Ensures that the name is unique for the names already in the list. It adds _1, _2, _3, and so forth if needed to the name. This function is split out because functions like Crosstable need to create the column name list before creating the table.

ensure_valid_variables(lst, repl='_')

Ensures the strings in the list are valid Picalo/Python variables. This is used to create column names during loading picalo tables.

This method modifies the lst directly. It also returns the lst for convenience reasons.

is_valid_variable(varname)

Returns whether the given varname is a valid python variablename

make_unique_colnames(columns)

Takes a list of names and adds the appropriate values to each value to ensure each is unique

make_valid_variable(varname, repl='_')

Makes the given variable a valid variable name

max(*args, **kargs)

With a single sequence argument, return its largest item. With two or more arguments, return the largest argument.
Parameters:
args - A sequence of items.
Returns:
The largest item in the sequence
           (type=object)

mean(sequence, default=0)

Returns the average of the given sequence, or the default if the sequence is empty. More advanced statistical routines can be found in the picalo.lib.stats module.
Parameters:
sequence - A sequence of numbers
           (type=list)
default - The default value to return when the list is empty
           (type=int)
Returns:
The average of the numbers
           (type=float)

min(*args, **kargs)

With a single sequence argument, return its smallest item. With two or more arguments, return the smallest argument.
Parameters:
args - A sequence of items.
Returns:
The smallest item in the sequence
           (type=object)

run_tablearray(msg, func, tablearray, *args, **kargs)

Runs the given function on every table in the TableArray. If the function returns a Table, the results are collected into another TableList and returned.

It assumes that the first parameter in the function is the table.

show_progress(msg='', progress=1.0, title='Progress', force=False)

Updates the progress bar with a message and a percentage progress between 0 and 1. To remove the progress bar, call clear_progress().

This function is important because it gives feedback to the user. In addition, and perhaps more importantly, it gives the user a cancel button (in GUI mode) that allows the user to cancel your script. Be sure to call show_progress throughout your script.

Sometimes multiple functions try to show or clear a progress bar. For example, a top-level script might show a master progress bar and then call load(). The load() function tries to show another progress bar, which Picalo normally circumvents or the load() function would take over the top-level script's progress bar. In other words, the first script to show a progress bar is the only one that can update and/or clear the dialog. By setting force to True, you can override this default behavior. This should not normally be used as it takes control when the top-level script should keep control.
Parameters:
msg - The message to show the user.
           (type=str)
progress - A value between 0 and 1 indicating the percentage finished.
           (type=float)
title - The title of the progress bar. Defaults to 'Progress'.
           (type=str)
force - Whether to force control of the dialog to the calling code.
           (type=boolean)

stdev(sequence, default=0)

Returns the standard deviation of the given sequence, or the default if the sequence contains zero or one items. More advanced statistical routines can be found in the picalo.lib.stats module.
Parameters:
sequence - A sequence of items.
           (type=list)
default - The default if a standard deviation cannot be calculated.
           (type=float)
Returns:
The standard deviation of the sequence, or the default if len(sequence) < 2.
           (type=float)

sum(sequence, start=0)

Returns the sum of the given sequence of numbers plus the value of start. When the sequence is empty, returns start.
Parameters:
sequence - A sequence of numbers
           (type=list)
start - The starting value, usually 0
           (type=int)
Returns:
The sum of the sequence, plus the start value
           (type=int)

use_progress_indicators(show)

Sets whether Picalo shows progress dialogs in text or GUI mode. Send False into this method to make Picalo quiet. Send True to see progress bars for operations.

variance(sequence, default=0)

Returns the variance of the given sequence, or the default if the sequence contains zero or one items. More advanced statistical routines can be found in the picalo.lib.stats module.
Parameters:
sequence - A sequence of items.
           (type=list)
default - The default if a variance cannot be calculated.
           (type=float)
Returns:
The variance of the sequence, or the default if len(sequence) < 2.
           (type=float)

Variable Details

FIRST_LETTER_RE

Type:
SRE_Pattern
Value:
[A-Za-z_]                                                              

guiUpdateProgressDialog

Type:
NoneType
Value:
None                                                                  

lastcaller

Type:
NoneType
Value:
None                                                                  

lastprogress

Type:
float
Value:
0.0                                                                   

LETTER_RE

Type:
SRE_Pattern
Value:
[A-Za-z0-9_]                                                           

mainframe

Type:
NoneType
Value:
None                                                                  

message_widget

Type:
MessageProgressBarWidget
Value:
<picalo.base.Global.MessageProgressBarWidget object at 0x71ea30>       

progress_lock

Type:
_RLock
Value:
<_RLock(None, 0)>                                                      

progressDialog

Type:
NoneType
Value:
None                                                                  

RESERVED_COLUMN_NAMES

Type:
dict
Value:
{'__doc__': None,
 '__eq__': None,
 '__get_value__': None,
 '__getattr__': None,
 '__getitem__': None,
 '__init__': None,
 '__iter__': None,
 '__len__': None,
...                                                                    

TYPE_TO_DB

Type:
dict
Value:
{<class picalo.base.Boolean.boolean at 0x6cba0>: 'BOOLEAN',
 <type 'float'>: 'FLOAT',
 <type 'int'>: 'INTEGER',
 <type 'long'>: 'BIGINT',
 <class 'picalo.base.Calendar.Date'>: 'DATE',
 <class 'picalo.base.Calendar.DateTime'>: 'TIMESTAMP'}                 

useProgress

Type:
bool
Value:
True                                                                   

VARIABLE_RE

Type:
SRE_Pattern
Value:
^[A-Za-z_][A-Za-z0-9_]*$                                               

VARIABLE_TYPES_RE

Type:
list
Value:
[[<_sre.SRE_Pattern object at 0x7162f8>, <type 'int'>],
 [<_sre.SRE_Pattern object at 0x7162f8>, <type 'long'>],
 [<_sre.SRE_Pattern object at 0x737da0>, <type 'float'>],
 [<_sre.SRE_Pattern object at 0x582908>,
  <class picalo.base.Boolean.boolean at 0x6cba0>],
 [<_sre.SRE_Pattern object at 0x705ee8>,
  <class picalo.base.Boolean.boolean at 0x6cba0>],
 [<_sre.SRE_Pattern object at 0x7166a0>,
...                                                                    

widgets

Type:
tuple
Value:
(<picalo.base.Global.MessageProgressBarWidget object at 0x71ea30>,
 '  ',
 <picalo.lib.progressbar.Percentage object at 0x71ed70>,
 ' ',
 <picalo.lib.progressbar.Bar object at 0x71e610>,
 ' ',
 <picalo.lib.progressbar.ETA object at 0x71ef30>)                      

Generated by Epydoc 2.1 on Mon Aug 20 05:38:17 2007 http://epydoc.sf.net