-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Style: update flake8 to latest #48006
Conversation
Signed-off-by: jerry <cheyu1220@gmail.com>
…026,B035 Signed-off-by: jerry <cheyu1220@gmail.com>
Signed-off-by: jerry <cheyu1220@gmail.com>
@rynewang and @MortalHappiness please shepherd this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice to have a chance to tidy things up! @aslonnie could you take a look on the ci change?
doc/source/custom_directives.py
Outdated
@@ -751,17 +751,17 @@ def render_library_examples(config: pathlib.Path = None) -> bs4.BeautifulSoup: | |||
# Group the examples by the ExampleConfig.groupby value: | |||
examples = defaultdict(list) | |||
example_config = ExampleConfig(config, app.srcdir) | |||
for example in example_config: | |||
for _example in example_config: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ops, I misread that. Let me make some corrections.
@@ -86,7 +86,7 @@ def validate_resource_request_quantity( | |||
@staticmethod | |||
@abstractmethod | |||
def get_current_process_visible_accelerator_ids() -> Optional[List[str]]: | |||
"""Get the ids of accelerators of this family that are visible to the current process. | |||
"""Get the ids of accelerators of this family that are visible to the current process. # noqa:E501 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we break the line instead of ignoring the line-too-long error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will handle that
We got some CI failures:
|
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
… fix not required change Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
Signed-off-by: Cheyu Wu <cheyu1220@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be nice to break this into several smaller PRs: for example, one PR just changing type()==x
to isinstance
.
@@ -776,8 +776,8 @@ def render_library_examples(config: pathlib.Path = None) -> bs4.BeautifulSoup: | |||
soup.append(page_text) | |||
|
|||
container = soup.new_tag("div", attrs={"class": "example-index"}) | |||
for group, examples in examples.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if we don't change examples to _example, it will trigger flake8's warning:
"Found for loop that reassigns the iterable it is iterating with each iterable value. Flake8 (B020)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, regarding a PR that only changes type() == x to isinstance, do I need to close the current PR and open a new one for this?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My recommendation is that you create a PR for each flake8 violation code and then this PR will just be the last PR that upgrades flake8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll work on it shortly. Thanks for your suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should avoid using variable names that start with an underscore. We can discuss how to name these variables after I divide this task into smaller ones.
Closed this PR because this issue has been divided into smaller ones. See #47991 for details. |
Why are these changes needed?
While running the pre-commit hook of flake8, the following error occurs if Python version is 3.12.
Related issue number
Closes #47991
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.cc @MortalHappiness