63 Commits

Author SHA1 Message Date
Lint Action
7513c2138f Fix code style issues with Black 2021-09-05 21:34:20 +00:00
Gnome!
53a6b2cb45
Revert "Merge pull request " ()
This reverts commit 42c0a8d8a5840c00185e367933e61e2565bf7305.
2021-09-05 10:37:51 -07:00
chillymosh
42c0a8d8a5
Merge pull request
* Clean up python

* Clean up bot python

* revert lists

* revert commands.bot completely

* extract raise_expected_coro further

* add new lines

* removed erroneous import

* remove hashed line
2021-09-02 12:32:46 -07:00
Nadir Chowdhury
a2a7b0f076
[tasks] Improve typing parity 2021-08-27 17:18:15 -04:00
Rapptz
ea2d972666 Make global log variable in modules private 2021-08-22 02:33:51 -04:00
NiumXp
76c9e390f1
remove repeat 'to' in Task.restart doc 2021-06-27 23:42:43 -04:00
Josh
42a538edda
[tasks] Replace None check with MISSING check in task loop 2021-05-15 02:10:00 -04:00
Josh
ef22178dee
[tasks] Type hint the tasks extension 2021-05-12 06:31:40 -04:00
Sebastian Law
f5727ff0d0
[tasks] fix regular task loops 2021-05-10 20:25:16 -04:00
Sebastian Law
8bc489dba8
[tasks] Add support for explicit time parameter 2021-05-09 23:27:43 -04:00
Steve C
ef9bb79e91
[tasks] Move the Loop's sleep to be before exit conditions
This change makes it more so that `Loop.stop()` gracefully makes the
current iteration the final one, by waiting AND THEN returning.
The current implementation is closer to `cancel`, while also not.

I encountered this because I was trying to run a
`@tasks.loop(count=1)`, and inside it I print some text and change the
interval, and in an `after_loop`, I restart the loop.

Without this change, it immediately floods my console, due to
not waiting before executing `after_loop`.
2021-04-16 22:35:18 -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
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
Sebastian Law
f7a4bef4ff
[tasks] remove redundant condition in Loop.next_iteration
self._task is only None if the Loop has never been started before, 
which means None should be returned always, regardless of how
many seconds was passed into the constructor

this didn't break anything before because self._next_iteration will
be None as well if self._task is None.
2021-02-28 23:54:44 -05:00
Nadir Chowdhury
63ec23bac2
Code optimisations and refactoring via Sourcery 2021-02-24 21:26:51 -05:00
Sebastian Law
ceab8ff638
[tasks] make __call__ actually appear in the docs 2021-02-21 07:19:10 -05:00
Nihaal Sangha
69bdc3a184
Change copyright year to present 2021-01-15 05:28:11 -05:00
Rapptz
6515f33978 [tasks] Fix a typo in documentation 2020-12-14 22:18:40 -05:00
Rapptz
0216db0c0a [tasks] Add support for manually calling the wrapped coroutine 2020-12-14 22:11:37 -05:00
Rapptz
ccdf4c4ad6 [tasks] Lazily fetch event loop if one isn't provided
Fixes 
2020-09-10 00:00:58 -04:00
Josh
6baacb2c23
[tasks] Don't update _next_iteration on retry 2020-08-28 23:12:07 -04:00
Dan Hess
fc951873a1
[tasks] Remove HTTPException as an exception to silently continue for 2020-08-05 03:09:04 -04:00
Rapptz
b8154e365f Rewrite gateway to use aiohttp instead of websockets 2020-07-25 09:59:38 -04:00
James
61216112d0 Add a licence and encoding declaration to missing files 2020-07-08 23:01:00 -04:00
Josh
6b5be39cd2
[tasks] Fix issue with default error handler in class context 2020-06-28 03:53:29 -04:00
Steve C
4b3a7fbe16 [tasks] Allow Loop.cancel in Loop.before_loop
Task cancel raises on the next awaited coro, so I've added this 0-sleep "hack"

I'm internally debating if leaving the comment there, but I'm sure it would confuse the uninformed of this trick.
2020-05-10 17:00:23 -04:00
Steve C
0fd5eca0d5 [tasks] Fix tasks decorators being discarded
At this moment, when a task seems to be first loaded, it immediately throws away the decorators you give it, and just generates a new instance of itself.

In your cog's `__init__`, once you do `self.my_task.start()`, the Loop is remade when it gets to `self.my_task` before executing the `start` function. The original Loop that the cog starts with is where the decorated values are. This fixes that.
2020-05-07 02:30:24 -04:00
Rapptz
540a88b762 [tasks] Replace stack-based implementation with a cleaner one. 2020-04-14 04:56:52 -04:00
Rapptz
d5211fb327 [tasks] Create different Loop objects for different instances
Fixes 
2020-04-14 04:35:49 -04:00
Josh B
20854de080 Allow for optional custom error handler in tasks extension 2020-04-04 03:11:25 -04:00
Epic
18c52671a9 Remove extra to in tasks docs 2020-04-04 03:09:21 -04:00
James
6a30f2749f [tasks] Add is_running property to Loop 2020-04-04 03:02:10 -04:00
Josh B
d0a1956be9 Improve usability of utils.sleep_until
Fix issue where sleeping for an extended period on python 3.5
would cause an exception

Add sleep_until to API docs

Add result argument to sleep_until
2020-01-21 20:28:14 -05:00
Rapptz
02397306b2 Drop superfluous zero in version related changes in the documentation 2020-01-21 03:47:56 -05:00
Rapptz
3149f15165 [tasks] Use new sleep_until util instead of internal function 2020-01-21 03:21:22 -05:00
Josh B
d7e925eb89 [tasks] Fix issue with next_iteration when task overruns time allotted 2020-01-21 03:18:25 -05:00
Josh B
a0b3e61b51 [tasks] Add Loop.next_iteration property 2020-01-20 07:22:21 -05:00
Rapptz
e1a237a0d3 Revert "[tasks] Add Loop.exception for more reliable exception retrieval."
This reverts commit 7a8c9e66d9c43a539fb78107ce3f51f16c7f30a2.
2019-11-19 21:59:39 -05:00
Rapptz
071c5b89e0 Revert "[tasks] Add support for explicit time parameter when running."
This reverts commit 9f822a1e6d904c4d7454ab77496b8a4f736073ab.
2019-11-19 21:59:27 -05:00
mathsman5133
7f65d9a8b1 [tasks] Add support for passing an argument list of exceptions. 2019-09-10 21:10:59 -04:00
Rapptz
9f822a1e6d [tasks] Add support for explicit time parameter when running.
Fixes 
2019-08-11 18:57:49 -04:00
Rapptz
7a8c9e66d9 [tasks] Add Loop.exception for more reliable exception retrieval. 2019-07-27 23:07:48 -04:00
Nihaal
9687740217 [tasks] Removed Returns from decorator docstring 2019-06-29 19:15:06 -04:00
NCPlayz
3c9bcc2851 Improve documentation 2019-06-07 19:27:46 -04:00
Suhail
db9a293f14 [tasks] Add version added note to Loop.change_interval 2019-05-19 19:17:28 -04:00
Suhail6inkling
aadb6953ff [tasks] Add way to change interval at run-time
PR:  
Fixes: 
2019-05-17 18:25:21 -04:00
Rapptz
6bc9d7c01a [tasks] Add indicator for internal task failure
Fixes 
2019-05-13 22:10:38 -04:00
Rapptz
a4a362b4c7 [tasks] Log exception when something failed to logging. 2019-05-13 22:08:31 -04:00
SnowyLuma
859ee751f9 [tasks] Return coro from before and after decorators 2019-05-13 20:29:07 -04:00