Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(197828)

Delta Between Two Patch Sets: Lib/inspect.py

Issue 18929: inspect.classify_class_attrs ignores metaclass
Left Patch Set: Created 6 years, 3 months ago
Right Patch Set: Created 6 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Doc/library/inspect.rst ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 """Get useful information from live Python objects. 1 """Get useful information from live Python objects.
2 2
3 This module encapsulates the interface provided by the internal special 3 This module encapsulates the interface provided by the internal special
4 attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion. 4 attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
5 It also provides some help for examining source code and class layout. 5 It also provides some help for examining source code and class layout.
6 6
7 Here are some of the useful functions provided by this module: 7 Here are some of the useful functions provided by this module:
8 8
9 ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(), 9 ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
10 isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(), 10 isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 argument is true, exactly one entry appears in the returned structure 787 argument is true, exactly one entry appears in the returned structure
788 for each class in the given list. Otherwise, classes using multiple 788 for each class in the given list. Otherwise, classes using multiple
789 inheritance and their descendants will appear multiple times.""" 789 inheritance and their descendants will appear multiple times."""
790 children = {} 790 children = {}
791 roots = [] 791 roots = []
792 for c in classes: 792 for c in classes:
793 if c.__bases__: 793 if c.__bases__:
794 for parent in c.__bases__: 794 for parent in c.__bases__:
795 if not parent in children: 795 if not parent in children:
796 children[parent] = [] 796 children[parent] = []
797 children[parent].append(c) 797 if c not in children[parent]:
798 children[parent].append(c)
798 if unique and parent in classes: break 799 if unique and parent in classes: break
799 elif c not in roots: 800 elif c not in roots:
800 roots.append(c) 801 roots.append(c)
801 for parent in children: 802 for parent in children:
802 if parent not in classes: 803 if parent not in classes:
803 roots.append(parent) 804 roots.append(parent)
804 return walktree(roots, children, None) 805 return walktree(roots, children, None)
805 806
806 # ------------------------------------------------ argument list extraction 807 # ------------------------------------------------ argument list extraction
807 Arguments = namedtuple('Arguments', 'args, varargs, varkw') 808 Arguments = namedtuple('Arguments', 'args, varargs, varkw')
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 2102
2102 result.append(formatted) 2103 result.append(formatted)
2103 2104
2104 rendered = '({})'.format(', '.join(result)) 2105 rendered = '({})'.format(', '.join(result))
2105 2106
2106 if self.return_annotation is not _empty: 2107 if self.return_annotation is not _empty:
2107 anno = formatannotation(self.return_annotation) 2108 anno = formatannotation(self.return_annotation)
2108 rendered += ' -> {}'.format(anno) 2109 rendered += ' -> {}'.format(anno)
2109 2110
2110 return rendered 2111 return rendered
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+