Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

[feature request] new roles submodule with role_id and role_names functions. #35

Closed

Description

@zurk

I suggest adding a new roles module with roles info and add at least two functions:

def role_id(role_name):
    return DESCRIPTOR.enum_types_by_name["Role"].values_by_name[role_name].number

def role_name(role_id):
    return DESCRIPTOR.enum_types_by_name["Role"].values_by_number[role_id].name

Also, It is good to have something like constants with Roles id.
No need to go to documentation to check which roles we have or if you try to remember name (and you have tips from IDE :) ).

We have such constants in ast2vec:
https://github.com/src-d/ast2vec/blob/master/ast2vec/bblfsh_roles.py#L18

Can make a PR if you approve.

Activity

  1. juanjux commented on Nov 13, 2017

    @juanjux
    Contributor

    Implemented in 2.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions