Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/ctm_search.html
Дата изменения: Fri Apr 8 12:46:14 2016
Дата индексирования: Mon Apr 11 00:38:30 2016
Кодировка:
Python: module ctm_search
 
 
ctm_search
index
ctm_search.py

***********************************************************************
#
# ctm_search.py - Python module to perform parsing of the CL CTMLINE.RPT
#                 report file.  There are two methods for using this module:
#
#                 1) From Python - Invocation of the ctmSearch function in this
#                                  module generates a set of 7 data files that
#                                  are used as the input to the Load Check 
#                                  Utility.
#
#                 2) From Command line, DCL procedure, or shell script -
#                                  Invocation of ctm_search.py as a Python 
#                                  script generates a set of 7 data files that
#                                  are used as the input to the Load Check
#                                  Utility.
#                   
***********************************************************************
#
# DEVELOPMENT HISTORY
#
#   AUTHOR     PR NO.      DATE    DESCRIPTION OF CHANGE
# ----------  ---------  --------  --------------------------------------------
# J. Lecourt  PR44502     06/02    Original Implementation
# + J. Taylor PR44503
#
# J. Lecourt  PR46322     10/02    Add HGA_INI to MSCH text block search,
#                                    move text block search first, and then
#                                    add MSCH text block "| " to list of
#                                    lines removed from cleanLines
#
# INVOCATION METHOD:
#   From Python -
#            ctmSearch input_file_spec <output_dir>
#
#   From Command line, DCL procedure, or shell script -
#     VMS:   python ctm_search.py input_file_spec <output_dir>
#     UNIX:  ctm_search.py input_file_spec <output_dir>
#
# INPUT PARAMETERS:
#     input_file_spec - file specification for the CTMLINE.RPT file to be parsed
#                       (required); For CL runs with TMLSEGMENT not equal 0
#                       this file specification should include a wild card (*),
#                       when calling from UNIX command line with a wild card 
#                       the input file specification must be enclosed in quotes
#     output_dir      - directory specification for the output directory
#                       (optional - default is the current working directory)
#
# LOGICALS (VMS) OR ENVIRONMENT VARIABLES (UNIX):
#    None
#
# REFERENCES:
#    None
#
# NOTES:
#    1) The function ctmSearch returns the following values:
#         0 - Success
#         1 - Error
#
#    2) The script exit status is as follows:
#         0 - Success
#         1 - Error
#
# -----------------------------------------------------------------------------
#
#  Import required modules
#

 
Modules
       
glob
os
string
sys

 
Functions
       
ctmSearch(inputFile, outDir='.')
***********************************************************************
# ctmSearch - search the given report file placing output in the given output
#             directory.  
***********************************************************************
searchText(lines, searchStrings, outFile, linesBefore=0, linesAfter=0)
***********************************************************************
# searchText - search a list of lines of text for lines containing any element
#              from a list of search strings and output the matching lines 
#              sorrounded by the given number of lines of text before and
#              after the matching lines to the given file
***********************************************************************
testLines(lines, searchStrings, linesBefore=0, linesAfter=0)
***********************************************************************
# testLines - search a list of lines of text for lines containing any element a 
#             from a list of search strings and return a list of the matching
#             lines surrounded by the given number of lines of text before and
#             after the matching line
***********************************************************************
testline(line, searchStrings)
# -----------------------------------------------------------------------------
# Local function definitions
# -----------------------------------------------------------------------------
#
***********************************************************************
# testline - search a line of text for elements in a list of search strings
#            and returns true if the line contains any element from the list
***********************************************************************