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

Fix setattr usage on FederationRateLimitConfig.__init__() #10352

Closed
ShadowJonathan opened this issue Jul 9, 2021 · 1 comment
Closed

Fix setattr usage on FederationRateLimitConfig.__init__() #10352

ShadowJonathan opened this issue Jul 9, 2021 · 1 comment
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@ShadowJonathan
Copy link
Contributor

(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 ❤️)

@anoadragon453 anoadragon453 added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label Jul 9, 2021
@squahtx
Copy link
Contributor

squahtx commented Oct 21, 2021

Looks like this has been addressed by #10601

@squahtx squahtx closed this as completed Oct 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

No branches or pull requests

3 participants