Skip to content

Commit

Permalink
remove scheduled task references & update precommit (#85)
Browse files Browse the repository at this point in the history
- remove references to scheduled_task which was replaced by the Task object as decorator

* Changes:

- update pre-commit and hooks
- apply on all files
  • Loading branch information
devkral authored Oct 21, 2024
1 parent cb8d058 commit 5bce97e
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ insert_final_newline = true
indent_size = 2

[*.html]
insert_final_newline = true
insert_final_newline = true
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-toml
Expand All @@ -13,7 +13,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.5.1
rev: v0.7.0
hooks:
- id: ruff
args: ["--fix"]
Expand Down
6 changes: 1 addition & 5 deletions asyncz/tasks/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ def update_task( # type: ignore
else:
raise TypeError("fn must be a callable or a textual reference to a callable.")

if (
fn is not None
and not getattr(self, "name", None)
and updates.get("name", None) is None
):
if fn is not None and not getattr(self, "name", None) and updates.get("name") is None:
updates["name"] = get_callable_name(cast(Callable[..., Any], fn))

if isinstance(args, str) or not isinstance(args, Iterable):
Expand Down
2 changes: 1 addition & 1 deletion docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ Event relared to the running of a task within the executor.
* **scheduled_run_times** - The time when the task was scheduled to be run.
* **return_value** - The return value of the task successfully executed.
* **exception** - The exception raised by the task.
* **traceback** - A formated traceback for the exception.
* **traceback** - A formated traceback for the exception.
2 changes: 1 addition & 1 deletion docs/overrides/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
</ul>
</nav> {% endcomment %}

{% extends "base.html" %}
{% extends "base.html" %}
4 changes: 2 additions & 2 deletions docs/triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Use the `start_at` and `end_at` to provide a limit in which the scheduler should
{!> ../docs_src/triggers/interval/example2.py !}
```

What about using the `scheduled_task` decorator?
What about using `add_task` as decorator?

```python hl_lines="8"
{!> ../docs_src/triggers/interval/example3.py !}
Expand Down Expand Up @@ -246,7 +246,7 @@ Use the `start_at` and `end_at` to provide a limit in which the scheduler should
{!> ../docs_src/triggers/cron/example2.py !}
```

What about using the `scheduled_task` decorator?
What about using `add_task` as decorator?

```python hl_lines="7"
{!> ../docs_src/triggers/cron/example3.py !}
Expand Down
2 changes: 1 addition & 1 deletion docs_src/triggers/cron/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
scheduler = AsyncIOScheduler()


@scheduler.scheduled_task("cron", hours=1, id="my_task_id", day="last sat")
@scheduler.add_task("cron", hours=1, id="my_task_id", day="last sat")
def my_task():
logger.info("My task working")

Expand Down
2 changes: 1 addition & 1 deletion docs_src/triggers/interval/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


# Run every 5 hours
@scheduler.scheduled_task("interval", hours=5, id="my_task_id")
@scheduler.add_task("interval", hours=5, id="my_task_id")
def my_task():
logger.info("My task working")

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Source = "https://github.com/dymmond/asyncz"


[tool.hatch.envs.default]
dependencies = ["pre-commit>=2.17.0,<3.0.0", "ipdb", "types-tzlocal"]
dependencies = ["pre-commit>=3.0.0,<5.0.0", "ipdb", "types-tzlocal"]

[project.optional-dependencies]
localtime=["tzlocal"]
Expand Down Expand Up @@ -151,7 +151,7 @@ line-length=99
select = ["E", "W", "F", "C", "B", "I", "UP", "SIM"]
ignore = ["E501", "B008", "C901", "B026"]

exclude = ["docs_src/*"]
exclude = ["docs_src/*", ".pdbrc"]

[tool.ruff.lint.isort]
known-third-party = ["esmerald", "pydantic", "starlette"]
Expand Down
2 changes: 1 addition & 1 deletion vendors/apscheduler/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion vendors/notes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
All the vendors notes go in this folder.
All the vendors notes go in this folder.

0 comments on commit 5bce97e

Please sign in to comment.