Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type hint for @job and fix for run_locally #578

Merged
merged 9 commits into from
Apr 3, 2024
12 changes: 11 additions & 1 deletion src/jobflow/core/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import typing
import warnings
from dataclasses import dataclass, field
from typing import cast
from typing import cast, overload

from monty.json import MSONable, jsanitize
from typing_extensions import Self
Expand Down Expand Up @@ -68,6 +68,16 @@ class JobConfig(MSONable):
response_manager_config: dict = field(default_factory=dict)


@overload
def job(method: Callable = None) -> Callable[..., Job]:
pass


@overload
def job(method: Callable = None, **job_kwargs) -> Callable[..., Callable[..., Job]]:
pass


def job(method: Callable = None, **job_kwargs):
"""
Wrap a function to produce a :obj:`Job`.
Expand Down
2 changes: 1 addition & 1 deletion src/jobflow/managers/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def run_locally(
flow: jobflow.Flow | jobflow.Job | list[jobflow.Job],
log: bool = True,
store: jobflow.JobStore = None,
store: jobflow.JobStore | None = None,
create_folders: bool = False,
root_dir: str | Path | None = None,
ensure_success: bool = False,
Expand Down
Loading