Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Fix setattr usage on FederationRateLimitConfig.__init__() #10352

@ShadowJonathan

Description

@ShadowJonathan

(Kinda successor of #8376, with #8351 handling the other bit of that issue.)

Doing setattr (via kwargs or otherwise) upon instance initialisation disallows static analysis of the types those variables have, or it's existence (properly).

FederationRateLimitConfig currently does this, though it's not used as a type annotation anywhere, I think this is a precursor to that.

def __init__(self, **kwargs):
for i in self._items_and_default.keys():
setattr(self, i, kwargs.get(i) or self._items_and_default[i])


(I saw that someone fixed this snippet i pointed at in the previous issue, thank you @ who ever fixed that ❤️)

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions