Code Monkey home page Code Monkey logo

asttools's People

Contributors

dalejung avatar

Watchers

 avatar  avatar

asttools's Issues

Create a node location object?

Right now I just have a location dict with parent, field_name, field_index. Thinking of just making that an object and letting stuff like replace_node accept it.

Fix for Changes for function calling 3.4 -> 3.5

The Call node no longer has a kwargs attribute. Something like:

ast.parse("test(**locals())")

Will put the locals() call into the Call.keywords array. The only difference between the kwargs in 3.4 and keywords in 3.5 is that the stararg will create a ``ast.keyword(arg=None, value=ast.Call(func=Name(id='locals'))`

Should ast.With matching be strict?

Since with can have multiple with items, should we just match on a subset? Should:

with hello():
  _any_

match

with hello(), hi():
  pass

Or should the template default to strict and require an additional sentinel? like

with hello(), _any_:
  _any_

AST replacement

Thinking of creating an AST replacement that does things like keep track of parent and stuff. The custom AST would have the ability to extract a real ast. I suppose you run into an issue where you can't have the same Node in two different tree/placements, but really who cares?

My main annoyance right now with regular ast is that I have to keep a node context object around. Also an expanded AST would allow SyntaxError objects.

Replace ArgSpec normalization with something else

I currently use ArgSpec to munge both definitions and calls to a common type of format. In a lot of cases,

def bob(kw=1, *args):
    pass

and

bob(kw=1, *args)

Are useful to be parsed into a common format so I can quickly get the defined keywords plus any special args.

With 3.5, the difference between definitions and calling are much different due to various unpacking shortcuts. So it would make sense to kind of create an abstraction here that accomodates those difference but still allows me to use a common interface while dealing with the args.

Plus, with the differences between 3.4 and 3.5, I'd need something to buffer me from the underlying implementation. This goes a long with the creating my own ast issue. #2

Right now, I pretty much only support 3.5, after having only support 3.4. Personally IDC, but at some point I'd like to clean this up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.