Helpers for xdress.
author: | Anthony Scopatz <scopatz@gmail.com> |
---|
A quick persistent cache for descriptions from files. The keys are (classname, filename, kind) tuples. The values are (hashes-of-the-file, description-dictionary) tuples.
Parameters : | cachefile : str, optional
|
---|
A composable configuration class for xdress. Unlike argparse.Namespace, this keeps the object dictionary (__dict__) separate from the run control attributes dictionary (_dict).
Parameters : | kwargs : optional
|
---|
This is a type, based on a named tuple, that represents the API element names and is used to declare or discover where variables, functions, and classes live for the rest of xdress. All of the fields default to NotSpecified if not given. These feilds are the sames as what appear in description dictionaries under the ‘name’ key.
Parameters : | srcname : str, tuple, or NotSpecified
srcfiles : str, tuple of str, or NotSpecified
tarbase : str or NotSpecified
tarname : str, tuple, or NotSpecified
incfiles : tuple of str or NotSpecified
sidecars : str, tuple of str, or NotSpecified
language : str or NotSpecified
|
---|
See also
A special string subclass that can be used to indent the whol string inside of format strings by accessing an indentN attr. For example, s.indent8 will return a copy of the string s where every line starts with 8 spaces.
Takes user input and returns the corresponding apiname named tuple. If the name is already an apiname instance with no NotSpecified fields, this does not make a copy.
A function equivalent to the Python 2.x execfile statement.
This function takes a collection of method tuples and expands all of the default arguments, returning a set of all methods possible.
Returns a diictionary of extra filenames for an API element implemented in a given language and bound into a target.
Parameters : | name : apiname
|
---|---|
Returns : | extra : dict
|
Returns a description dictionary for a class or function implemented in a source file and bound into a target file.
Parameters : | srcname : str
tarname : str, optional
srcdir : str, optional
|
---|---|
Returns : | desc : dict
|
Finds the sidecar for a filename, if it exists. Otherwise returns None.
Finds a source filename, header filename, language name, and language source extension given a basename and source directory.
Generator which returns flattened version of nested sequences.
Try to guess a files’ language from its extention, defaults to C++.
Indents all lines in the string or list s by n spaces.
Generic memoziation decorator based off of code from http://wiki.python.org/moin/PythonDecoratorLibrary . This is not suitabe for method caching.
Given a sequence of descriptions, in order of increasing precedence, merge them into a single description dictionary.
Useful for not forcing re-compiles and thus playing nicely with the build system. This is acomplished by not writing the file if the existsing contents are exactly the same as what would be written out.
Parameters : | f1 : str
f2 : str
vebose : bool, optional
|
---|
Useful for not forcing re-compiles and thus playing nicely with the build system. This is acomplished by not writing the file if the existsing contents are exactly the same as what would be written out.
Parameters : | s : str
filename : str
vebose : bool, optional
|
---|
Search a global xdressrc file and parse if it exists. If nothing is found, an empty RunControl is returned.
Takes a string – which may represent a template specialization – and returns the corresponding type.
Takes a string with template specialization and returns a list of the argument values as strings.
Opens a file and updates the mtime, like the posix command of the same name.
Warns the user that a forbidden name has been found.
Only writes the contents of the string to a file if the file does not exist. Useful for not tocuhing files.
Parameters : | s : str
filename : str
vebose : bool, optional
|
---|
Default list of plugin module names.
Default run control file name.
A helper class singleton for run control meaning that a ‘real’ value has not been given.
WAT?!
Decorator suitable for memoizing methods, rather than functions and classes. This is based off of code that may be found at http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/ This code was originally released under the MIT license.