Hello,
I have this piece of code in one of my repo
class RuleMetadata:
def __init__(
self,
*,
function: Union[
Callable[[Session, UserModel, RuleComputeFinaleFromGroupRank], None],
Callable[[Session, UserModel, RuleComputePoints], None],
],
attribute: str,
required_admin: bool = False,
) -> None:
self.function = function
self.attribute = attribute
self.required_admin = required_admin
When I did this, I started by using dataclass, although I wanted the 3 arguments of the __init__ function to be keywords only. As dataclass does not support kw_only before python 3.10 (reference https://docs.python.org/3/library/dataclasses.html#module-contents), I ended up writing the __init__ function myself.
With the current implementation of B903, this will raise an error. My suggestion would be not to raise error if an keyword only argument and target-version<=3.9.
I'm currently raising a pull request, if you think my suggestion is ok, I'll let you review.