record new upstream branch created by importing astroid_1.4.5.orig.tar.gz and merge it
Sandro Tosi
8 years ago
0 | 0 | Change log for the astroid package (used to be astng) |
1 | 1 | ===================================================== |
2 | ||
3 | 2016-03-21 -- 1.4.5 | |
4 | ||
5 | * decoratornames() does not leak InferenceError anymore. | |
6 | ||
7 | * wildcard_imported_names() got replaced by _public_names() | |
8 | ||
9 | Our understanding of wildcard imports through __all__ was | |
10 | half baked to say at least, since we couldn't account for | |
11 | modifications of the list, which results in tons of false positives. | |
12 | Instead, we replaced it with _public_names(), a method which returns | |
13 | all the names that are publicly available in a module, that is that | |
14 | don't start with an underscore, even though this means that there | |
15 | is a possibility for other names to be leaked out even though | |
16 | they are not present in the __all__ variable. | |
17 | ||
18 | The method is private in 1.4.X. | |
19 | ||
2 | 20 | |
3 | 21 | 2016-01-15 -- 1.4.4 |
4 | 22 |
0 | 0 | Metadata-Version: 1.1 |
1 | 1 | Name: astroid |
2 | Version: 1.4.4 | |
2 | Version: 1.4.5 | |
3 | 3 | Summary: A abstract syntax tree for Python with inference support. |
4 | 4 | Home-page: http://bitbucket.org/logilab/astroid |
5 | 5 | Author: Logilab |
19 | 19 | |
20 | 20 | modname = 'astroid' |
21 | 21 | |
22 | numversion = (1, 4, 4) | |
22 | numversion = (1, 4, 5) | |
23 | 23 | version = '.'.join([str(num) for num in numversion]) |
24 | 24 | |
25 | 25 | install_requires = ['six', 'lazy_object_proxy', 'wrapt'] |
201 | 201 | imported = node.do_import_module() |
202 | 202 | except exceptions.InferenceError: |
203 | 203 | continue |
204 | for name in imported.wildcard_import_names(): | |
204 | for name in imported._public_names(): | |
205 | 205 | node.parent.set_local(name, node) |
206 | 206 | sort_locals(node.parent.scope()._locals[name]) |
207 | 207 | else: |
246 | 246 | yield util.YES |
247 | 247 | nodes.UnaryOp._infer = bases.path_wrapper(infer_unaryop) |
248 | 248 | |
249 | def _infer_binop(operator, operand1, operand2, context, failures=None): | |
249 | def _infer_binop(binop, operand1, operand2, context, failures=None): | |
250 | 250 | if operand1 is util.YES: |
251 | 251 | yield operand1 |
252 | 252 | return |
253 | 253 | try: |
254 | for valnode in operand1.infer_binary_op(operator, operand2, context): | |
254 | for valnode in operand1.infer_binary_op(binop, operand2, context): | |
255 | 255 | yield valnode |
256 | 256 | except AttributeError: |
257 | 257 | try: |
269 | 269 | def infer_binop(self, context=None): |
270 | 270 | failures = [] |
271 | 271 | for lhs in self.left.infer(context): |
272 | for val in _infer_binop(self.op, lhs, self.right, context, failures): | |
272 | for val in _infer_binop(self, lhs, self.right, context, failures): | |
273 | 273 | yield val |
274 | 274 | for lhs in failures: |
275 | 275 | for rhs in self.right.infer(context): |
276 | for val in _infer_binop(self.op, rhs, lhs, context): | |
276 | for val in _infer_binop(self, rhs, lhs, context): | |
277 | 277 | yield val |
278 | 278 | nodes.BinOp._infer = bases.path_wrapper(infer_binop) |
279 | 279 | |
303 | 303 | def infer_augassign(self, context=None): |
304 | 304 | failures = [] |
305 | 305 | for lhs in self.target.infer_lhs(context): |
306 | for val in _infer_binop(self.op, lhs, self.value, context, failures): | |
306 | for val in _infer_binop(self, lhs, self.value, context, failures): | |
307 | 307 | yield val |
308 | 308 | for lhs in failures: |
309 | 309 | for rhs in self.value.infer(context): |
310 | for val in _infer_binop(self.op, rhs, lhs, context): | |
310 | for val in _infer_binop(self, rhs, lhs, context): | |
311 | 311 | yield val |
312 | 312 | nodes.AugAssign._infer = bases.path_wrapper(infer_augassign) |
313 | 313 |
102 | 102 | for key, impl in list(BIN_OP_IMPL.items()): |
103 | 103 | BIN_OP_IMPL[key+'='] = impl |
104 | 104 | |
105 | def const_infer_binary_op(self, operator, other, context): | |
105 | def const_infer_binary_op(self, binop, other, context): | |
106 | operator = binop.op | |
106 | 107 | for other in other.infer(context): |
107 | 108 | if isinstance(other, nodes.Const): |
108 | 109 | try: |
121 | 122 | yield other |
122 | 123 | else: |
123 | 124 | try: |
124 | for val in other.infer_binary_op(operator, self, context): | |
125 | for val in other.infer_binary_op(binop, self, context): | |
125 | 126 | yield val |
126 | 127 | except AttributeError: |
127 | 128 | yield util.YES |
129 | 130 | |
130 | 131 | |
131 | 132 | |
132 | def _multiply_seq_by_int(self, other, context): | |
133 | def _multiply_seq_by_int(self, binop, other, context): | |
133 | 134 | node = self.__class__() |
135 | node.parent = binop | |
134 | 136 | elts = [] |
135 | 137 | for elt in self.elts: |
136 | 138 | infered = util.safe_infer(elt, context) |
150 | 152 | yield inferred |
151 | 153 | |
152 | 154 | |
153 | def tl_infer_binary_op(self, operator, other, context): | |
155 | def tl_infer_binary_op(self, binop, other, context): | |
156 | operator = binop.op | |
154 | 157 | for other in other.infer(context): |
155 | 158 | if isinstance(other, self.__class__) and operator == '+': |
156 | 159 | node = self.__class__() |
160 | node.parent = binop | |
157 | 161 | elts = list(_filter_uninferable_nodes(self.elts, context)) |
158 | 162 | elts += list(_filter_uninferable_nodes(other.elts, context)) |
159 | 163 | node.elts = elts |
162 | 166 | if not isinstance(other.value, int): |
163 | 167 | yield util.YES |
164 | 168 | continue |
165 | yield _multiply_seq_by_int(self, other, context) | |
169 | yield _multiply_seq_by_int(self, binop, other, context) | |
166 | 170 | elif isinstance(other, bases.Instance) and not isinstance(other, nodes.Const): |
167 | 171 | yield util.YES |
168 | 172 | # XXX else log TypeError |
170 | 174 | nodes.List.infer_binary_op = bases.yes_if_nothing_inferred(tl_infer_binary_op) |
171 | 175 | |
172 | 176 | |
173 | def dict_infer_binary_op(self, operator, other, context): | |
177 | def dict_infer_binary_op(self, binop, other, context): | |
174 | 178 | for other in other.infer(context): |
175 | 179 | if isinstance(other, bases.Instance) and isinstance(other._proxied, nodes.ClassDef): |
176 | 180 | yield util.YES |
177 | 181 | # XXX else log TypeError |
178 | 182 | nodes.Dict.infer_binary_op = bases.yes_if_nothing_inferred(dict_infer_binary_op) |
179 | 183 | |
180 | def instance_infer_binary_op(self, operator, other, context): | |
184 | def instance_infer_binary_op(self, binop, other, context): | |
185 | operator = binop.op | |
181 | 186 | try: |
182 | 187 | methods = self.getattr(BIN_OP_METHOD[operator]) |
183 | 188 | except (exceptions.NotFoundError, KeyError): |
567 | 567 | inferred.append(inferred_node.value) |
568 | 568 | return inferred |
569 | 569 | |
570 | def _public_names(self): | |
571 | """Get the list of the names which are publicly available in this module.""" | |
572 | return [name for name in self.keys() if not name.startswith('_')] | |
573 | ||
570 | 574 | def bool_value(self): |
571 | 575 | return True |
572 | 576 | |
886 | 890 | decoratornodes += self.decorators.nodes |
887 | 891 | decoratornodes += self.extra_decorators |
888 | 892 | for decnode in decoratornodes: |
889 | for infnode in decnode.infer(): | |
890 | result.add(infnode.qname()) | |
893 | try: | |
894 | for infnode in decnode.infer(): | |
895 | result.add(infnode.qname()) | |
896 | except exceptions.InferenceError: | |
897 | continue | |
891 | 898 | return result |
892 | 899 | |
893 | 900 | def is_bound(self): |
148 | 148 | astroid = builder.string_build(data, __name__, __file__) |
149 | 149 | callfunc = astroid.body[1].value.func |
150 | 150 | inferred = callfunc.inferred() |
151 | self.assertEqual(len(inferred), 1) | |
151 | self.assertEqual(len(inferred), 2) | |
152 | 152 | |
153 | 153 | @require_version('3.0') |
154 | 154 | def test_nameconstant(self): |
298 | 298 | |
299 | 299 | next(node.value.infer()).as_string() |
300 | 300 | |
301 | def test_binop_generates_nodes_with_parents(self): | |
302 | node = extract_node(''' | |
303 | def no_op(*args): | |
304 | pass | |
305 | def foo(*args): | |
306 | def inner(*more_args): | |
307 | args + more_args #@ | |
308 | return inner | |
309 | ''') | |
310 | inferred = next(node.infer()) | |
311 | self.assertIsInstance(inferred, nodes.Tuple) | |
312 | self.assertIsNotNone(inferred.parent) | |
313 | self.assertIsInstance(inferred.parent, nodes.BinOp) | |
314 | ||
315 | def test_decorator_names_inference_error_leaking(self): | |
316 | node = extract_node(''' | |
317 | class Parent(object): | |
318 | @property | |
319 | def foo(self): | |
320 | pass | |
321 | ||
322 | class Child(Parent): | |
323 | @Parent.foo.getter | |
324 | def foo(self): #@ | |
325 | return super(Child, self).foo + ['oink'] | |
326 | ''') | |
327 | inferred = next(node.infer()) | |
328 | self.assertEqual(inferred.decoratornames(), set()) | |
329 | ||
301 | 330 | |
302 | 331 | class Whatever(object): |
303 | 332 | a = property(lambda x: x, lambda x: x) |
110 | 110 | res = sorted(m.wildcard_import_names()) |
111 | 111 | self.assertEqual(res, ['Aaa', 'func', 'name', 'other']) |
112 | 112 | |
113 | def test_public_names(self): | |
114 | m = builder.parse(''' | |
115 | name = 'a' | |
116 | _bla = 2 | |
117 | other = 'o' | |
118 | class Aaa: pass | |
119 | def func(): print('yo') | |
120 | __all__ = 'Aaa', '_bla', 'name' | |
121 | ''') | |
122 | values = sorted(['Aaa', 'name', 'other', 'func']) | |
123 | self.assertEqual(sorted(m._public_names()), values) | |
124 | m = builder.parse(''' | |
125 | name = 'a' | |
126 | _bla = 2 | |
127 | other = 'o' | |
128 | class Aaa: pass | |
129 | ||
130 | def func(): return 'yo' | |
131 | ''') | |
132 | res = sorted(m._public_names()) | |
133 | self.assertEqual(res, values) | |
134 | ||
113 | 135 | m = builder.parse(''' |
114 | 136 | from missing import tzop |
115 | 137 | trop = "test" |
116 | 138 | __all__ = (trop, "test1", tzop, 42) |
117 | 139 | ''') |
118 | res = sorted(m.wildcard_import_names()) | |
119 | self.assertEqual(res, ["test", "test1"]) | |
140 | res = sorted(m._public_names()) | |
141 | self.assertEqual(res, ["trop", "tzop"]) | |
120 | 142 | |
121 | 143 | m = builder.parse(''' |
122 | 144 | test = tzop = 42 |
123 | 145 | __all__ = ('test', ) + ('tzop', ) |
124 | 146 | ''') |
125 | res = sorted(m.wildcard_import_names()) | |
147 | res = sorted(m._public_names()) | |
126 | 148 | self.assertEqual(res, ['test', 'tzop']) |
127 | 149 | |
128 | 150 | def test_module_getattr(self): |
0 | 0 | Metadata-Version: 1.1 |
1 | 1 | Name: astroid |
2 | Version: 1.4.4 | |
2 | Version: 1.4.5 | |
3 | 3 | Summary: A abstract syntax tree for Python with inference support. |
4 | 4 | Home-page: http://bitbucket.org/logilab/astroid |
5 | 5 | Author: Logilab |
0 | 0 | # see git-dpm(1) from git-dpm package |
1 | a06d33a8cf30f751f2ccac8e7bf36a9f3c734a32 | |
2 | a06d33a8cf30f751f2ccac8e7bf36a9f3c734a32 | |
3 | a06d33a8cf30f751f2ccac8e7bf36a9f3c734a32 | |
4 | a06d33a8cf30f751f2ccac8e7bf36a9f3c734a32 | |
5 | astroid_1.4.4.orig.tar.gz | |
6 | 605227603fc9d3e7b342de0005c7e82726b184a3 | |
7 | 181733 | |
1 | b022987c7b522ff79f3b73511cf7293619b1df9b | |
2 | b022987c7b522ff79f3b73511cf7293619b1df9b | |
3 | b022987c7b522ff79f3b73511cf7293619b1df9b | |
4 | b022987c7b522ff79f3b73511cf7293619b1df9b | |
5 | astroid_1.4.5.orig.tar.gz | |
6 | 2ec96d60a5b40a656fdcbab77f58ba453f0cb03e | |
7 | 182251 | |
8 | 8 | debianTag="debian/%e%v" |
9 | 9 | patchedTag="patched/%e%v" |
10 | 10 | upstreamTag="upstream/%e%u" |