127 Commits

Author SHA1 Message Date
Rapptz
af8742a911 Use a specific tag type for member and user comparisons
The previous protocol based tag type caused significant overhead
(in the magnitude of seconds). Removing this should simplify object
creation by removing typing.Generic from the __mro__
2021-07-08 10:17:44 -04:00
Rapptz
cb2363f0fd Move global user storage from WeakValueDictionary to dict
Profiling showed that WeakValueDictionary caused rather significant
and noticeable slowdowns during startup. Since the only thing it was
used for was to automatically remove the key from the mapping when
the reference count reaches zero, the same could theoretically be
accomplished by using the __del__ special method. There is a chance
that this could lead to a memory leak since the __del__ method is not
always called, but the only instances of this happening are during
interpreter shutdown to my knowledge and at that point the mapping
is the least of my concern.
2021-07-07 20:19:17 -04:00
Rapptz
6f3b8072d6 Rework User.edit to have proper typing 2021-06-29 22:05:29 -04:00
Rapptz
f7d551953b Remove extraneous __slots__ assignments 2021-06-28 23:36:20 -04:00
Nadir Chowdhury
757cfad38f
Type up **kwargs of various methods 2021-05-10 20:24:48 -04:00
Josh
8b2241916a
Typehint Widget 2021-05-09 23:22:12 -04:00
David
66b17f5afb
Clarify ClientUser.verified docs 2021-04-30 19:12:40 -04:00
Rapptz
1c64689807 Remove lingering User.avatar documentation 2021-04-19 05:35:33 -04:00
Steve C
86f10f6dd6
Add missing reprs to some objects
These are WidgetMember, BaseUser, and DeletedReferencedMessage
2021-04-17 18:56:08 -04:00
Rapptz
9eaf1e85e4 Rewrite Asset design
This is a breaking change.

This does the following transformations, assuming `asset` represents
an asset type.

Object.is_asset_animated() => Object.asset.is_animated()
Object.asset => Object.asset.key
Object.asset_url => Object.asset_url
Object.asset_url_as => Object.asset.replace(...)

Since the asset type now requires a key (or hash, if you will),
Emoji had to be flattened similar to how Attachment was done since
these assets are keyed solely ID.

Emoji.url (Asset) => Emoji.url (str)
Emoji.url_as => removed
Emoji.url.read => Emoji.read
Emoji.url.save => Emoji.save

