Skip to content

Refactor code using pyupgrade for Python 3.6#770

Merged
owais merged 2 commits intoopen-telemetry:mainfrom
adamantike:pyupgrade-py3-run
Oct 24, 2021
Merged

Refactor code using pyupgrade for Python 3.6#770
owais merged 2 commits intoopen-telemetry:mainfrom
adamantike:pyupgrade-py3-run

Conversation

@adamantike
Copy link
Copy Markdown
Contributor

Description

This diff is the result of applying the following command to the project:

find . -type f -name "*.py" -exec pyupgrade --py36-plus '{}' +

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Existing CI test coverage.

Does This PR Require a Core Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

This diff is the result of applying the following command to the
project:

```shell
find . -type f -name "*.py" -exec pyupgrade --py36-plus '{}' +
```
@adamantike adamantike requested a review from a team October 23, 2021 04:26
@owais owais added the Skip Changelog PRs that do not require a CHANGELOG.md entry label 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",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing this?

Copy link
Copy Markdown
Contributor Author

@adamantike adamantike Oct 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@owais owais merged commit 07c52aa into open-telemetry:main Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PRs that do not require a CHANGELOG.md entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants