| Home | Trees | Index | Help |
|
|---|
| Package lyntin :: Module utils |
|
| Classes | |
|---|---|
PriorityQueue |
This is a pretty basic priority queue. |
| Function Summary | |
|---|---|
Takes in a dict of keys to values and prints out a graph accordingly. | |
| string |
Removes all CR and LF from the end of the input string. |
| string |
Takes a list of data and converts it into a series of columns and rows that are evenly spaced and pretty and stuff. |
| Re |
Takes in a string and compiles it into a regular expression. |
| int |
Returns 1 if true, 0 if false, or -1 if it's not a boolean. |
| string |
Replaces all the nested variables with appropriate variables. |
| string |
Takes in a string and escapes all \ (single backslash) by one level (turning it into a double backslash) and all $ (single dollar sign) by one level (turning it into a single backslash and a single dollar sign). |
| string |
Takes an user input line and an alias expansion and hands it off to the appropriate function for evaluating the placement variable replacement. |
| list of strings |
Returns a subset of the list that matches the given string. |
| string |
Note: If you have a text string and you want the variable manager to expand variables in that string according to session variables, use 'exported.expand_ses_vars' instead. |
| string |
Filters out ^M. |
| string |
Takes in a directory (datadir, moduledir, ...) and fixes it (by adding an os.sep to the end) as well as verifies that it exists. |
| string |
Retrieves the data at a given url and returns it as a big string. |
| list of tuples of (string, string) |
Takes in a list of args and parses it out into a hashmap of arg-name to value(s). |
| int |
Parses a time into the number of seconds since the epoch. |
| int |
Parses a timsspan into a number of seconds. |
| list of strings |
This method takens in text and parses it into separate commands on the ;. |
| string |
Returns text after stripping the braces around the text. |
| string |
It takes a block of text and wraps it nicely. |
Handles the actual denesting for different variable types depending on the varchar passed in. | |
| int |
Figures out where the next break should be while word-wrapping. |
| string |
Takes a list and a var and figures out what the placement var is based on the inputsplit list. |
| list of strings |
Returns a list of all the variables in a string. |
| Variable Summary | |
|---|---|
SRE_Pattern |
CHOMP_EOL = [\r\n]+$
|
SRE_Pattern |
PVAR_REGEXP = %+(-?(\d+):?-?(\d*)|:-?(\d+))
|
SRE_Pattern |
REG_REGEXP = ^(r\[.*?)(\$?\][Ii]*)$
|
SRE_Pattern |
SEMI_REGEXP = (?!\\);
|
SRE_Pattern |
SUBVAR_REGEXP = %_?[0-9]+
|
SRE_Pattern |
TIME_REGEXP1 = ^([1-9]|1[0-2])([ap])$
|
SRE_Pattern |
TIME_REGEXP2 = ^([1-9]|1[0-2]):([0-5][0-9])(:([0-5]\d))?...
|
SRE_Pattern |
TIME_REGEXP3 = ^(0|1[3-9]|2[0-3]):([0-5][0-9])(:([0-5]\d...
|
SRE_Pattern |
TIMESPAN_REGEXP = ^(\d+d)?(\d+h)?(\d+m)?(\d+s?)?$
|
| Function Details |
|---|
build_graph(numbers_dict)Takes in a dict of keys to values and prints out a graph accordingly. |
chomp(text)Removes all CR and LF from the end of the input string.
|
columnize(textlist, screenwidth=72, indent=0)Takes a list of data and converts it into a series of columns and rows that are evenly spaced and pretty and stuff.
|
compile_regexp(text, anchors=0, stars=0)Takes in a string and compiles it into a regular expression. This is for commands that take in strings that can be compiled either as a full-fledged regular expression (using Perl5 regexp syntax) or strings that are not regular expressions and use * as a wildcard character.
|
convert_boolean(text)Returns 1 if true, 0 if false, or -1 if it's not a boolean.
|
denest_vars(text, varmap)Replaces all the nested variables with appropriate variables.
|
escape(s)Takes in a string and escapes all \ (single backslash) by one level (turning it into a double backslash) and all $ (single dollar sign) by one level (turning it into a single backslash and a single dollar sign).
|
expand_placement_vars(input, expansion)Takes an user input line and an alias expansion and hands it off to the appropriate function for evaluating the placement variable replacement. Takes an input and an expansion and replaces expansion variables with the components from the input. Returns the finalized string.
|
expand_text(filter, fulllist)Returns a subset of the list that matches the given string. Takes a list and a string and returns a list of items in the original list that match the given string. Handles * and anchors too.
|
expand_vars(text, varmap)Note: If you have a text string and you want the variable manager to expand variables in that string according to session variables, use 'exported.expand_ses_vars' instead. The following functions are used in the command processing pipeline at different points:
Note that the variablemanager's "expand" function is used for general expansion of text when there won't be a recursion on the partially expanded (but not yet denested) text. It consists of chaining expand_vars and denest_vars together. Looks at user input and expands any variables involved using the Lyntin variable expansion methodology. Lyntin variable expansion works by replacing all instances of $blah with the appropriate variable. Then at a later point, variables preceded by multiple $ are denested one scope and lose a $. It returns the (un)adjusted text.
|
filter_cm(text)Filters out ^M. Useful for logging.
|
fixdir(d)Takes in a directory (datadir, moduledir, ...) and fixes it (by adding an os.sep to the end) as well as verifies that it exists. If it does not exist, then it returns a None. If it does exist, then it returns the adjusted directory name.
|
http_get(url)Retrieves the data at a given url and returns it as a big string.
|
parse_args(args)Takes in a list of args and parses it out into a hashmap of arg-name to value(s).
|
parse_time(timearg)Parses a time into the number of seconds since the epoch. First attempts to parse as a time of day, and if that fails attempts to parse as a timespan. Timespans are interpretted as times from time.time() (now).
|
parse_timespan(timespan)Parses a timsspan into a number of seconds.
|
split_commands(text)This method takens in text and parses it into separate commands on the ;. It accounts for \; as well as ; in { } which indicate that we shouldn't be splitting there.
|
strip_braces(text)Returns text after stripping the braces around the text. If the incoming text has a { at the beginning and a } at the end, it removes the braces.
|
wrap_text(textlist, wraplength=50, indent=0, firstline=0)It takes a block of text and wraps it nicely. It accounts for indenting lines of text, wraplengths, and wrapping around ANSI colors. We break on carriage returns (those are easy) and if no carriage returns are available we break on spaces. If the actual line is longer than the wraplength, then we'll break in the line at the wraplength--this will cut words in two. Note: we don't expand tabs or backspaces. Both count as one character.
|
_denest_vars_worker(varchar, text)Handles the actual denesting for different variable types depending on the varchar passed in. |
_find_next_break(token, marker, wrapcount, wraplength)Figures out where the next break should be while word-wrapping.
|
_get_variable_value(inputsplit, var)Takes a list and a var and figures out what the placement var is based on the inputsplit list.
|
_strip_placement_vars(text)Returns a list of all the variables in a string.
|
| Variable Details |
|---|
CHOMP_EOL
|
PVAR_REGEXP
|
REG_REGEXP
|
SEMI_REGEXP
|
SUBVAR_REGEXP
|
TIME_REGEXP1
|
TIME_REGEXP2
|
TIME_REGEXP3
|
TIMESPAN_REGEXP
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Mon Aug 9 09:17:41 2004 | http://epydoc.sf.net |