![]() |
PyXMake Developer Guide
1.0
PyXMake
|
Module of basic functions. More...
Classes | |
class | ChangedWorkingDirectory |
Class to create 2to3 compatible pickling dictionary. More... | |
class | GetDataFromPickle |
Class to create 2to3 compatible pickling dictionary. More... | |
class | UpdateZIP |
Class to create 2to3 compatible pickling dictionary. More... | |
Functions | |
def | TemporaryDirectory (default=None) |
def | ConsoleRedirect (to=os.devnull, stdout=None) |
def | MergedConsoleRedirect (f) |
def | FileOutput (FileName) |
def | GetPyXMakePath () |
def | GetPlatform () |
def | GetArchitecture () |
def | GetTemporaryFileName (arg=None, filename="Temp", extension=".cpd", kwargs) |
def | GetIterableAsList (Iterable) |
def | IsNotEmpty (s) |
def | AsDrive (s, sep=os.path.sep) |
def | Popen (command, verbosity) |
def | SSHPopen (ssh_client, command, verbosity) |
def | ConcatenateFiles (filename, files, source=os.getcwd(), ending='') |
def | ReplaceTextinFile (filename, outname, replace, inend='', outend='', source=os.getcwd()) |
def | DeleteFilesbyEnding (identifier) |
def | AddFunctionToObject (_func, _obj) |
def | PrepareObjectforPickling (_obj) |
def | RecoverDictionaryfromPickling (_dict) |
def | PathLeaf (path) |
def | ArbitraryFlattening (container) |
def | FileWalk (source, path=os.getcwd()) |
def | PathWalk (path, exclude=False, startswith=None, endswith=None, contains=None) |
def | ObjectWalk (obj, path=(), memo=None) |
Module of basic functions.
Classes and functions defined for convenience. @note: PyCODAC module Created on 15.07.2016 @version: 1.0 ---------------------------------------------------------------------------------------------- @requires: - @change: - @author: garb_ma [DLR-FA,STM Braunschweig] ----------------------------------------------------------------------------------------------
def PyXMake.Tools.Utility.AddFunctionToObject | ( | _func, | |
_obj | |||
) |
Bind a function to an existing object.
Definition at line 447 of file Utility.py.
def PyXMake.Tools.Utility.ArbitraryFlattening | ( | container | ) |
Restore the original dictionary by converting python defaults to their numpy equivalents if required (2to3 compatible).
Definition at line 494 of file Utility.py.
def PyXMake.Tools.Utility.AsDrive | ( | s, | |
sep = os.path.sep |
|||
) |
Return s as drive to start an absolute path with path.join(...).
Definition at line 346 of file Utility.py.
def PyXMake.Tools.Utility.ConcatenateFiles | ( | filename, | |
files, | |||
source = os.getcwd() , |
|||
ending = '' |
|||
) |
Concatenate all files into one.
Definition at line 405 of file Utility.py.
def PyXMake.Tools.Utility.ConsoleRedirect | ( | to = os.devnull , |
|
stdout = None |
|||
) |
Redirect console output to a given file.
Definition at line 209 of file Utility.py.
def PyXMake.Tools.Utility.DeleteFilesbyEnding | ( | identifier | ) |
Delete all files from workspace @author: Marc Garbade, 26.02.2018 @param: identifier: A tuple specifying the files to remove. @type: Tuple
Definition at line 434 of file Utility.py.
def PyXMake.Tools.Utility.FileOutput | ( | FileName | ) |
Redirect outputs to a given file.
Definition at line 276 of file Utility.py.
def PyXMake.Tools.Utility.FileWalk | ( | source, | |
path = os.getcwd() |
|||
) |
Walk recursively through path. Check if all files listed in source are present. If True, return them. If False, return all files present in the given path.
Definition at line 506 of file Utility.py.
def PyXMake.Tools.Utility.GetArchitecture | ( | ) |
Get the underlying machine architecture. Returns either x86 or x64 which corresponds to 32 or 64 bit systems.
Definition at line 303 of file Utility.py.
def PyXMake.Tools.Utility.GetIterableAsList | ( | Iterable | ) |
Walk through an iterable input set and store the results in a list.
Definition at line 331 of file Utility.py.
def PyXMake.Tools.Utility.GetPlatform | ( | ) |
Get the underlying machine platform in lower cases.
Definition at line 297 of file Utility.py.
def PyXMake.Tools.Utility.GetPyXMakePath | ( | ) |
Get the PyXMake path from *__init__.
Definition at line 290 of file Utility.py.
def PyXMake.Tools.Utility.GetTemporaryFileName | ( | arg = None , |
|
filename = "Temp" , |
|||
extension = ".cpd" , |
|||
kwargs | |||
) |
Create a temporary file name with extension *.cpd by default. Optional argument: Seed for random number generation.
Definition at line 314 of file Utility.py.
def PyXMake.Tools.Utility.IsNotEmpty | ( | s | ) |
Check whether a string is empty and/or not given. Returns True otherwise.
Definition at line 340 of file Utility.py.
def PyXMake.Tools.Utility.MergedConsoleRedirect | ( | f | ) |
Redirect all console outputs to a given stream
Definition at line 268 of file Utility.py.
def PyXMake.Tools.Utility.ObjectWalk | ( | obj, | |
path = () , |
|||
memo = None |
|||
) |
Walk recursively through nested python objects. @author: Yaniv Aknin, 13.12.2011 @param: obj, path, memo @type: object, list, boolean
Definition at line 558 of file Utility.py.
def PyXMake.Tools.Utility.PathLeaf | ( | path | ) |
Return the last item of an arbitrary path (its leaf).
Definition at line 487 of file Utility.py.
def PyXMake.Tools.Utility.PathWalk | ( | path, | |
exclude = False , |
|||
startswith = None , |
|||
endswith = None , |
|||
contains = None |
|||
) |
Walk recursively through path. Exclude both folders and files if requested.
Definition at line 531 of file Utility.py.
def PyXMake.Tools.Utility.Popen | ( | command, | |
verbosity | |||
) |
Run command line string "command" in a separate subprocess. Show output in current console window in dependence of verbosity level: - 0 --> Quiet - 1 --> Only show errors - 2 --> Show every command line output. @author: garb_ma @param: command, verbosity @type: string, integer
Definition at line 358 of file Utility.py.
def PyXMake.Tools.Utility.PrepareObjectforPickling | ( | _obj | ) |
Prepare a object for pickling and convert all numpy arrays to python defaults (2to3 compatible).
Definition at line 453 of file Utility.py.
def PyXMake.Tools.Utility.RecoverDictionaryfromPickling | ( | _dict | ) |
Restore the original dictionary by converting python defaults to their numpy equivalents if required (2to3 compatible).
Definition at line 469 of file Utility.py.
def PyXMake.Tools.Utility.ReplaceTextinFile | ( | filename, | |
outname, | |||
replace, | |||
inend = '' , |
|||
outend = '' , |
|||
source = os.getcwd() |
|||
) |
Replace all occurrences of replace in filename.
Definition at line 422 of file Utility.py.
def PyXMake.Tools.Utility.SSHPopen | ( | ssh_client, | |
command, | |||
verbosity | |||
) |
Run command line string "command" in a separate SSH client process. Show output in current console window in dependence of verbosity level: - 0 --> Quiet - 1 --> Only show errors - 2 --> Show every command line output. @author: garb_ma @param: command, verbosity @type: string, integer
Definition at line 380 of file Utility.py.
def PyXMake.Tools.Utility.TemporaryDirectory | ( | default = None | ) |
Create a temporary dictionary for use with the "with" statement. Its content is deleted after execution. @param: default @type: default: string
Definition at line 181 of file Utility.py.