Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new TypedName node #168

Merged
merged 1 commit into from
Oct 8, 2018
Merged

Conversation

scottbelden
Copy link
Contributor

Depends on PyCQA/baron#140

I'm not sure if this is correct or if I need to add tests, but it seems to work from what I can tell...

In [1]: from redbaron import RedBaron

In [2]: a = """def a ( x : int = 1 , y : List[str] ) :
   ...:     pass"""

In [3]: red = RedBaron(a)

In [4]: red.help()
0 -----------------------------------------------------
DefNode()
  # identifiers: def, def_, defnode, funcdef, funcdef_
  # default test value: name
  async=False
  name='a'
  decorators ->
  arguments ->
    * DefArgumentNode()
        # identifiers: def_argument, def_argument_, defargument, defargumentnode
        target ->
          TypedNameNode() ...
        value ->
          IntNode() ...
    * DefArgumentNode()
        # identifiers: def_argument, def_argument_, defargument, defargumentnode
        target ->
          TypedNameNode() ...
        value ->
          None
  value ->
    * PassNode()
        # identifiers: pass, pass_, passnode

In [5]: red[0].arguments[0].target.help()
TypedNameNode()
  # identifiers: typed_name, typed_name_, typedname, typednamenode
  value='x'
  annotation ->
    NameNode()
      # identifiers: name, name_, namenode
      value='int'

@Psycojoker Psycojoker merged commit 165d51f into PyCQA:master Oct 8, 2018
@Psycojoker
Copy link
Member

Checked it and no, no tests are needed since those are classical attributes for this node no additional work is needed, thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants