Trees | Indices | Help |
|
---|
|
Utility functions for manipulating or working with text.
|
|||
ShellWriter Helper class to write scripts with indentation. |
|||
LineSplitter Splits data chunks into lines separated by newline. |
|
|||
None or str |
|
||
|
|||
string |
|
||
str |
|
||
|
|||
str |
|
||
str |
|
||
|
|||
str |
|
||
|
|||
|
|||
string |
|
||
string |
|
||
str |
|
||
string |
|
||
string |
|
||
|
|||
|
|||
string |
|
||
boolean |
|
||
str |
|
||
string |
|
||
string |
|
||
list |
|
||
list of string |
|
Imports: re, os, time, collections, errors, compat
|
Try to match a name against a list. This function will try to match a name like test1 against a list like
|
Helper function for DnsNameGlobPattern. Returns regular expression pattern for parts of the pattern. |
Generates regular expression from DNS name globbing pattern. A DNS name globbing pattern (e.g. Matching always starts at the leftmost part. An asterisk (*) matches all characters except the dot (.) separating DNS name parts. A question mark (?) matches a single character except the dot (.).
|
Formats an incoming number of MiB with the appropriate unit.
|
Tries to extract number and scale from the given string. Input must be in the format |
Quotes shell argument according to POSIX.
|
Quotes a list of shell arguments.
|
Generates a random secret. This will generate a pseudo-random secret returning an hex string (so that it can be used where an ASCII string is needed).
|
Builds a regular expression for verifying MAC addresses.
|
Checks a MAC address using a regular expression.
|
Normalizes and check if a MAC address is valid and contains six octets. Checks whether the supplied MAC address is formally correct. Accepts colon-separated format only. Normalize it to all lower case.
|
Normalizes a potential MAC address prefix (three octets). Checks whether the supplied string is a valid MAC address prefix consisting of three colon-separated octets. The result is normalized to all lower case.
|
Return a 'safe' version of a source string. This function mangles the input string and returns a version that should be safe to display/encode as ASCII. To this end, we first convert it to ASCII using the 'backslashreplace' encoding which should get rid of any non-ASCII chars, and then we process it through a loop copied from the string repr sources in the python; we don't use string_escape anymore since that escape single quotes and backslashes too, and that is too much; and that escaping is not stable, i.e. string_escape(string_escape(x)) != string_escape(x).
|
Split and unescape a string based on a given separator. This function splits a string based on a separator where the separator itself can be escape in order to be an element of the elements. The escaping rules are (assuming coma being the separator):
|
Encode a list in a way parsable by UnescapeAndSplit.
|
Nicely join a set of identifiers.
|
Formats a time value.
|
Formats seconds for easier reading.
|
Verifies is the given word is safe from the shell's p.o.v. This means that we can pass this to a command via the shell and be sure that it doesn't alter the command line and is passed as such to the actual command. Note that we are overly restrictive here, in order to be on the safe side.
|
Build a safe shell command line from the given arguments. This function will check all arguments in the args list so that they are valid shell parameters (i.e. they don't contain shell metacharacters). If everything is ok, it will return the result of template % args.
|
Formats a number as an ordinal in the English language. E.g. the number 1 becomes "1st", 22 becomes "22nd".
|
Truncate string and add ellipsis if needed.
|
Filters empty lines and comments from a line-based string. Whitespace is also removed from the beginning and end of all lines.
|
Formats a dictionary as "key=value" parameters. The keys are sorted to have a stable order.
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Apr 4 13:43:46 2016 | http://epydoc.sourceforge.net |