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

Direct check for key in command_lib['snippets'] dictionary #1041

Closed
nishakm opened this issue Sep 24, 2021 · 2 comments
Closed

Direct check for key in command_lib['snippets'] dictionary #1041

nishakm opened this issue Sep 24, 2021 · 2 comments
Assignees
Labels
GH Open Source Day Reserved for Grace Hopper Open Source Day participants good first issue A good first issue to tackle if you are new to the project

Comments

@nishakm
Copy link
Contributor

nishakm commented Sep 24, 2021

WARNING
If this is your first tern contribution, please update your local git settings using these instructions.

DO NOT USE THE GITHUB UI!

When creating your commit message for your PR, make sure to use git commit -s rather than git commit -m

Remember to add a Fixes: #1041 line in your commit message.

Description
The get_command_listing function checks if a specific command
name exists in the command_lib['snippets'] dictionary. Rather than
checking the return value of command_lib['snippets'].keys() we directly
check the command_lib['snippets'] dictionary to improve performance.

Implementation
Make the following change in tern/analyze/default/command_lib/command_lib.py:

 68 def get_command_listing(command_name):                                          
 69     '''Given a command name retrieve the listing if it exists'''                
 70     listing = {}                                                                
 71     if command_name in command_lib['snippets'].keys(): <-- change this to command_lib['snippets']               
 72         listing = command_lib['snippets'][command_name]                         
 73     else:                                                                       
 74         logger.warning("%s", errors.no_listing_for_snippet_key.format(          
 75             listing_key=command_name))                                          
 76     return listing     
@nishakm nishakm added good first issue A good first issue to tackle if you are new to the project GH Open Source Day Reserved for Grace Hopper Open Source Day participants labels Sep 24, 2021
@Samaiya
Copy link
Contributor

Samaiya commented Oct 1, 2021

@nishakm can you please assign this to me , I am participating in vGHC OSD event

@Samaiya
Copy link
Contributor

Samaiya commented Oct 1, 2021

@nishakm what is the upstream branch to use for this ?

Samaiya added a commit to Samaiya/tern that referenced this issue Oct 1, 2021
Description:
The get_command_listing function checks if a specific command
name exists in the command_lib['snippets'] dictionary. Rather than
checking the return value of command_lib['snippets'].keys() we directly
check the command_lib['snippets'] dictionary to improve performance.

Resolves: tern-tools#1041

Signed-off-by: [email protected]
Samaiya added a commit to Samaiya/tern that referenced this issue Oct 1, 2021
Description:
The get_command_listing function checks if a specific command
name exists in the command_lib['snippets'] dictionary. Rather than
checking the return value of command_lib['snippets'].keys() we directly
check the command_lib['snippets'] dictionary to improve performance.

Resolves: tern-tools#1041

Signed-off-by: [email protected]
Samaiya added a commit to Samaiya/tern that referenced this issue Oct 1, 2021
The get_command_listing function checks if a specific command
name exists in the command_lib['snippets'] dictionary. Rather than
checking the return value of command_lib['snippets'].keys() we directly
check the command_lib['snippets'] dictionary to improve performance.

Resolves: tern-tools#1041

Signed-off-by: Ashma Samaiya <[email protected]>
@nishakm nishakm closed this as completed in 99fdb5f Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GH Open Source Day Reserved for Grace Hopper Open Source Day participants good first issue A good first issue to tackle if you are new to the project
Projects
None yet
Development

No branches or pull requests

2 participants