Advertisement
amram

def Method_and_DocString_output(TI)

Oct 8th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 10.00 KB | None | 0 0
  1. def Method_and_DocString_output(TI):
  2.     UI = TI.GetPlatformInterface()
  3.     BB = TI.GetBlackboardInterface()
  4.     debug_file = open('log/dir_outputs.txt', 'w')
  5.     dirTI = dir(TI)
  6.     dirUI = dir(UI)
  7.     dirBB = dir(BB)
  8.     FC = UI.GetFireControlInfo()
  9.     dirFC = dir(FC)
  10.     FP = UI.GetFlightPortInfo()
  11.     dirFP = dir(FP)
  12.     SI = UI.GetSubInterface()
  13.     dirSI = dir(SI)
  14.     launcher = UI.GetLauncherInfo(0)
  15.     dir_launcher = dir(launcher)
  16.     mission = UI.GetMissionInfo()
  17.     dir_mission = dir(mission)
  18.     sensor = UI.GetSensorInfo(0)
  19.     dir_sensor = dir(sensor)
  20.     for x in range(0, 1000):
  21.         try:
  22.             UI.GetTrackById(x)
  23.             if track.IsValid():
  24.                 break
  25.         except:
  26.             x += 1
  27.     track = UI.GetTrackById(x)
  28.     dir_track = dir(track)
  29.     FP = UI.GetFlightPortInfo()
  30.     status = FP.GetUnitStatus(0)
  31.     dir_status = dir(status)
  32.  
  33.     debug_file.write('################\n##            ##\n##     TI     ##\n##            ##\n################\n')
  34.     for n in range(0,len(dirTI)):
  35.         debug_file.write('    TI.%s\n' % dirTI[n])
  36.         valn = getattr(TI, dirTI[n])
  37.         try:
  38.             istype = type(valn)
  39.             debug_file.write('    type: %s\n' % istype)
  40.         except:
  41.             debug_file.write('    type: unknown\n')
  42.         try:
  43.             iscallable = callable(valn)
  44.             debug_file.write('    callable?: %s\n' % iscallable)
  45.         except:
  46.             debug_file.write('    callable?: definitely NOT!\n')
  47.         try:
  48.             doc = valn.__doc__
  49.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  50.         except:
  51.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  52.  
  53.     debug_file.write('################\n##            ##\n##     UI     ##\n##            ##\n################\n')
  54.     for n in range(0,len(dirUI)):
  55.         debug_file.write('    UI.%s\n' % dirUI[n])
  56.         valn = getattr(UI, dirUI[n])
  57.         try:
  58.             istype = type(valn)
  59.             debug_file.write('    type: %s\n' % istype)
  60.         except:
  61.             debug_file.write('    type: unknown\n')
  62.         try:
  63.             iscallable = callable(valn)
  64.             debug_file.write('    callable?: %s\n' % iscallable)
  65.         except:
  66.             debug_file.write('    callable?: definitely NOT!\n')
  67.         try:
  68.             doc = valn.__doc__
  69.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  70.         except:
  71.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  72.  
  73.     debug_file.write('################\n##            ##\n##     BB     ##\n##            ##\n################\n')
  74.     for n in range(0,len(dirBB)):
  75.         debug_file.write('    BB.%s\n' % dirBB[n])
  76.         valn = getattr(BB, dirBB[n])
  77.         try:
  78.             istype = type(valn)
  79.             debug_file.write('    type: %s\n' % istype)
  80.         except:
  81.             debug_file.write('    type: unknown\n')
  82.         try:
  83.             iscallable = callable(valn)
  84.             debug_file.write('    callable?: %s\n' % iscallable)
  85.         except:
  86.             debug_file.write('    callable?: definitely NOT!\n')
  87.         try:
  88.             doc = valn.__doc__
  89.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  90.         except:
  91.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  92.  
  93.     debug_file.write('################\n##            ##\n##     FC     ##\n##            ##\n################\n')
  94.     for n in range(0,len(dirFC)):
  95.         debug_file.write('    FC.%s\n' % dirFC[n])
  96.         valn = getattr(FC, dirFC[n])
  97.         try:
  98.             istype = type(valn)
  99.             debug_file.write('    type: %s\n' % istype)
  100.         except:
  101.             debug_file.write('    type: unknown\n')
  102.         try:
  103.             iscallable = callable(valn)
  104.             debug_file.write('    callable?: %s\n' % iscallable)
  105.         except:
  106.             debug_file.write('    callable?: definitely NOT!\n')
  107.         try:
  108.             doc = valn.__doc__
  109.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  110.         except:
  111.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  112.  
  113.     debug_file.write('################\n##            ##\n##     FP     ##\n##            ##\n################\n')
  114.     for n in range(0,len(dirFP)):
  115.         debug_file.write('    FP.%s\n' % dirFP[n])
  116.         valn = getattr(FP, dirFP[n])
  117.         try:
  118.             istype = type(valn)
  119.             debug_file.write('    type: %s\n' % istype)
  120.         except:
  121.             debug_file.write('    type: unknown\n')
  122.         try:
  123.             iscallable = callable(valn)
  124.             debug_file.write('    callable?: %s\n' % iscallable)
  125.         except:
  126.             debug_file.write('    callable?: definitely NOT!\n')
  127.         try:
  128.             doc = valn.__doc__
  129.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  130.         except:
  131.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  132.  
  133.     debug_file.write('################\n##            ##\n##     SI     ##\n##            ##\n################\n')
  134.     for n in range(0,len(dirSI)):
  135.         debug_file.write('    SI.%s\n' % dirSI[n])
  136.         valn = getattr(SI, dirSI[n])
  137.         try:
  138.             istype = type(valn)
  139.             debug_file.write('    type: %s\n' % istype)
  140.         except:
  141.             debug_file.write('    type: unknown\n')
  142.         try:
  143.             iscallable = callable(valn)
  144.             debug_file.write('    callable?: %s\n' % iscallable)
  145.         except:
  146.             debug_file.write('    callable?: definitely NOT!\n')
  147.         try:
  148.             doc = valn.__doc__
  149.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  150.         except:
  151.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  152.  
  153.     debug_file.write('################\n##            ##\n##  Launcher  ##\n##            ##\n################\n')
  154.     for n in range(0,len(dir_launcher)):
  155.         debug_file.write('    launcher.%s\n' % dir_launcher[n])
  156.         valn = getattr(launcher, dir_launcher[n])
  157.         try:
  158.             istype = type(valn)
  159.             debug_file.write('    type: %s\n' % istype)
  160.         except:
  161.             debug_file.write('    type: unknown\n')
  162.         try:
  163.             iscallable = callable(valn)
  164.             debug_file.write('    callable?: %s\n' % iscallable)
  165.         except:
  166.             debug_file.write('    callable?: definitely NOT!\n')
  167.         try:
  168.             doc = valn.__doc__
  169.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  170.         except:
  171.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  172.  
  173.     debug_file.write('################\n##            ##\n##  Mission   ##\n##            ##\n################\n')
  174.     for n in range(0,len(dir_mission)):
  175.         debug_file.write('    mission.%s\n' % dir_mission[n])
  176.         valn = getattr(mission, dir_mission[n])
  177.         try:
  178.             istype = type(valn)
  179.             debug_file.write('    type: %s\n' % istype)
  180.         except:
  181.             debug_file.write('    type: unknown\n')
  182.         try:
  183.             iscallable = callable(valn)
  184.             debug_file.write('    callable?: %s\n' % iscallable)
  185.         except:
  186.             debug_file.write('    callable?: definitely NOT!\n')
  187.         try:
  188.             doc = valn.__doc__
  189.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  190.         except:
  191.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  192.  
  193.     debug_file.write('################\n##            ##\n##   Sensor   ##\n##            ##\n################\n')
  194.     for n in range(0,len(dir_sensor)):
  195.         debug_file.write('    sensor.%s\n' % dir_sensor[n])
  196.         valn = getattr(mission, dir_mission[n])
  197.         try:
  198.             istype = type(valn)
  199.             debug_file.write('    type: %s\n' % istype)
  200.         except:
  201.             debug_file.write('    type: unknown\n')
  202.         try:
  203.             iscallable = callable(valn)
  204.             debug_file.write('    callable?: %s\n' % iscallable)
  205.         except:
  206.             debug_file.write('    callable?: definitely NOT!\n')
  207.         try:
  208.             doc = valn.__doc__
  209.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  210.         except:
  211.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  212.  
  213.     debug_file.write('################\n##            ##\n##   Track    ##\n##            ##\n################\n\n\n')
  214.     for n in range(0,len(dir_track)):
  215.         debug_file.write('    track.%s\n' % dir_track[n])
  216.         valn = getattr(track, dir_track[n])
  217.         try:
  218.             istype = type(valn)
  219.             debug_file.write('    type: %s\n' % istype)
  220.         except:
  221.             debug_file.write('    type: unknown\n')
  222.         try:
  223.             iscallable = callable(valn)
  224.             debug_file.write('    callable?: %s\n' % iscallable)
  225.         except:
  226.             debug_file.write('    callable?: definitely NOT!\n')
  227.         try:
  228.             doc = valn.__doc__
  229.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  230.         except:
  231.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
  232.  
  233.     debug_file.write('################\n##            ##\n##   Status   ##\n##            ##\n################\n')
  234.     for n in range(0,len(dir_status)):
  235.         debug_file.write('    status.%s\n' % dir_status[n])
  236.         valn = getattr(status, dir_status[n])
  237.         try:
  238.             istype = type(valn)
  239.             debug_file.write('    type: %s\n' % istype)
  240.         except:
  241.             debug_file.write('    type: unknown\n')
  242.         try:
  243.             iscallable = callable(valn)
  244.             debug_file.write('    callable?: %s\n' % iscallable)
  245.         except:
  246.             debug_file.write('    callable?: definitely NOT!\n')
  247.         try:
  248.             doc = valn.__doc__
  249.             debug_file.write('    doc string: %s\n\n\n\n' % doc)
  250.         except:
  251.             debug_file.write('    doc string: there is no such string here\n\n\n\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement