$Id: DT_Util.py,v 1.66.10.3 2000/07/05 15:54:20 shane Exp $
Imported modules
|
|
import VSEval
import math
import os
import regex
from string import strip, join, atoi, lower, split, find
import whrandom
|
Functions
|
|
|
|
careful_getattr
|
careful_getattr (
md,
inst,
name,
default=_marker,
)
|
|
careful_getitem
|
careful_getitem (
md,
mapping,
key,
)
|
|
careful_getslice
|
careful_getslice (
md,
seq,
*indexes,
)
|
|
careful_hasattr
|
careful_hasattr (
md,
inst,
name,
)
|
|
careful_pow
|
careful_pow (
self,
x,
y,
z,
)
|
|
careful_range
|
careful_range (
md,
iFirst,
*args,
)
|
|
html_quote
|
html_quote (
v,
name='(Unknown name)',
md={},
character_entities=((( '&' ), '&' ), (( '<' ), '<' ), (( '>' ), '>' ), (( '\213' ), '<' ), (( '\233' ), '>' ), (( '"' ), '"' ) ),
)
|
|
int_param
|
int_param (
params,
md,
name,
default=0,
st=type( '' ),
)
|
|
name_param
|
name_param (
params,
tag='',
expr=0,
attr='name',
default_unnamed=1,
)
|
|
namespace
|
namespace ( self, **kw )
Create a tuple consisting of a single instance whose attributes are
provided as keyword arguments.
|
|
obsolete_attr
|
obsolete_attr (
self,
inst,
name,
md,
)
|
|
parse_params
|
parse_params (
text,
result=None,
tag='',
unparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)\)' ),
qunparmre=regex.compile( '\([\0- ]*\("[^"]*"\)\)' ),
parmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)=\([^\0- =\"]+\)\)' ),
qparmre=regex.compile( '\([\0- ]*\([^\0- =\"]+\)="\([^"]*\)\"\)' ),
**parms,
)
Parse tag parameters
The format of tag parameters consists of 1 or more parameter
specifications separated by whitespace. Each specification
consists of an unnamed and unquoted value, a valueless name, or a
name-value pair. A name-value pair consists of a name and a
quoted or unquoted value separated by an = .
The input parameter, text, gives the text to be parsed. The
keyword parameters give valid parameter names and default values.
If a specification is not a name-value pair and it is not the
first specification and it is a
valid parameter name, then it is treated as a name-value pair with
a value as given in the keyword argument. Otherwise, if it is not
a name-value pair, it is treated as an unnamed value.
The data are parsed into a dictionary mapping names to values.
Unnamed values are mapped from the name "" . Only one value may
be given for a name and there may be only one unnamed value.
|
|
render
|
render (
self,
v,
simple={ type( '' ) : 1, type( 0 ) : 1, type( 0.0 ) : 1, type([] ) : 1, type(() ) : 1, },
)
Render an object in the way done be the name attribute
|
|
reorder
|
reorder (
self,
s,
with=None,
without=(),
)
|
|
test
|
test ( self, *args )
|
Classes
|
|
|
|