Wiki

Clone wiki

radutil / Home

radutil

This will be a quick place to do some temporary dev documentation - final docs will be in the main repo

functions in the library so as of 2009-08-05

FUNCTIONS
    
    check_k(K)
        checks for errors in a command file
        
        checks that a command file, and all descendent command files and transcripts 
        are properly terminated with a carriage return.
        
        checks that every transcript file referenced exists
    
    check_t(T)
    
    ending_ok(partial)
        Utility function to check file ends with return
    
    find_in_K(pattern, K, escaped=True)
        find a pattern in any descendent transcript
        
        returns a nested list datastructure for found results:
        [command file name [
            transcript1[
                (line number,line),
                (line number,line),
                ],
            transcript2[
                (line number,line),
                (line number,line),
                 ]
            ]
        ],
        command file name [
            transcript1[
                (line number,line),
                (line number,line),
                ],
            transcript2[
                (line number,line),
                (line number,line),
                 ]
            ]
        ]]
    
    find_in_T(pattern, T, escaped=True)
        finds a pattern in a transcript file
        
        Returns a list of tuples of (line number, line)
        pattern is escaped by default
    
    get_full_path(partial, get_file=False)
        Utility function to take radmind relative path and resolve to full path
    
    main()
    
    parse_K(K, supress_error=False)
        parses a K file to determine all decendent K,T files and any referenced exclude patterns
        
        Will preserve precendence order of transcripts
        
        exclude patterns appearing are filtered to be unique
        
        returns a dictionary of lists {command[],transcript[],exclude[]}
    
    parse_K_walked(K, supress_error=False)
        This is probably going away  - see comments
        
        returns a dictionary of {command,transcript,exclude} 
        3 lists: (sub k files, transcripts /unique and ordered by precedence/,exclude patterns)
    
    prettySize(size)
    
    sort(f, case_insensitive=True, in_place=True, outfile=None)
        Sorts a transcript
        
        can sort a transcript in place, defaults to being case-insensitive
    
    sum_command(K, human=False)
        Sums the files listed in all transcripts referenced by a command file
        
        returns the number of bytes, defaults to number, unless human==True where it returns with human readable label
    
    sum_transcript(T, human=False)
        Sums the files listed in a transcript
        
        returns the number of bytes, defaults to number, unless human==True where it returns with human readable label
    
    walk_K(K)
        A generator function modeled on os.walk
        
        yields a tuple of (k name, sub k's,transcripts, excludes) for each K traversed

Updated