OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import copy | 6 import copy |
7 import database | 7 import database |
8 import logging | 8 import logging |
9 import monitored | 9 import monitored |
10 import multiprocessing | 10 import multiprocessing |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
810 # Report all dictionaries and their usage. | 810 # Report all dictionaries and their usage. |
811 self._output_examination() | 811 self._output_examination() |
812 # Report all interface marked with NoInterfaceObject and their usage. | 812 # Report all interface marked with NoInterfaceObject and their usage. |
813 self._output_examination(check_dictionaries=False) | 813 self._output_examination(check_dictionaries=False) |
814 | 814 |
815 print '\nKey:' | 815 print '\nKey:' |
816 print ' (READ-ONLY) - read-only attribute has relationship' | 816 print ' (READ-ONLY) - read-only attribute has relationship' |
817 print ' (GET/SET) - attribute has relationship' | 817 print ' (GET/SET) - attribute has relationship' |
818 print ' RETURN - operation\'s returned value has relationship' | 818 print ' RETURN - operation\'s returned value has relationship' |
819 print ' (ARGUMENT) - operation\'s argument(s) has relationship' | 819 print ' (ARGUMENT) - operation\'s argument(s) has relationship' |
820 print '' | |
821 print ' (New) - After dictionary name if constructor(s) exist' | |
822 print ' (Ops,Props,New) after a NoInterfaceObject name is defined as:' | |
823 print ' Ops - number of operations for a NoInterfaceObject' | |
824 print ' Props - number of properties for a NoInterfaceObject' | |
825 print ' New - T(#) number constructors for a NoInterfaceObject' | |
826 print ' F no constructors for a NoInterfaceObject' | |
827 print ' e.g., an interface 5 operations, 3 properties and 2' | |
828 print ' constructors would display (5,3,T(2))' | |
820 | 829 |
821 print '\n\nExamination Complete\n' | 830 print '\n\nExamination Complete\n' |
822 | 831 |
823 def _output_examination(self, check_dictionaries=True): | 832 def _output_examination(self, check_dictionaries=True): |
824 # Output diagnostics. First columns is Dictionary or NoInterfaceObject e.g., | 833 # Output diagnostics. First columns is Dictionary or NoInterfaceObject e.g., |
825 # | Dictionary | Used In Interface | Usage Operation/Attribute | | 834 # | Dictionary | Used In Interface | Usage Operation/Attribute | |
826 print '\n\n' | 835 print '\n\n' |
827 title_bar = ['Dictionary', 'Used In Interface', 'Usage Operation/Attribute'] if check_dictionaries \ | 836 title_bar = ['Dictionary', 'Used In Interface', 'Usage Operation/Attribute'] if check_dictionaries \ |
828 else ['NoInterfaceObject', 'Used In Interface', 'Usage Operation /Attribute'] | 837 else ['NoInterfaceObject (Ops,Props,New)', 'Used In Interface', 'Usage Operation/Attribute'] |
829 self._tabulate_title(title_bar) | 838 self._tabulate_title(title_bar) |
830 diags = self._diag_dictionaries if check_dictionaries else self._diag_no_int erfaces | 839 diags = self._diag_dictionaries if check_dictionaries else self._diag_no_int erfaces |
831 for diag in diags: | 840 for diag in diags: |
832 self._tabluate([diag['dictionary' if check_dictionaries else 'no_interface _object'].id, '', '']) | 841 if not(check_dictionaries): |
842 interface = diag['no_interface_object'] | |
843 ops_count = len(interface.operations) | |
844 properties_count = len(interface.attributes) | |
845 any_constructors = 'Constructor' in interface.ext_attrs | |
846 constructors = 'T(%s)' % len(interface.ext_attrs['Constructor']) if any_ constructors else 'F' | |
847 interface_detail = '%s (%s,%s,%s)' % \ | |
848 (diag['no_interface_object'].id, | |
849 ops_count, | |
850 properties_count, | |
851 constructors) | |
852 self._tabluate([interface_detail, '', '']) | |
853 else: | |
854 dictionary = diag['dictionary'] | |
855 any_constructors = 'Constructor' in dictionary.ext_attrs | |
856 self._tabluate(['%s%s' % (dictionary.id, ' (New)' if any_constructors el se ''), '', '']) | |
Alan Knight
2015/03/18 19:13:03
typo?
terry
2015/03/18 19:22:36
Yep, fixed.
| |
833 for usage in diag['usages']: | 857 for usage in diag['usages']: |
834 detail = '' | 858 detail = '' |
835 if 'attribute' in usage: | 859 if 'attribute' in usage: |
836 attribute_type = 'READ-ONLY' if not usage['argument'] else 'GET/SET' | 860 attribute_type = 'READ-ONLY' if not usage['argument'] else 'GET/SET' |
837 detail = '(%s) %s' % (attribute_type, usage['attribute']) | 861 detail = '(%s) %s' % (attribute_type, usage['attribute']) |
838 elif 'operation' in usage: | 862 elif 'operation' in usage: |
839 detail = '%s %s%s' % ('RETURN' if usage['result'] else '', | 863 detail = '%s %s%s' % ('RETURN' if usage['result'] else '', |
840 usage['operation'], | 864 usage['operation'], |
841 '(ARGUMENT)' if usage['argument'] else '') | 865 '(ARGUMENT)' if usage['argument'] else '') |
842 self._tabluate([None, usage['interface'], detail]) | 866 self._tabluate([None, usage['interface'], detail]) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
983 | columns[0] | columns[1] | columns[2] | ... | | 1007 | columns[0] | columns[1] | columns[2] | ... | |
984 """ | 1008 """ |
985 if len(columns) > 0: | 1009 if len(columns) > 0: |
986 for column in columns: | 1010 for column in columns: |
987 value = '' if not column else column | 1011 value = '' if not column else column |
988 sys.stdout.write('|{0:^{1}}'.format(value, self._TABULATE_WIDTH())) | 1012 sys.stdout.write('|{0:^{1}}'.format(value, self._TABULATE_WIDTH())) |
989 else: | 1013 else: |
990 sys.stdout.write('|{0:^{1}}'.format('', self._TABULATE_WIDTH())) | 1014 sys.stdout.write('|{0:^{1}}'.format('', self._TABULATE_WIDTH())) |
991 | 1015 |
992 sys.stdout.write('|\n') | 1016 sys.stdout.write('|\n') |
OLD | NEW |