fix: support tokenlists v0.2 - #72
Conversation
3cb3325 to
748f158
Compare
| return manager | ||
|
|
||
| def __repr__(self) -> str: | ||
| return f"<ape_tokens.TokenManager default='{self._manager.default_tokenlist}'>" |
There was a problem hiding this comment.
you may want to check that this still works, I think v2 removed default_tokenlist
There was a problem hiding this comment.
Good find! I missed this one
| def __len__(self) -> int: | ||
| tokenlist = self._manager.get_tokenlist() | ||
| return len(tokenlist.tokens) | ||
| return sum(len(tl.tokens) for tl in self._manager.installed_tokenlists.values()) |
There was a problem hiding this comment.
this means that __len__ and __iter__ differ, meaning if you counted all the items from iterating, it would be different.. kinda a weird design. Iter filters on chain and len doesn't, it seems. I could be wrong
There was a problem hiding this comment.
I was thinking about just removing it, it sort of works like a mapping (symbol => token) instead of a list anyways
| default: str | None = None | ||
| default: str | None = None # TODO: Remove in v1.0 | ||
| required: list[ListInfo] = [] | ||
| order: list[str] | None = None |
There was a problem hiding this comment.
we should add validation here to make the names are actually installed
There was a problem hiding this comment.
I should probably add that upstream
What I did
fixes: #
How I did it
How to verify it
Checklist