Skip to content

Commit

Permalink
Included more Ruff rules and made them apply to tests and examples too
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Apr 27, 2024
1 parent 37e4eb1 commit 4ca9251
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
17 changes: 11 additions & 6 deletions pyproject.toml
Expand Up @@ -91,21 +91,26 @@ source = ["apscheduler"]
[tool.coverage.report]
show_missing = true

[tool.ruff]
lint.select = [
[tool.ruff.lint]
extend-select = [
"ASYNC", # flake8-async
"E", "F", "W", # default Flake8
"G", # flake8-logging-format
"I", # isort
"ISC", # flake8-implicit-str-concat
"PGH", # pygrep-hooks
"RUF100", # unused noqa (yesqa)
"RUF", # ruff specific rules
"TRIO", # trio/anyio rules
"UP", # pyupgrade
"W", # pycodestyle warnings
]
ignore = [
"RUF001",
"RUF002",
]
src = ["src"]

[tool.ruff.lint.isort]
"required-imports" = ["from __future__ import annotations"]
known-first-party = ["apscheduler"]
required-imports = ["from __future__ import annotations"]

[tool.mypy]
python_version = "3.10"
Expand Down
8 changes: 4 additions & 4 deletions src/apscheduler/_schedulers/async_.py
Expand Up @@ -456,14 +456,14 @@ async def add_schedule(
# For instance methods, use the unbound function as the function, and the
# "self" argument as the first positional argument
if ismethod(func_or_task_id):
args = (func_or_task_id.__self__,) + args
args = (func_or_task_id.__self__, *args)
func_or_task_id = func_or_task_id.__func__
elif (
isbuiltin(func_or_task_id)
and func_or_task_id.__self__ is not None
and not ismodule(func_or_task_id.__self__)
):
args = (func_or_task_id.__self__,) + args
args = (func_or_task_id.__self__, *args)
method_class = type(func_or_task_id.__self__)
func_or_task_id = getattr(method_class, func_or_task_id.__name__)

Expand Down Expand Up @@ -567,14 +567,14 @@ async def add_job(
# For instance methods, use the unbound function as the function, and the
# "self" argument as the first positional argument
if ismethod(func_or_task_id):
args = (func_or_task_id.__self__,) + args
args = (func_or_task_id.__self__, *args)
func_or_task_id = func_or_task_id.__func__
elif (
isbuiltin(func_or_task_id)
and func_or_task_id.__self__ is not None
and not ismodule(func_or_task_id.__self__)
):
args = (func_or_task_id.__self__,) + args
args = (func_or_task_id.__self__, *args)
method_class = type(func_or_task_id.__self__)
func_or_task_id = getattr(method_class, func_or_task_id.__name__)

Expand Down

0 comments on commit 4ca9251

Please sign in to comment.