Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pomponchik committed Feb 23, 2024
1 parent e366d71 commit 5292d08
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/types_of_tokens/ConditionToken.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/types_of_tokens/SimpleToken.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion docs/what_are_tokens/cancel_and_read_the_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/what_are_tokens/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions docs/what_are_tokens/in_general.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion docs/what_are_tokens/summation.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/what_are_tokens/waiting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

0 comments on commit 5292d08

Please sign in to comment.