google / pasta

Library to refactor python code through AST manipulation.
Apache License 2.0
341 stars 40 forks source link

Support PEP 448 - Additional Unpacking Generalizations #64

Closed soupytwist closed 5 years ago

soupytwist commented 5 years ago

(extracted from #58)

For example merged = {**a, **b} fails with a cryptic error

  File "pasta/base/annotate.py", line 804, in visit_Dict
    self.visit(key)
  File "pasta/base/annotate.py", line 1189, in visit
    fmt.set(node, 'indent', self._indent)
  File "pasta/base/formatting.py", line 37, in set
    _formatting_dict(node)[name] = value
  File "pasta/base/formatting.py", line 53, in _formatting_dict
    return getattr(node, PASTA_DICT)
AttributeError: 'NoneType' object has no attribute '__pasta__'

because the node key in visit_Dict will be None