OLD | NEW |
1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. | 1 # copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr | 2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
3 # | 3 # |
4 # This file is part of astroid. | 4 # This file is part of astroid. |
5 # | 5 # |
6 # astroid is free software: you can redistribute it and/or modify it | 6 # astroid is free software: you can redistribute it and/or modify it |
7 # under the terms of the GNU Lesser General Public License as published by the | 7 # under the terms of the GNU Lesser General Public License as published by the |
8 # Free Software Foundation, either version 2.1 of the License, or (at your | 8 # Free Software Foundation, either version 2.1 of the License, or (at your |
9 # option) any later version. | 9 # option) any later version. |
10 # | 10 # |
11 # astroid is distributed in the hope that it will be useful, but | 11 # astroid is distributed in the hope that it will be useful, but |
12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | 12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
14 # for more details. | 14 # for more details. |
15 # | 15 # |
16 # You should have received a copy of the GNU Lesser General Public License along | 16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with astroid. If not, see <http://www.gnu.org/licenses/>. | 17 # with astroid. If not, see <http://www.gnu.org/licenses/>. |
18 """this module contains utilities for rebuilding a _ast tree in | 18 """this module contains utilities for rebuilding a _ast tree in |
19 order to get a single Astroid representation | 19 order to get a single Astroid representation |
20 """ | 20 """ |
21 | 21 |
22 import sys | 22 import sys |
23 from _ast import ( | 23 from _ast import ( |
24 Expr as Discard, Str, | 24 Expr as Discard, Str, |
25 # binary operators | 25 # binary operators |
26 Add, Div, FloorDiv, Mod, Mult, Pow, Sub, BitAnd, BitOr, BitXor, | 26 Add, Div, FloorDiv, Mod, Mult, Pow, Sub, BitAnd, BitOr, BitXor, |
27 LShift, RShift, | 27 LShift, RShift, |
28 # logical operators | 28 # logical operators |
29 And, Or, | 29 And, Or, |
30 # unary operators | 30 # unary operators |
31 UAdd, USub, Not, Invert, | 31 UAdd, USub, Not, Invert, |
32 # comparison operators | 32 # comparison operators |
33 Eq, Gt, GtE, In, Is, IsNot, Lt, LtE, NotEq, NotIn, | 33 Eq, Gt, GtE, In, Is, IsNot, Lt, LtE, NotEq, NotIn, |
34 ) | 34 ) |
35 | 35 |
36 from astroid import nodes as new | 36 from astroid import nodes as new |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 for keyword in node.keywords: | 897 for keyword in node.keywords: |
898 if keyword.arg == 'metaclass': | 898 if keyword.arg == 'metaclass': |
899 newnode._metaclass = self.visit(keyword, newnode).value | 899 newnode._metaclass = self.visit(keyword, newnode).value |
900 break | 900 break |
901 return newnode | 901 return newnode |
902 | 902 |
903 if sys.version_info >= (3, 0): | 903 if sys.version_info >= (3, 0): |
904 TreeRebuilder = TreeRebuilder3k | 904 TreeRebuilder = TreeRebuilder3k |
905 | 905 |
906 | 906 |
OLD | NEW |