httk.core.basic module

Basic help functions

httk.core.basic.anonymous_symbol_to_int(symb)[source]
httk.core.basic.breath_first_idxs(dim=1, start=None, end=None, perm=True, negative=False)[source]
httk.core.basic.create_tmpdir()[source]
httk.core.basic.destroy_tmpdir(tmpdir)[source]
httk.core.basic.flatten(l)[source]
httk.core.basic.int_to_anonymous_symbol(i)[source]
httk.core.basic.is_unary(e)[source]
httk.core.basic.main()[source]
httk.core.basic.micro_pyawk(ioa, search, results=None, debug=False, debugfunc=None, postdebugfunc=None)[source]

Small awk-mimicking search routine.

‘f’ is stream object to search through. ‘search’ is the “search program”, a list of lists/tuples with 3 elements; i.e., [[regex,test,run],[regex,test,run],…] ‘results’ is a an object that your search program will have access to for storing results.

Here regex is either as a Regex object, or a string that we compile into a Regex. test and run are callable objects.

This function goes through each line in filename, and if regex matches that line and test(results,line)==True (or test == None) we execute run(results,match), where match is the match object from running Regex.match.

The default results is an empty dictionary. Passing a results object let you interact with it in run() and test(). Hence, in many occasions it is thus clever to use results=self.

Returns: results

httk.core.basic.mkdir_p(path)[source]
httk.core.basic.nested_split(s, start, stop)[source]
httk.core.basic.parse_parexpr(string)[source]

Generate parenthesized contents in string as pairs (level, contents).

class httk.core.basic.rewindable_iterator(iterator)[source]

Bases: object

next()
rewind(rewindstr=None)[source]
httk.core.basic.tuple_to_str(t)[source]