Skip to content

ruff rule N805: First argument of a method should be named self #339

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

Merged
merged 2 commits into from
Mar 16, 2025

Conversation

cclauss
Copy link
Member

@cclauss cclauss commented Mar 16, 2025

This code is not deleting the function (method) but is instead deleting the class!

https://docs.astral.sh/ruff/rules/invalid-first-argument-name-for-method

@cclauss cclauss force-pushed the first_argument_of_a_method_should_be_named_self branch from f8eb245 to 5c6617c Compare March 16, 2025 13:11
@cclauss cclauss requested review from jayvdb and aaronliu0130 March 16, 2025 13:24
Copy link
Member

@aaronliu0130 aaronliu0130 left a comment

Choose a reason for hiding this comment

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

  1. I forgot why I made it delete a parameter...
  2. Are you sure that's true?

The names of the test cases generated by @parameterized.expand can be customized using the name_func keyword argument. The value should be a function which accepts three arguments: testcase_func, param_num, and params, and it should return the name of the test case. testcase_func will be the function to be tested, param_num will be the index of the test case parameters in the list of parameters, and param (an instance of param) will be the parameters which will be used.

In my testing, the "fun" parameter pre-rename was indeed a string, and making the signature (self, fun, _, x) did not produce the results expected and I think even threw errors.

@cclauss
Copy link
Member Author

cclauss commented Mar 16, 2025

The value should be a function

This is a method, not a function.

@cclauss cclauss requested a review from aaronliu0130 March 16, 2025 19:50
@aaronliu0130
Copy link
Member

aaronliu0130 commented Mar 16, 2025

Will rebase. (It said 3 files left unchanged for me though...)

@aaronliu0130 aaronliu0130 force-pushed the first_argument_of_a_method_should_be_named_self branch from 333e054 to f1a03ef Compare March 16, 2025 21:12
@aaronliu0130 aaronliu0130 force-pushed the first_argument_of_a_method_should_be_named_self branch from f1a03ef to a9f59ef Compare March 16, 2025 21:19
@aaronliu0130
Copy link
Member

Had to reword 79febcb because apparently commit msg lines starting with "#" are not ignored...

@cclauss cclauss merged commit 091845c into develop Mar 16, 2025
10 checks passed
@cclauss cclauss deleted the first_argument_of_a_method_should_be_named_self branch March 16, 2025 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy