| OLD | NEW |
| 1 # Copyright (c) 2004-2013 LOGILAB S.A. (Paris, FRANCE). | 1 # Copyright (c) 2004-2013 LOGILAB S.A. (Paris, FRANCE). |
| 2 # http://www.logilab.fr/ -- mailto:contact@logilab.fr | 2 # http://www.logilab.fr/ -- mailto:contact@logilab.fr |
| 3 # | 3 # |
| 4 # This program is free software; you can redistribute it and/or modify it under | 4 # This program is free software; you can redistribute it and/or modify it under |
| 5 # the terms of the GNU General Public License as published by the Free Software | 5 # the terms of the GNU General Public License as published by the Free Software |
| 6 # Foundation; either version 2 of the License, or (at your option) any later | 6 # Foundation; either version 2 of the License, or (at your option) any later |
| 7 # version. | 7 # version. |
| 8 # | 8 # |
| 9 # This program is distributed in the hope that it will be useful, but WITHOUT | 9 # This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 """return a relation ship or None | 70 """return a relation ship or None |
| 71 """ | 71 """ |
| 72 for rel in self.relationships.get(relation_type, ()): | 72 for rel in self.relationships.get(relation_type, ()): |
| 73 if rel.from_object is from_object: | 73 if rel.from_object is from_object: |
| 74 return rel | 74 return rel |
| 75 raise KeyError(relation_type) | 75 raise KeyError(relation_type) |
| 76 | 76 |
| 77 def get_attrs(self, node): | 77 def get_attrs(self, node): |
| 78 """return visible attributes, possibly with class name""" | 78 """return visible attributes, possibly with class name""" |
| 79 attrs = [] | 79 attrs = [] |
| 80 for node_name, ass_nodes in node.instance_attrs_type.items() + \ | 80 for node_name, ass_nodes in list(node.instance_attrs_type.items()) + \ |
| 81 node.locals_type.items(): | 81 list(node.locals_type.items()): |
| 82 if not self.show_attr(node_name): | 82 if not self.show_attr(node_name): |
| 83 continue | 83 continue |
| 84 names = self.class_names(ass_nodes) | 84 names = self.class_names(ass_nodes) |
| 85 if names: | 85 if names: |
| 86 node_name = "%s : %s" % (node_name, ", ".join(names)) | 86 node_name = "%s : %s" % (node_name, ", ".join(names)) |
| 87 attrs.append(node_name) | 87 attrs.append(node_name) |
| 88 return sorted(attrs) | 88 return sorted(attrs) |
| 89 | 89 |
| 90 def get_methods(self, node): | 90 def get_methods(self, node): |
| 91 """return visible methods""" | 91 """return visible methods""" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 except KeyError: | 163 except KeyError: |
| 164 continue | 164 continue |
| 165 # implements link | 165 # implements link |
| 166 for impl_node in node.implements: | 166 for impl_node in node.implements: |
| 167 try: | 167 try: |
| 168 impl_obj = self.object_from_node(impl_node) | 168 impl_obj = self.object_from_node(impl_node) |
| 169 self.add_relationship(obj, impl_obj, 'implements') | 169 self.add_relationship(obj, impl_obj, 'implements') |
| 170 except KeyError: | 170 except KeyError: |
| 171 continue | 171 continue |
| 172 # associations link | 172 # associations link |
| 173 for name, values in node.instance_attrs_type.items() + \ | 173 for name, values in list(node.instance_attrs_type.items()) + \ |
| 174 node.locals_type.items(): | 174 list(node.locals_type.items()): |
| 175 for value in values: | 175 for value in values: |
| 176 if value is astroid.YES: | 176 if value is astroid.YES: |
| 177 continue | 177 continue |
| 178 if isinstance(value, astroid.Instance): | 178 if isinstance(value, astroid.Instance): |
| 179 value = value._proxied | 179 value = value._proxied |
| 180 try: | 180 try: |
| 181 ass_obj = self.object_from_node(value) | 181 ass_obj = self.object_from_node(value) |
| 182 self.add_relationship(ass_obj, obj, 'association', name) | 182 self.add_relationship(ass_obj, obj, 'association', name) |
| 183 except KeyError: | 183 except KeyError: |
| 184 continue | 184 continue |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 continue | 238 continue |
| 239 for obj in self.modules(): | 239 for obj in self.modules(): |
| 240 obj.shape = 'package' | 240 obj.shape = 'package' |
| 241 # dependencies | 241 # dependencies |
| 242 for dep_name in obj.node.depends: | 242 for dep_name in obj.node.depends: |
| 243 try: | 243 try: |
| 244 dep = self.get_module(dep_name, obj.node) | 244 dep = self.get_module(dep_name, obj.node) |
| 245 except KeyError: | 245 except KeyError: |
| 246 continue | 246 continue |
| 247 self.add_relationship(obj, dep, 'depends') | 247 self.add_relationship(obj, dep, 'depends') |
| OLD | NEW |