This transformation was also done to PartialEmoji.
2021-04-16 11:27:23 -04:00
Rapptz
1209585de5 Remove User.permissions_in
This seemed to only cause confusion.
2021-04-11 22:21:36 -04:00
Rapptz
99fc950510 Use f-strings in more places that were missed. 2021-04-08 06:02:47 -04:00
Nadir Chowdhury
89456022cf
Add __all__ to remaining modules 2021-04-07 02:30:32 -04:00
Rapptz
ff7094ce96 Convert datetimes to aware datetimes with UTC.
Naive datetimes will now be interpreted as local time throughout
the library.
2021-04-04 23:54:08 -04:00
Rapptz
54288879e2 Remove userbot functionality
This has a lot of legacy and cruft so there may be some stuff I've
missed but this first pass is enough to get a clear separation.
2021-04-04 10:15:30 -04:00
Rapptz
9d39b135f4 Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
2021-04-04 07:03:53 -04:00
Nadir Chowdhury
4d4c19f9b5
deprecate User.relationships 2021-03-28 18:39:15 -04:00
Alex Nørgaard
456a5dfa59
Update create_dm documentation to say it's a coroutine 2021-03-24 08:19:05 -04:00
Nadir Chowdhury
63ec23bac2
Code optimisations and refactoring via Sourcery 2021-02-24 21:26:51 -05:00
Nadir Chowdhury
427e387a2f
Deprecate non-bot methods 2021-02-23 03:36:37 -05:00
sudosnok
27c7fb6aed
Add User.mutual_guilds 2021-02-20 19:29:19 -05:00
Lucas
d7b41e0a21
Fix User public flags not updating 2021-01-17 00:09:15 -05:00
Nihaal Sangha
69bdc3a184
Change copyright year to present 2021-01-15 05:28:11 -05:00
Michael
93fa46713a
Fix and add documentation 2020-09-23 03:19:35 -04:00
Skezza
c3bca7ec73
Documentation formatting 2020-06-30 23:32:00 -04:00
Sebastian Law
b4b953bfc6
Fix various inconsistencies within the documentation (#5067) 2020-06-28 03:45:58 -04:00
JohnyTheCarrot
010ce0519a
Fix incorrect class reference in documentation 2020-06-04 23:38:57 -04:00
JohnyTheCarrot
ab5f995d78 Add support for public user flags 2020-05-29 22:40:14 -04:00
kittenswolf
6decfd1d1a Fix colour properties being displayed as methods in the documentation. 2020-05-03 15:40:13 -04:00
Harmon
6f9793fe5e Fixes and improvements for v1.3 documentation
* Add missing versionadded strings for v1.3
* Add missing versionchanged string for Message.edit
* Consistently use versionadded for attributes
* Consistently use versionchanged for parameters
* Use versionchanged for Bot.is_owner
* Fix references in v1.3 changelog
* Improve grammar in v1.3 changelog
2020-01-22 23:55:05 -05:00
Rapptz
6071607176 Bump copyright year to 2020
Closes #2510
2020-01-19 20:03:00 -05:00
Rapptz
c92ca4ee07 Add Profile.system and Profile.team_user to query newer flags 2019-12-21 07:46:15 -05:00
Rapptz
2de90fbecf Add User.system and MessageFlags.urgent 2019-12-21 07:39:33 -05:00
Merlintor
b458cc7b7d Return 'username' instead of 'name' 2019-12-05 17:59:42 +01:00
Devon R
bf9b9c5879 Adjust BASE urls to have no trailing slash (consistency) 2019-11-15 04:25:38 -05:00
Devon R
f5ebf42e1f Return invites as https, various URL normalization 2019-11-15 04:25:38 -05:00
Willy
e713b86154 Added Optional to ClientUser.premium_type type hint 2019-11-15 04:23:15 -05:00
Tyler
c7a1f5e6e9 Disambiguate and normalize documentation for non-bot only methods 2019-08-11 18:50:31 -04:00
Reece Dunham
de1a96b9f7 Fix: another capitalization issue in docstring 2019-07-18 18:06:42 -04:00
Steve C
ae4989e474 Fix return type docstring for BaseUser.default_avatar 2019-07-18 18:06:26 -04:00
Rapptz
5c1b239b47 Different method of upgrading user instances 2019-07-10 01:23:38 -04:00
Rapptz
e75c248a9a Properly populate __slots__ for derived user types.
Fixes #2265
2019-07-09 22:51:49 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Rapptz
fcf02414fe Fix stray colon in Asset related docstrings 2019-06-04 19:06:31 -04:00
Rapptz
9674055c2a Add support for animated guild icons. 2019-06-04 19:04:44 -04:00
Harmon
2fd589874f Fix wording in documentation for ClientUser.locale 2019-05-21 21:15:26 -04:00
Vexs
bf5b267c55 Correct the documentation for methods and properties that return Assets 2019-05-14 19:13:48 -04:00
Rapptz
f9e95a35f9 Fix USER_UPDATE changes not triggering for member instances.
Also add a ClientUser.locale attribute.
2019-04-28 06:36:12 -04:00
Rapptz
6f26a4aad8 Improve performance of value -> enum by about 5x. 2019-04-15 21:30:47 -04:00
Rapptz
cc68cfb896 Add notes to all relationship endpoints that they don't work on bots. 2019-04-14 22:18:14 -04:00