Refactor code using pyupgrade for Python 3.6#770
Merged
owais merged 2 commits intoopen-telemetry:mainfrom Oct 24, 2021
Merged
Conversation
This diff is the result of applying the following command to the
project:
```shell
find . -type f -name "*.py" -exec pyupgrade --py36-plus '{}' +
```
owais
approved these changes
Oct 23, 2021
owais
reviewed
Oct 23, 2021
...ntation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/_client.py
Outdated
Show resolved
Hide resolved
owais
reviewed
Oct 23, 2021
| root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
| with open( | ||
| os.path.join(root_path, _template_dir, _template_name), | ||
| "r", |
Contributor
Author
There was a problem hiding this comment.
Read mode is the default parameter even since Python 2, so pyupgrade removes it (https://github.com/asottile/pyupgrade#redundant-open-modes). I've also found most of the open() usages in the repo omit the read mode, so this should bring more consistency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This diff is the result of applying the following command to the project:
Type of change
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist: