Skip to content

Commit

Permalink
Merge pull request #26 from pomponchik/develop
Browse files Browse the repository at this point in the history
0.0.21
  • Loading branch information
pomponchik authored Feb 17, 2024
2 parents 9fe0c5f + 9abeb2c commit 7d6fc84
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 25 deletions.
Binary file removed docs/docs/assets/favicon.ico
Binary file not shown.
Binary file removed docs/docs/assets/logo_6.png
Binary file not shown.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/docs/quick_start.md → docs/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ while token:
print(counter)
```

In this code, we use a token that describes several restrictions: on the [number of iterations](/docs/types_of_tokens/CounterToken/) of the cycle, on [time](/docs/types_of_tokens/TimeoutToken/), as well as on the [occurrence](/docs/types_of_tokens/ConditionToken/) of a random unlikely event. When any of the indicated events occur, the cycle stops.
In this code, we use a token that describes several restrictions: on the [number of iterations](/types_of_tokens/CounterToken/) of the cycle, on [time](/types_of_tokens/TimeoutToken/), as well as on the [occurrence](/types_of_tokens/ConditionToken/) of a random unlikely event. When any of the indicated events occur, the cycle stops.

In fact, the library's capabilities are much broader, read the documentation below.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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](/docs/what_are_tokens/in_general/) about tokens in general.
There is not much more to tell about it if you have read [the story](/what_are_tokens/in_general/) about tokens in general.
File renamed without changes.
File renamed without changes.
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`](/docs/types_of_tokens/SimpleToken/) -> `CancellationError`
- [`ConditionToken`](/docs/types_of_tokens/ConditionToken/) -> `ConditionCancellationError`
- [`TimeoutToken`](/docs/types_of_tokens/TimeoutToken/) -> `TimeoutCancellationError`
- [`CounterToken`](/docs/types_of_tokens/CounterToken/) -> `CounterCancellationError`
- [`SimpleToken`](/types_of_tokens/SimpleToken/) -> `CancellationError`
- [`ConditionToken`](/types_of_tokens/ConditionToken/) -> `ConditionCancellationError`
- [`TimeoutToken`](/types_of_tokens/TimeoutToken/) -> `TimeoutCancellationError`
- [`CounterToken`](/types_of_tokens/CounterToken/) -> `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
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`](/docs/types_of_tokens/SimpleToken/)
- [`ConditionToken`](/docs/types_of_tokens/ConditionToken/)
- [`TimeoutToken`](/docs/types_of_tokens/TimeoutToken/)
- [`CounterToken`](/docs/types_of_tokens/CounterToken/)
- [`SimpleToken`](/types_of_tokens/SimpleToken/)
- [`ConditionToken`](/types_of_tokens/ConditionToken/)
- [`TimeoutToken`](/types_of_tokens/TimeoutToken/)
- [`CounterToken`](/types_of_tokens/CounterToken/)

Each of them has its own characteristics, but they also have something in common:

Expand Down
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`](/docs/types_of_tokens/SimpleToken/) that includes the previous 2:
Any tokens can be summed up among themselves. The summation operation generates another [`SimpleToken`](/types_of_tokens/SimpleToken/) that includes the previous 2:

```python
from cantok import SimpleToken, TimeoutToken
Expand Down
File renamed without changes.
26 changes: 13 additions & 13 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ theme:
repo_url: https://github.com/pomponchik/cantok
docs_dir: docs
nav:
- Installation: docs/installation.md
- Quick start: docs/quick_start.md
- The pattern: docs/the_pattern.md
- Installation: installation.md
- Quick start: quick_start.md
- The pattern: the_pattern.md
- What are tokens:
- In general: docs/what_are_tokens/in_general.md
- Embedding one into another: docs/what_are_tokens/embedding.md
- Cancel and read the status: docs/what_are_tokens/cancel_and_read_the_status.md
- Exceptions: docs/what_are_tokens/exceptions.md
- Summation: docs/what_are_tokens/summation.md
- Waiting for cancellation: docs/what_are_tokens/waiting.md
- In general: what_are_tokens/in_general.md
- Embedding one into another: what_are_tokens/embedding.md
- Cancel and read the status: what_are_tokens/cancel_and_read_the_status.md
- Exceptions: what_are_tokens/exceptions.md
- Summation: what_are_tokens/summation.md
- Waiting for cancellation: what_are_tokens/waiting.md
- Types of tokens:
- SimpleToken: docs/types_of_tokens/SimpleToken.md
- ConditionToken: docs/types_of_tokens/ConditionToken.md
- TimeoutToken: docs/types_of_tokens/TimeoutToken.md
- CounterToken: docs/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
markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "cantok"
version = "0.0.20"
version = "0.0.21"
authors = [
{ name="Evgeniy Blinov", email="[email protected]" },
]
Expand Down

0 comments on commit 7d6fc84

Please sign in to comment.