Skip to content

[Adjust Rule] SIM902 alert is wrong for getattr and other positional only functions #125

@bellini666

Description

@bellini666

Desired change

  • Rule(s): SIM902
  • Adjustment: Should not be applied to getattr and other alike

Explanation

getattr can't be used with keyword arguments and will throw TypeError: getattr() takes no keyword arguments if tried to be used as such.

The same applies to functions defined as as positional only (by using / in the arguments), which might make it impossible to use keyword arguments. This case is not easy to workaround though, but getattr and other official apis alike should probably be excluded from the rule.

Example

image

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions