Skip to content

Commit db1c551

Browse files
committed
Solve minor misprints.
1 parent 5f43942 commit db1c551

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

cooldowns/trigger_cooldown.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ async def command():
113113
This call resulted in a cooldown being put into effect.
114114
"""
115115

116-
self.triggered = False
117-
118116
self.limit = limit
119117
self.time_period = time_period
120118
self.bucket = bucket
@@ -172,7 +170,6 @@ async def trigger(self, time_period: Union[float, datetime.timedelta]) -> None:
172170
time_period : `Union[float, datetime.timedelta]`
173171
The time period that cooldwon will remain triggered.
174172
"""
175-
self.triggered = True
176173
self.trigger_cooldown.time_period = (
177174
time_period
178175
if isinstance(time_period, (float, int))
@@ -217,6 +214,7 @@ def __call__(self, func: Callable) -> Callable:
217214
f"Expected `func` to be a coroutine, "
218215
f"found {func} of type {func.__class__.__name__!r} instead" # noqa
219216
)
217+
220218
# Links the cooldowns to the given function.
221219
_cooldown._func = func
222220
_trigger_cooldown._func = func
@@ -253,9 +251,7 @@ async def inner(*args, **kwargs):
253251
else:
254252
result = await func(*args, **kwargs)
255253
return result
256-
# If not, untrigger the cooldown.
257-
# else:
258-
# self.triggered = False
254+
259255
# If the cooldown is not triggered.
260256
# Runs the normal Cooldown.
261257
async with _cooldown(*args, **kwargs):
@@ -265,5 +261,6 @@ async def inner(*args, **kwargs):
265261
else:
266262
result = await func(*args, **kwargs)
267263
return result
264+
268265
# Return the decorator.
269266
return inner

tests/test_trigger_cooldown.py

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ async def test_2(*args, **kwargs):
4646
return 2
4747

4848
assert await test_1() == 1
49-
assert await test_2() == 2
5049

5150
with pytest.raises(CallableOnCooldown):
5251
await test_1()

0 commit comments

Comments
 (0)