From 5292d085eecf0df0fa416b225254ff6072f7af28 Mon Sep 17 00:00:00 2001 From: Evgeniy Blinov Date: Fri, 23 Feb 2024 23:53:51 +0300 Subject: [PATCH] documentation --- docs/types_of_tokens/ConditionToken.md | 2 +- docs/types_of_tokens/SimpleToken.md | 2 +- docs/what_are_tokens/cancel_and_read_the_status.md | 2 +- docs/what_are_tokens/exceptions.md | 8 ++++---- docs/what_are_tokens/in_general.md | 8 ++++---- docs/what_are_tokens/summation.md | 2 +- docs/what_are_tokens/waiting.md | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/types_of_tokens/ConditionToken.md b/docs/types_of_tokens/ConditionToken.md index e887876..a05a709 100644 --- a/docs/types_of_tokens/ConditionToken.md +++ b/docs/types_of_tokens/ConditionToken.md @@ -1,4 +1,4 @@ -`ConditionToken` has superpower: it can check arbitrary conditions. In addition to this, it can do all the same things as [`SimpleToken`](types_of_tokens/SimpleToken.md). The condition is a function that returns an answer to the question "has the token been canceled" (`True`/`False`), it is passed to the token as the first required argument during initialization: +`ConditionToken` has superpower: it can check arbitrary conditions. In addition to this, it can do all the same things as [`SimpleToken`](../types_of_tokens/SimpleToken.md). The condition is a function that returns an answer to the question "has the token been canceled" (`True`/`False`), it is passed to the token as the first required argument during initialization: ```python from cantok import ConditionToken diff --git a/docs/types_of_tokens/SimpleToken.md b/docs/types_of_tokens/SimpleToken.md index 924a038..c984dbc 100644 --- a/docs/types_of_tokens/SimpleToken.md +++ b/docs/types_of_tokens/SimpleToken.md @@ -18,4 +18,4 @@ print(repr(CounterToken(5) + TimeoutToken(5))) # SimpleToken(CounterToken(5, direct=True), TimeoutToken(5, monotonic=False)) ``` -There is not much more to tell about it if you have read [the story](what_are_tokens/in_general.md) about tokens in general. +There is not much more to tell about it if you have read [the story](../what_are_tokens/in_general.md) about tokens in general. diff --git a/docs/what_are_tokens/cancel_and_read_the_status.md b/docs/what_are_tokens/cancel_and_read_the_status.md index 4df8c3f..fbb2117 100644 --- a/docs/what_are_tokens/cancel_and_read_the_status.md +++ b/docs/what_are_tokens/cancel_and_read_the_status.md @@ -9,7 +9,7 @@ token.cancel() print(token.cancelled) # True ``` -The cancelled attribute is dynamically calculated and takes into account, among other things, specific conditions that are checked by a specific token. Here is an example with a [token that measures time](types_of_tokens/TimeoutToken.md): +The cancelled attribute is dynamically calculated and takes into account, among other things, specific conditions that are checked by a specific token. Here is an example with a [token that measures time](../types_of_tokens/TimeoutToken.md): ```python from time import sleep diff --git a/docs/what_are_tokens/exceptions.md b/docs/what_are_tokens/exceptions.md index d74195a..8fe7c28 100644 --- a/docs/what_are_tokens/exceptions.md +++ b/docs/what_are_tokens/exceptions.md @@ -11,10 +11,10 @@ token.check() Each type of token has a corresponding type of exception that can be raised in this case: -- [`SimpleToken`](types_of_tokens/SimpleToken.md) -> `CancellationError` -- [`ConditionToken`](types_of_tokens/ConditionToken.md) -> `ConditionCancellationError` -- [`TimeoutToken`](types_of_tokens/TimeoutToken.md) -> `TimeoutCancellationError` -- [`CounterToken`](types_of_tokens/CounterToken.md) -> `CounterCancellationError` +- [`SimpleToken`](../types_of_tokens/SimpleToken.md) -> `CancellationError` +- [`ConditionToken`](../types_of_tokens/ConditionToken.md) -> `ConditionCancellationError` +- [`TimeoutToken`](../types_of_tokens/TimeoutToken.md) -> `TimeoutCancellationError` +- [`CounterToken`](../types_of_tokens/CounterToken.md) -> `CounterCancellationError` When you call the `check()` method on any token, one of two things will happen. If it (or any of the tokens nested in it) was canceled by calling the `cancel()` method, `CancellationError` will always be raised. But if the cancellation occurred as a result of the unique ability of the token, such as for `TimeoutToken` - timeout expiration, then an exception specific to this type of token will be raised. diff --git a/docs/what_are_tokens/in_general.md b/docs/what_are_tokens/in_general.md index 0d2307f..25f2779 100644 --- a/docs/what_are_tokens/in_general.md +++ b/docs/what_are_tokens/in_general.md @@ -2,10 +2,10 @@ A token is an object that can tell you whether to continue the action you starte There are 4 types of tokens in this library: -- [`SimpleToken`](types_of_tokens/SimpleToken.md) -- [`ConditionToken`](types_of_tokens/ConditionToken.md) -- [`TimeoutToken`](types_of_tokens/TimeoutToken.md) -- [`CounterToken`](types_of_tokens/CounterToken.md) +- [`SimpleToken`](../types_of_tokens/SimpleToken.md) +- [`ConditionToken`](../types_of_tokens/ConditionToken.md) +- [`TimeoutToken`](../types_of_tokens/TimeoutToken.md) +- [`CounterToken`](../types_of_tokens/CounterToken.md) Each of them has its own characteristics, but they also have something in common: diff --git a/docs/what_are_tokens/summation.md b/docs/what_are_tokens/summation.md index 1e93934..641c17f 100644 --- a/docs/what_are_tokens/summation.md +++ b/docs/what_are_tokens/summation.md @@ -1,4 +1,4 @@ -Any tokens can be summed up among themselves. The summation operation generates another [`SimpleToken`](types_of_tokens/SimpleToken.md) that includes the previous 2: +Any tokens can be summed up among themselves. The summation operation generates another [`SimpleToken`](../types_of_tokens/SimpleToken.md) that includes the previous 2: ```python from cantok import SimpleToken, TimeoutToken diff --git a/docs/what_are_tokens/waiting.md b/docs/what_are_tokens/waiting.md index 7bd1c93..22bcebe 100644 --- a/docs/what_are_tokens/waiting.md +++ b/docs/what_are_tokens/waiting.md @@ -31,5 +31,5 @@ Yes, it looks like magic, it is magic. The method itself finds out how it was us In addition to the above, the `wait()` method has two optional arguments: -- **`timeout`** (`int` or `float`) - the maximum waiting time in seconds. If this time is exceeded, a [`TimeoutCancellationError` exception](what_are_tokens/waiting.md) will be raised. By default, the `timeout` is not set. +- **`timeout`** (`int` or `float`) - the maximum waiting time in seconds. If this time is exceeded, a [`TimeoutCancellationError` exception](../what_are_tokens/waiting.md) will be raised. By default, the `timeout` is not set. - **`step`** (`int` or `float`, by default `0.0001`) - the duration of the iteration, once in which the token state is polled, in seconds. For obvious reasons, you cannot set this value to a number that exceeds the `timeout`.