Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

Some Progress

Compare
Choose a tag to compare
@b1naryth1ef b1naryth1ef released this 14 Oct 07:00
· 364 commits to master since this release

This release marks more types and APIs making their way into the library, improves performance in a few areas, adds a new custom HashMap type (replacing internal dictionaries), and various other changes/improvements/bugfixes.

Performance

This release introduces __slots__ usage on basically all stored model types. This improves memory usage, and also provides a more strict interface to the models (not allowing you to shimmy data into the model). There was also some improvements to the way gateway events are parsed which should result in faster event parsing.

Hash Map

This release also adds something very exciting, a custom dictionary type (using UserDict) which provides a whole set of utilities for working with stored data. Its easiest to see this interface with some simple examples:

guilds_with_15_users = state.guilds.find(lambda g: len(g.members) == 15)
first_guild_with_features = state.guilds.find_one(lambda g: len(g.features))

users_named_jeff = state.users.select(username="jeff")
user_named_joe = state.users.select_one(username="joe")

The hash map also overrides the most common Python dict functions to behave in a Python 3 generator-fashion (e.g. values() will always return a generator).

Webhooks

A basic implementation of webhooks was also introduced. The interface to this is still rather immature, so there will likely be some change and additional helper methods soon.