Rugg API Documentation
Method onecmd
onecmd( self, string
)
Undocumented
str
'Documented commands (type help
<topic>):'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
''
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
NoneType
None
Undocumented
str
'Miscellaneous help
topics:'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'*** No help on %s'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'(Cmd) '
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'='
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'Undocumented
commands:'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
int
1
int(x[, base]) -> integer
Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If the argument is outside the integer range a long object will be returned instead.
Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If the argument is outside the integer range a long object will be returned instead.
Class Interpreter
<class rugg.main.Interpreter
at 0x406b747c>
Default implementation for the Rugg
interpreter.
Function run
run( args )
Undocumented
str
'\nSyntax overview:\n \n QUANTITY
[NUMBER](b, Kb, Mb, Tb) 10.5Mb\n RANGE [QUANTITY]..[QUANTITY]
1Mb..10Mb\n [QUANTITY]..[QUANTITY]/STEPS 1Mb..10Mb/10\n
[QUANTITY]..[QUANTITY]/INC 1Mb..10Mb+0.5Mb\n\n OPERATION [NAME]
PARAMETER... zone 10Mb\n\n COMBINATION [EXPRESSION] , [EXPRESSION]
zone 10Mb, subdivide\n ITERATION [EXPRESSION] : [EXPRESSION] zone
10Mb, subdivide : fill\n APPLICATION [EXPRESSION] | [EXPRESSION]
zone 10Mb, subdivide | fill\n GROUPING ( [EXPRESSION] ) subdivide :
(blank, fill)\n\n COMMENTS !-- [ANYTHING] --! !-- Here is a comment
--!\n'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'Checks the program syntax and
semantics.'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'Does not clean the created zone
that were not unlinked.'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'Displays the parse
tree.'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'Rugg v0.2.3 - Hard drive harness
and testing language\n\nRugg is both a tool that allows to create
simple to complex scenarios that will\ntest your hard drive. Rugg
scenarios can be written in a compact and expressive\nlanguage that
allow you to create test that will mimic behaviours of
programs\nlike Apache or PosgreSQL in minutes.\n\nBy default, Rugg
is started as an interactive shell, unless you giveit
some\narguments. You can give paths to files containing scenarios
as well as strings\nrepresenting program data. To have a list of
available command-line options, run\nrugg with the "-h" or "--help"
options.\n\nWelcome to Rugg ! \n'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Module rugg.main
<module 'rugg.main' from
'/usr/local/lib/python2.4/site-packages/rugg/main.py'>
This is the main Rugg module, it contains
the definition for the command line interprter and parser.
For more details on Rugg internals, you should look at the @rugg.language module, which contains the most important part of the language (parser and semantics). The @rugg.core module contains the Python API that can be used in scripts, and this API is wrapped in the @rugg.operations module.
For more details on Rugg internals, you should look at the @rugg.language module, which contains the most important part of the language (parser and semantics). The @rugg.core module contains the Python API that can be used in scripts, and this API is wrapped in the @rugg.operations module.
Method run
run( self, program,
parameters='parameters' )
Runs this by iterating through the values
raised by the first operation, and applying them to the
second.
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method contextAdd
contextAdd( self, element
)
When an element is added to the iteration
context, it will be added to the combination first child
context.
Method contextType
contextType( self )
Returns the type for this operation
context.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method type
type( self )
Undocumented
Method validate
validate( self,
markOnly='markOnly' )
Undocumented
Class Application
<class
rugg.language.Application at 0x407c38cc>
An Application is a specific kind of
Iteration, where the application of the values of the SET to the
operation is made in parallel, not in sequence.
Method add
add( self, element )
Undocumented
Method contextAdd
contextAdd( self, element
)
When an element is added to the combination
context, it will be added to the combination first child
context.
Method run
run( self, program,
parameters='parameters' )
Runs each child sequentially, by feeding the
preceding one the result of the next.
Method type
type( self )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method contextType
contextType( self )
Returns the type for this operation
context.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Combination
<class
rugg.language.Combination at 0x407c392c>
A combination makes a "chain" of operations,
where the first element may be either a value or operation. The
result of the previous operation is then passed as a parameter to
the next one.
Structure: (VALUE|OPERATION, OPERATION...) If the first element is a VALUE, then the combination context should not be modified, because the first child will inherit the combination context -- which will only work if the first element is an operation (values have no context).
Structure: (VALUE|OPERATION, OPERATION...) If the first element is a VALUE, then the combination context should not be modified, because the first child will inherit the combination context -- which will only work if the first element is an operation (values have no context).
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method run
run( self, program,
arguments='arguments' )
Runs the element as being part of the given
program. This leads to the execution of the declaration represented
in the program model. It does nothing by default.
Method type
type( self )
Returns the type for this element.
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Element
<class rugg.language.Element
at 0x407c368c>
Element is the abstract class for components
of the program model.
Attributes: children [Element] errors [Exception] token tpg.Token
Attributes: children [Element] errors [Exception] token tpg.Token
Method argumentsType
argumentsType( self
)
The invocation arguments are the children
following the first child.
Method inputType
inputType( self )
The input type is the type of the arguments,
plus the type of the context. So this is basically equal to
PROCESS(argumentsType, contextType).
Method name
name( self )
Returns the function name for this
invocation
Method run
run( self, program,
parameters='parameters' )
Runs this invocation in the given
program.
Method type
type( self )
The type of an invocation corresponds to the
processing of the context type, returning the corresponding type
defined in the FUNCTIONS table.
Method validate
validate( self,
markOnly='markOnly' )
Undocumented
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method contextAdd
contextAdd( self, element
)
Adds a value to this operation
context.
Method contextType
contextType( self )
Returns the type for this operation
context.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Class Invocation
<class
rugg.language.Invocation at 0x407c386c>
An invocation is the operation that will
look into the Rugg language functions, take the function, and
invoke the function with the parameters found in the invocation
context.
An invocation is (SYMBOL, ANY*)
An invocation is (SYMBOL, ANY*)
Method add
add( self, element )
Undocumented
Method contextAdd
contextAdd( self, element
)
When an element is added to the iteration
context, it will be added to the combination first child
context.
Method run
run( self, program,
parameters='parameters' )
Runs this by iterating through the values
raised by the first operation, and applying them to the
second.
Method type
type( self )
Undocumented
Method validate
validate( self,
markOnly='markOnly' )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method contextType
contextType( self )
Returns the type for this operation
context.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Class Iteration
<class rugg.language.Iteration
at 0x407c389c>
An iteration sequentially applies the
elements of a SET value as parameter to the context of the given
operation.
Structure: VALUE|OPERATION, OPERATION where the VALUE or value returned by the first OPERATION is a SET.
Structure: VALUE|OPERATION, OPERATION where the VALUE or value returned by the first OPERATION is a SET.
Method contextAdd
contextAdd( self, element
)
Adds a value to this operation
context.
Method contextType
contextType( self )
Returns the type for this operation
context.
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method run
run( self, program,
arguments='arguments' )
Runs the element as being part of the given
program. This leads to the execution of the declaration represented
in the program model. It does nothing by default.
Method type
type( self )
Returns the type for this element.
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Operation
<class rugg.language.Operation
at 0x407c383c>
An operation is an ProgramElement that can
produce a value, by doing something. An operation has an associated
_context_ (which one could also called the local environment) that
contains data passed by enclosing operations.
Attributes: context [Value] An operation has no assertion on its children.
Attributes: context [Value] An operation has no assertion on its children.
Method asString
asString( self )
Undocumented
Method type
type( self )
Undocumented
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method run
run( self, program, args='args'
)
Undocumented
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Parameter
<class rugg.language.Parameter
at 0x407c37ac>
A Parameter is a value that is produced by
the enclosing compositor. For instance, the iteration on a range
will add a number parameter to the given operation.
Method Atom
Atom( self )
Atom -> QUANTITY | Range | Operation |
LPAREN Expression RPAREN
Method Expression
Expression( self )
Expression -> Atom ((COLON | PIPE | COMMA
| STAR) Atom)*
Method Operation
Operation( self )
Operation -> WORD (BLAH | WORD | QUANTITY
| RANGE)*
Method Range
Range( self )
Range -> RANGE
Method START
START( self )
START -> Expression
Method init_lexer
init_lexer( self )
Undocumented
Method lineForPos
lineForPos( self, pos='pos'
)
Returns (LINENUM, LINETEXT, LINEPOS) where
LINENUM is the line number of the given position in the parsed
text, LINETEXT the line text, and LINEPOS the position relatively
to the start of the line.
int
0
int(x[, base]) -> integer
Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If the argument is outside the integer range a long object will be returned instead.
Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If the argument is outside the integer range a long object will be returned instead.
Class Parser
<class
'rugg.language.Parser'>
separator space '[\s\n]+'; separator comment
'#.+';
token BLAH 'with|to|in|that|the|of|is|are'; token RANGE '\d+(\w+)?\.\.\d+(\w+)?(/\d+|\+\d+\w+)?'; token QUANTITY '\d+(\.\d+)?(\w\w|\%)?'; token WORD '\w[\w\d]+'; token LPAREN '\('; token RPAREN '\)'; token COMMA '\,'; token COLON '\:'; token PIPE '\|'; token STAR '\*'; token COMMENT_S '\!\-\-'; token COMMENT_E '\-\-\!';
START/s -> $ s = builder.createProgram(self) Expression/e $ s.add(e) $ builder.endProgram() ; Range/r -> RANGE/r $ r = builder.createRange(r) ; Operation/o -> WORD/w $ o = builder.createInvocation(w) ( BLAH | WORD/w $ o.add(builder.createString(w)) | QUANTITY/q $ o.add(builder.createQuantity(q)) | RANGE/r $ o.add(builder.createRange(r)) ) * $ builder.endOperation() ;
Atom/a -> QUANTITY/a $ a = builder.createQuantity(a) | Range/a | Operation/a | LPAREN Expression/a $ a = a $ RPAREN ;
Expression/a -> Atom/a ( ( COLON $ a = builder.createIteration(a) | PIPE $ a = builder.createApplication(a) | COMMA $ a = builder.createCombination(a) | STAR $ a = builder.createRepetition(a) ) Atom/b $ a.add(b) )* ;
token BLAH 'with|to|in|that|the|of|is|are'; token RANGE '\d+(\w+)?\.\.\d+(\w+)?(/\d+|\+\d+\w+)?'; token QUANTITY '\d+(\.\d+)?(\w\w|\%)?'; token WORD '\w[\w\d]+'; token LPAREN '\('; token RPAREN '\)'; token COMMA '\,'; token COLON '\:'; token PIPE '\|'; token STAR '\*'; token COMMENT_S '\!\-\-'; token COMMENT_E '\-\-\!';
START/s -> $ s = builder.createProgram(self) Expression/e $ s.add(e) $ builder.endProgram() ; Range/r -> RANGE/r $ r = builder.createRange(r) ; Operation/o -> WORD/w $ o = builder.createInvocation(w) ( BLAH | WORD/w $ o.add(builder.createString(w)) | QUANTITY/q $ o.add(builder.createQuantity(q)) | RANGE/r $ o.add(builder.createRange(r)) ) * $ builder.endOperation() ;
Atom/a -> QUANTITY/a $ a = builder.createQuantity(a) | Range/a | Operation/a | LPAREN Expression/a $ a = a $ RPAREN ;
Expression/a -> Atom/a ( ( COLON $ a = builder.createIteration(a) | PIPE $ a = builder.createApplication(a) | COMMA $ a = builder.createCombination(a) | STAR $ a = builder.createRepetition(a) ) Atom/b $ a.add(b) )* ;
Method add
add( self, element )
Undocumented
Method cleanup
cleanup( self )
Unlinks all zones registered in this
program.
Method createZone
createZone( self, *args, **kwargs
)
Creates a Zone which will be initialized
with the given arguments.
Method run
run( self, program='program',
arguments='arguments' )
Undocumented
Method type
type( self )
Returns the type for this element.
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Program
<class rugg.language.Program
at 0x407c36bc>
Represents a Rugg program as a whole. The
program has a stack of values, representing the current context
(which is a value). The stack can be manipulated by the program
builder.
Method createApplication
createApplication( self, element
)
Undocumented
Method createCombination
createCombination( self, element
)
Undocumented
Method createInvocation
createInvocation( self, name
)
Undocumented
Method createIteration
createIteration( self, element
)
Undocumented
Method createProgram
createProgram( self, parser
)
Creates a new program. You must call
`endProgram` before calling `createProgram` again.
Method createQuantity
createQuantity( self, quantity
)
Creates a Quantity value.
Method createRange
createRange( self, _range
)
Creates and returns a new Range element, and
adds it to the program stack.
Method createRepetition
createRepetition( self, element
)
Undocumented
Method createString
createString( self, word
)
Creates a Word value.
Method endComment
endComment( self )
Undocumented
Method endOperation
endOperation( self )
Undocumented
Method endProgram
endProgram( self )
Ends the current program, and returns the
`Program` instance that was created by the `createProgram`
call.
Method setOffsets
setOffsets( self, element
)
Sets the offsets of the given element. This
is automatically called on the element creation.
Method startComment
startComment( self )
Undocumented
Class ProgramBuilder
<class
rugg.language.ProgramBuilder at 0x407c395c>
The ProgramBuilder is the main interface,
drive by the parser, to create Rugg programs. You can also drive
the ProgramBuilder "by hand" to build Rugg program from Python
scripts.
NOTE: program builders are not threadsafe, which means that you cannot share a single program builder instance between different threads. Create a new one instead for each thread.
NOTE: program builders are not threadsafe, which means that you cannot share a single program builder instance between different threads. Create a new one instead for each thread.
Method add
add( self, element )
Undocumented
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method run
run( self, program,
arguments='arguments' )
Runs the element as being part of the given
program. This leads to the execution of the declaration represented
in the program model. It does nothing by default.
Method type
type( self )
Returns the type for this element.
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class ProgramElement
<class
rugg.language.ProgramElement at 0x407c36ec>
An element that belong to a particular
program.
Method run
run( self, program, args='args'
)
Undocumented
Method type
type( self )
Undocumented
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Undocumented
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Quantity
<class rugg.language.Quantity
at 0x407c377c>
Represents a quantity.
Method run
run( self, program, args='args'
)
Undocumented
Method type
type( self )
Undocumented
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Undocumented
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Range
<class rugg.language.Range at
0x407c380c>
A Range is a set of values (and is also a
value).
Method add
add( self, element )
Undocumented
Method run
run( self, program,
parameters='parameters' )
Runs this by iterating through the values
raised by the first operation, and applying them to the
second.
Method type
type( self )
Undocumented
Method validate
validate( self,
markOnly='markOnly' )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Returns a string representing the element.
NOTE: When you subclass this function, make sure it never fails, as
the Program tree must be printed when an exception has occured, to
let the user know what went wrong with the program.
Method contextAdd
contextAdd( self, element
)
Adds a value to this operation
context.
Method contextType
contextType( self )
Returns the type for this operation
context.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Class Repetition
<class
rugg.language.Repetition at 0x407c38fc>
A repetition "absorbs its first argument",
and repeats the attached operation the number of time described by
the first argument.
Method type
type( self )
Undocumented
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Undocumented
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method run
run( self, program, args='args'
)
Undocumented
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class String
<class rugg.language.String at
0x407c374c>
Rerpresents a string.
Method type
type( self )
Undocumented
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method asString
asString( self )
Undocumented
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method run
run( self, program, args='args'
)
Undocumented
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Symbol
<class rugg.language.Symbol at
0x407c37dc>
A Symbol is a string that represents an
element of the program, wether available in the program context, or
available in the internal program runtime. Symbols are typically
used to represent functions by their names, so Symbols are simply
strings.
Method asString
asString( self )
Undocumented
Method run
run( self, program, args='args'
)
Undocumented
Method add
add( self, element )
Undocumented
Method annotateChild
annotateChild( self, child, index
)
Allows to annotate the child element at the
given index. For instance, the first child of an operation is
called the "operation name", then the rest are arguments. This
allows this information to be printed on the tree.
Method error
error( self, exception
)
Declares that an error was detected with
this element, and adds it to the 'errors' attribute of this
element.
Method errorsAsString
errorsAsString( self
)
Returns a string containing all the errors
for this element. This will be printed with the element in its
string representation.
Method program
program( self, program='program'
)
Sets/gets the program associated to this
element.
Method type
type( self )
Returns the type for this element.
Method validate
validate( self,
markOnly='markOnly' )
Ensures that the element is semantically
consistent. A typical use is to check if the arguments given to a
function are of the proper type. When a problem occurs, a
SemanticException can be raised.
Class Value
<class rugg.language.Value at
0x407c371c>
A value represents elements that can be
directly converted to values, and can be processed by operations.
Values do not have children.
Attributes: value Element|str children ()
Attributes: value Element|str children ()
Function createParser
createParser( )
Creates the parse for the Rugg mini
language. This is an internal method that creates a TPG or
PyParsing parser.
Function parseFile
parseFile( path, run='run',
validate='validate', display='display' )
Parses the give file.
Function parseString
parseString( text, run='run',
validate='validate', display='display' )
Parses the given string of text and returns
an object model representing the program.
Function printError
printError( name, description,
pos='pos', pos_end='pos_end' )
Helper function used by parseString to
report when an error has occured.
Function runFile
runFile( text )
Undocumented
Function runString
runString( text )
Undocumented
Function type_format
type_format( the_type
)
Formats the given type to be printed on a
terminal. If the type is UNKNOWN, it will be printed in RED,
otherwise in GREEN.
str
'BK'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'BL'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'BOLD'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'BW'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
dict
{'REBOLD': '01;31', 'MG':
'00;35', 'GR': '00;32', 'BKBOLD': '01;30', 'MGBOLD': '01;35', 'BL':
'00;34', 'BWBOLD': '01;33', 'BK': '00;30', 'RE': '00;31', 'CY':
'00;36', 'BW': '00;33', 'GRBOLD': '01;32', 'BLBOLD': '01;34',
'CYBOLD': '01;36'}
dict() -> new empty dictionary.
dict(mapping) -> new dictionary initialized from a mapping
object's (key, value) pairs. dict(seq) -> new dictionary
initialized as if via: d = {} for k, v in seq: d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value
pairs in the keyword argument list. For example: dict(one=1,
two=2)
str
'CY'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'GR'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
str
'MG'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Parser
<rugg.language.Parser object
at 0x407cb86c>
separator space '[\s\n]+'; separator comment
'#.+';
token BLAH 'with|to|in|that|the|of|is|are'; token RANGE '\d+(\w+)?\.\.\d+(\w+)?(/\d+|\+\d+\w+)?'; token QUANTITY '\d+(\.\d+)?(\w\w|\%)?'; token WORD '\w[\w\d]+'; token LPAREN '\('; token RPAREN '\)'; token COMMA '\,'; token COLON '\:'; token PIPE '\|'; token STAR '\*'; token COMMENT_S '\!\-\-'; token COMMENT_E '\-\-\!';
START/s -> $ s = builder.createProgram(self) Expression/e $ s.add(e) $ builder.endProgram() ; Range/r -> RANGE/r $ r = builder.createRange(r) ; Operation/o -> WORD/w $ o = builder.createInvocation(w) ( BLAH | WORD/w $ o.add(builder.createString(w)) | QUANTITY/q $ o.add(builder.createQuantity(q)) | RANGE/r $ o.add(builder.createRange(r)) ) * $ builder.endOperation() ;
Atom/a -> QUANTITY/a $ a = builder.createQuantity(a) | Range/a | Operation/a | LPAREN Expression/a $ a = a $ RPAREN ;
Expression/a -> Atom/a ( ( COLON $ a = builder.createIteration(a) | PIPE $ a = builder.createApplication(a) | COMMA $ a = builder.createCombination(a) | STAR $ a = builder.createRepetition(a) ) Atom/b $ a.add(b) )* ;
token BLAH 'with|to|in|that|the|of|is|are'; token RANGE '\d+(\w+)?\.\.\d+(\w+)?(/\d+|\+\d+\w+)?'; token QUANTITY '\d+(\.\d+)?(\w\w|\%)?'; token WORD '\w[\w\d]+'; token LPAREN '\('; token RPAREN '\)'; token COMMA '\,'; token COLON '\:'; token PIPE '\|'; token STAR '\*'; token COMMENT_S '\!\-\-'; token COMMENT_E '\-\-\!';
START/s -> $ s = builder.createProgram(self) Expression/e $ s.add(e) $ builder.endProgram() ; Range/r -> RANGE/r $ r = builder.createRange(r) ; Operation/o -> WORD/w $ o = builder.createInvocation(w) ( BLAH | WORD/w $ o.add(builder.createString(w)) | QUANTITY/q $ o.add(builder.createQuantity(q)) | RANGE/r $ o.add(builder.createRange(r)) ) * $ builder.endOperation() ;
Atom/a -> QUANTITY/a $ a = builder.createQuantity(a) | Range/a | Operation/a | LPAREN Expression/a $ a = a $ RPAREN ;
Expression/a -> Atom/a ( ( COLON $ a = builder.createIteration(a) | PIPE $ a = builder.createApplication(a) | COMMA $ a = builder.createCombination(a) | STAR $ a = builder.createRepetition(a) ) Atom/b $ a.add(b) )* ;
str
'RE'
str(object) -> string
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
Return a nice string representation of the object. If the argument is a string, the return value is the same object.
instance
<rugg.language.ProgramBuilder
instance at 0x407c6c6c>
The ProgramBuilder is the main interface,
drive by the parser, to create Rugg programs. You can also drive
the ProgramBuilder "by hand" to build Rugg program from Python
scripts.
NOTE: program builders are not threadsafe, which means that you cannot share a single program builder instance between different threads. Create a new one instead for each thread.
NOTE: program builders are not threadsafe, which means that you cannot share a single program builder instance between different threads. Create a new one instead for each thread.
Module rugg.language
<module 'rugg.language' from
'/usr/local/lib/python2.4/site-packages/rugg/language.pyc'>
Undocumented
Class CachedProducer
<class
rugg.core.CachedProducer at 0x406e55fc>
A cached producer generates a certain amount
of data and picks its data from the cache. This allows to speed up
the throughput and do actual benchmarking.
To generate a cached producer simply do CachedProducer(randomTextProducer), or with whatever producer you prefer.
To generate a cached producer simply do CachedProducer(randomTextProducer), or with whatever producer you prefer.
Method _createDescriptors
_createDescriptors( self
)
This method is invoked by the constructor
and creates the file descriptors (by default, one read and one
write for the given path). This should be overriden if different
behaviours are expected.
Method availableSpace
availableSpace( self
)
Returns the available space (in bytes) for
writing this file.
Method canWrite
canWrite( self )
Returns the number of bytes that can be
written until the size limit is reached. This returns -1 if there
is no limit set.
Method data
data( self )
Returns the content of this file as data.
The current read offset is preserved
Method flush
flush( self )
Flushes the buffers.
Method limitSize
limitSize( self, sizeLimit
)
Sets a limit to this file size.
Method path
path( self )
Returns the path for this File.
Method produce
produce( self, length='length'
)
This method can be used as a producer, and
will return the content of this file from the current reading
position.
Method read
read( self, length='length'
)
Reads a segment of data of the given length
and returns it. If an empty string is returned, then no value was
read.
Method rseek
rseek( self, offset
)
Moves the read fd to the given offset.
Method rtell
rtell( self )
Undocumented
Method seek
seek( self, offset )
Moves both read and write offsets to the
given offset.
Method sig
sig( self )
Returns the SHA-1 signature for this
file.
Method size
size( self )
Returns the current size of this file, in
bytes.
Method sizeLimit
sizeLimit( self )
Returns the size limit for this file. -1
means that the file has no size limit, otherwise file size limit is
expressed in bytes.
Method unlink
unlink( self )
Unlinks this file. This closes the opened
file descriptors and deletes the files from the filesystem.
Method write
write( self, data )
Writes the given data to this file. Returns
the actual number of written bytes.
Method wseek
wseek( self, offset
)
Moves the write fd to the given
offset.
Method wtell
wtell( self )
Undocumented
Class File
<class rugg.core.File at
0x406e565c>
Files objects are a simple abstraction that
easily allow to read, write, seek and unlink files. These are the
objects used to access the filesystem and to harness the hard
drives.
Class FileError
<class rugg.core.FileError at
0x406e550c>
Abstract class for file-related
errors.
Class Limits
<class rugg.core.Limits at
0x406e55cc>
The Limits class defines limits that will
constrain the operations defined in this modules. Limits allow to
prevent the operation from overflowing or causing problem with the
underlying operating systems. Limits are used to determine the
maximum number of file descriptors, or the maximum length of data
producer by a producer at a time.
Attributes: MAX_FD Maxium number of file descriptors openened at once MAX_PRODUCED_DATA Maximum length of data produced by a producer
Attributes: MAX_FD Maxium number of file descriptors openened at once MAX_PRODUCED_DATA Maximum length of data produced by a producer
Class OperationalError
<class
rugg.core.OperationalError at 0x406e559c>
Indicates than an operation (ensure, fill,
etc) did not work as expected.
Class ReadError
<class rugg.core.ReadError at
0x406e553c>
Indicates that a read operation did not work
as expected.
Method _iterate
_iterate( self )
Undocumented
Method cleanConsumer
cleanConsumer( self, consumer
)
Calles at the very end, when the consumer
does not which to consume data anymore.
Method consume
consume( self, consumer
)
This is a (blocking) operation that produces
the data. When all the data is produced this returns None
Method consumerFinished
consumerFinished( self, consumer
)
This MUST be called by the consumer after
each time it properly consumed data. This SHOULD NOT be called when
the data returned is (None, 0).
Method declareConsumer
declareConsumer( self, consumer
)
This has to be called at the beginning by
each consumer.
Method isConsumerDeclared
isConsumerDeclared( self,
consumer )
Undocumented
Method reset
reset( self )
Undocumented
Class SharedProducer
<class
rugg.core.SharedProducer at 0x406e562c>
This class allows to wrap a producer so that
the same data can be consumed by a given number of threds. This is
vital to the 'fill same' operation in multi-threaded
contexts.
Method size
size( self )
Returns the current size of this file, in
bytes.
Method unlink
unlink( self )
Unlinking Zone files has no side-effect, as
the file descriptors are borrowed from the parent zone
Method zone
zone( self )
Returns the zone to which this subzone
comes.
Method _createDescriptors
_createDescriptors( self
)
This method is invoked by the constructor
and creates the file descriptors (by default, one read and one
write for the given path). This should be overriden if different
behaviours are expected.
Method availableSpace
availableSpace( self
)
Returns the available space (in bytes) for
writing this file.
Method canWrite
canWrite( self )
Returns the number of bytes that can be
written until the size limit is reached. This returns -1 if there
is no limit set.
Method data
data( self )
Returns the content of this file as data.
The current read offset is preserved
Method flush
flush( self )
Flushes the buffers.
Method limitSize
limitSize( self, sizeLimit
)
Sets a limit to this file size.
Method path
path( self )
Returns the path for this File.
Method produce
produce( self, length='length'
)
This method can be used as a producer, and
will return the content of this file from the current reading
position.
Method read
read( self, length='length'
)
Reads a segment of data of the given length
and returns it. If an empty string is returned, then no value was
read.
Method rseek
rseek( self, offset
)
Moves the read fd to the given offset.
Method rtell
rtell( self )
Undocumented
Method seek
seek( self, offset )
Moves both read and write offsets to the
given offset.
Method sig
sig( self )
Returns the SHA-1 signature for this
file.
Method sizeLimit
sizeLimit( self )
Returns the size limit for this file. -1
means that the file has no size limit, otherwise file size limit is
expressed in bytes.
Method write
write( self, data )
Writes the given data to this file. Returns
the actual number of written bytes.
Method wseek
wseek( self, offset
)
Moves the write fd to the given
offset.
Method wtell
wtell( self )
Undocumented
Class SubZone
<class rugg.core.SubZone at
0x406e56bc>
A Zone file is a file that leaves within a
zone. It has the same interface as the File object.
Class WriteError
<class rugg.core.WriteError at
0x406e556c>
Indicates that a write operation did not
work as expected.
Method join
join( self )
This is the opposite of divide: it joins
every subzone together, so that this zone is a single zone.
Method size
size( self )
Returns the current size of this file, in
bytes.
Method subdivide
subdivide( self, number
)
Divides the zones into the given number of
subzones. Starting from that moment, and until join is invoked, all
operations will be made on all subzones. An array of SubZones
representing the subzones themselves is given, and can be
manipulated as regular files.
Method subzone
subzone( self, baseOffset, length
)
Creates a subzone with the given base offset
and the given length. There is no checking for wether the subzone
overlaps with an existing one, so you should take care of
that.
Method subzones
subzones( self )
Returns the subzones that were created when
this zone was divided, if it was divided.
Method _createDescriptors
_createDescriptors( self
)
This method is invoked by the constructor
and creates the file descriptors (by default, one read and one
write for the given path). This should be overriden if different
behaviours are expected.
Method availableSpace
availableSpace( self
)
Returns the available space (in bytes) for
writing this file.
Method canWrite
canWrite( self )
Returns the number of bytes that can be
written until the size limit is reached. This returns -1 if there
is no limit set.
Method data
data( self )
Returns the content of this file as data.
The current read offset is preserved
Method flush
flush( self )
Flushes the buffers.
Method limitSize
limitSize( self, sizeLimit
)
Sets a limit to this file size.
Method path
path( self )
Returns the path for this File.
Method produce
produce( self, length='length'
)
This method can be used as a producer, and
will return the content of this file from the current reading
position.
Method read
read( self, length='length'
)
Reads a segment of data of the given length
and returns it. If an empty string is returned, then no value was
read.
Method rseek
rseek( self, offset
)
Moves the read fd to the given offset.
Method rtell
rtell( self )
Undocumented
Method seek
seek( self, offset )
Moves both read and write offsets to the
given offset.
Method sig
sig( self )
Returns the SHA-1 signature for this
file.
Method sizeLimit
sizeLimit( self )
Returns the size limit for this file. -1
means that the file has no size limit, otherwise file size limit is
expressed in bytes.
Method unlink
unlink( self )
Unlinks this file. This closes the opened
file descriptors and deletes the files from the filesystem.
Method write
write( self, data )
Writes the given data to this file. Returns
the actual number of written bytes.
Method wseek
wseek( self, offset
)
Moves the write fd to the given
offset.
Method wtell
wtell( self )
Undocumented
Class Zone
<class rugg.core.Zone at
0x406e568c>
A Zone is a specific file with a specific
given size which can be divided into multiple SubZones. This allows
to tests specific locations on the filesystem by creating 'virtual
files' within one big file.
Function GB
GB( size )
Returns the number of gigabytes in
bytes
Function KB
KB( size )
Returns the number of kilobytes in
bytes
Function MB
MB( size )
Returns the number of megabytes in
bytes
Function TB
TB( size )
Returns the number of terabytes in
bytes
Function _initTextSources
_initTextSources( )
Undocumented
Function _pickData
_pickData( paths, length
)
Picks a file from the given list of paths,
and returns at most the given length. If there was a problem with
the given file (cannot be read, or does not exist), then None is
returned.
Function blankProducer
blankProducer( length
)
Returns a chunk of data of the given length,
or of a length equal to LIMITS.MAX_PRODUCED_DATA if length is too
big. The data and its lengths are returned anyway.
Function freespace
freespace( path='path'
)
Undocumented
Function generate_path
generate_path( prefix='prefix',
suffix='suffix', parent='parent' )
Undocumented
Function parseSize
parseSize( text )
Parses the given size as a string and
returns the size in bytes
Function randomBinaryProducer
randomBinaryProducer( length
)
Returns a chunk of data of the given length,
or of a length equal to LIMITS.MAX_PRODUCED_DATA if length is too
big. The data and its lengths are returned anyway.
Function randomNumberProducer
randomNumberProducer( length
)
Returns a chunk of data of the given length,
or of a length equal to LIMITS.MAX_PRODUCED_DATA if length is too
big. The data and its lengths are returned anyway.
Function randomTextProducer
randomTextProducer( length
)
Returns a chunk of data of the given length,
or of a length equal to LIMITS.MAX_PRODUCED_DATA if length is too
big. The data and its lengths are returned anyway.
Function randomWordsProducer
randomWordsProducer( length
)
Returns a chunk of data of the given length,
or of a length equal to LIMITS.MAX_PRODUCED_DATA if length is too
big. The data and its lengths are returned anyway.
Function rseek
rseek( files, offset
)
Undocumented
Function seek
seek( files, offset
)
Undocumented
Function wseek
wseek( files, offset
)
Undocumented
instance
<rugg.core.Limits instance at
0x406eb3cc>
The Limits class defines limits that will
constrain the operations defined in this modules. Limits allow to
prevent the operation from overflowing or causing problem with the
underlying operating systems. Limits are used to determine the
maximum number of file descriptors, or the maximum length of data
producer by a producer at a time.
Attributes: MAX_FD Maxium number of file descriptors openened at once MAX_PRODUCED_DATA Maximum length of data produced by a producer
Attributes: MAX_FD Maxium number of file descriptors openened at once MAX_PRODUCED_DATA Maximum length of data produced by a producer
SRE_Pattern
<_sre.SRE_Pattern object at
0x82f8b80>
Compiled regular expression objects
list
[]
list() -> new list list(sequence) ->
new list initialized from sequence's items
dict
{'KB': <function KB at
0x406e26f4>, 'MB': <function MB at 0x406e26bc>, 'MO':
<function MB at 0x406e26bc>, 'KO': <function KB at
0x406e26f4>, 'TO': <function TB at 0x406e2764>, 'GB':
<function GB at 0x406e272c>, 'GO': <function GB at
0x406e272c>, 'TB': <function TB at
0x406e2764>}
dict() -> new empty dictionary.
dict(mapping) -> new dictionary initialized from a mapping
object's (key, value) pairs. dict(seq) -> new dictionary
initialized as if via: d = {} for k, v in seq: d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value
pairs in the keyword argument list. For example: dict(one=1,
two=2)
dict
{}
dict() -> new empty dictionary.
dict(mapping) -> new dictionary initialized from a mapping
object's (key, value) pairs. dict(seq) -> new dictionary
initialized as if via: d = {} for k, v in seq: d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value
pairs in the keyword argument list. For example: dict(one=1,
two=2)
Module rugg.core
<module 'rugg.core' from
'/usr/local/lib/python2.4/site-packages/rugg/core.pyc'>
Undocumented
Method _dispatch
_dispatch( self, operation,
argSignature )
Undocumented
Method benchmark
benchmark( self,
something='something' )
Undocumented
Method blank
blank( self, zone )
Undocumented
Method context
context( self, name='name',
**kwargs )
Queries the given element of the current
context or adds the given key/values to the current context.
Method endContext
endContext( self )
Ends the context that was previously created
by the 'startContext'
Method ensure
ensure( self, *args
)
Undocumented
Method ensureBlank
ensureBlank( self, files,
opposite='opposite', blocksize='blocksize' )
Undocumented
Method ensureSame
ensureSame( self, files,
opposite='opposite', blocksize='blocksize' )
Undocumented
Method error
error( self, message
)
Undocumented
Method fill
fill( self, f, length='length',
blocksize='blocksize', producer='producer', log='log'
)
Undocumented
Method fill_argstokwargs
fill_argstokwargs( self, args
)
Utility function that converts the given
string arguments as a dict that can be used as kwargs to the
core.fill operation.
Method fill_typeWithZones
fill_typeWithZones( self, *args,
**pkwargs )
Undocumented
Method generate
generate( self, f,
length='length', blocksize='blocksize', producer='producer'
)
Undocumented
Method indent
indent( self, text, length,
firstline )
Undocumented
Method invoke
invoke( self, operation,
argsignatures, arguments )
Invokes the given operation with the given
arguments. The arguments must be actual ProgramModel Values, and
must be able to return a type.
Method join
join( self, zones )
Undocumented
Method listOperations
listOperations( self
)
Returns a list of couples ("operation name",
"method").
Method log
log( self, message )
Undocumented
Method register
register( self )
Should be called after the instanciation.
Will register all functions that have been decorated with
@method.
Method returnType
returnType( self, operation,
argsignatures )
Undocumented
Method sig
sig( self, zone )
Undocumented
Method start
start( self )
Program started.
Method startContext
startContext( self, **kwargs
)
Starts a new subcontext in the environment.
A context can be used by the operations to save run-time state
data.
Method subdivide
subdivide( self, zone, quantity
)
Undocumented
Method subdivide_alt
subdivide_alt( self, quantity,
zone )
Undocumented
Method time
time( self, something='something'
)
Undocumented
Method unlink
unlink( self, zone )
Undocumented
Method zone
zone( self, quantity
)
Undocumented
Method zone_array
zone_array( self, quantities
)
Undocumented
Class Environment
<class
rugg.operations.Environment at 0x407c365c>
The operations environment is a class that
encapsulates all operations defined in the language. It offers a
simple framework to implement what is defined in the
language.
Function method
method( *types )
Decorates the given function by associating
to it a dispatching type.
Module rugg.operations
<module 'rugg.operations' from
'/usr/local/lib/python2.4/site-packages/rugg/operations.pyc'>
The operations module defines an Environment
class that contains all the operations. It is automatically
instanciated by a program (in the language module).
What is interesting is that the Environment allows to very easily bind operations between Rugg and Python. You simply have to decorate an Environment method with the @method decorator, which will explicitely indicate the method signatures (we take advantage of Python flexible typing).
What is interesting is that the Environment allows to very easily bind operations between Rugg and Python. You simply have to decorate an Environment method with the @method decorator, which will explicitely indicate the method signatures (we take advantage of Python flexible typing).
Class OperationDoesNotRespond
<class
rugg.typesystem.OperationDoesNotRespond at
0x406e5f8c>
Undocumented
Class RuggError
<class
rugg.typesystem.RuggError at 0x406e574c>
Undocumented
Class RuntimeError
<class
rugg.typesystem.RuntimeError at 0x406e5aac>
An exception that is thrown when a runtime
error was detected.
Class SemanticError
<class
rugg.typesystem.SemanticError at 0x406e58cc>
An exception that is thrown when a semantic
error was detected.
Class UndefinedOperation
<class
rugg.typesystem.UndefinedOperation at 0x406e5b0c>
Undocumented
Function combineArguments
combineArguments( a, b
)
Undocumented
Function makeArguments
makeArguments( args
)
Undocumented
Module rugg.typesystem
<module 'rugg.typesystem' from
'/usr/local/lib/python2.4/site-packages/rugg/typesystem.pyc'>
Undocumented
API
generated with SDoc