Skip to content

Commit

Permalink
fix type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Nov 28, 2024
1 parent 13e1f0b commit faa77b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/aiida_pythonjob/data/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_serializer_from_entry_points() -> dict:
eps = get_serializer_from_entry_points()


def serialize_to_aiida_nodes(inputs: dict | None = None) -> dict:
def serialize_to_aiida_nodes(inputs: dict) -> dict:
"""Serialize the inputs to a dictionary of AiiDA data nodes.
Args:
Expand Down
25 changes: 13 additions & 12 deletions src/aiida_pythonjob/launch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import inspect
import os
from typing import Any, Callable
from typing import Any, Callable, Dict, Optional, Union

from aiida.orm import AbstractCode, Computer, FolderData, List, SinglefileData, Str

Expand All @@ -10,18 +10,19 @@


def prepare_pythonjob_inputs(
function: Callable[..., Any] | None = None,
function_inputs: dict[str, Any] | None = None,
function_outputs: dict[str, Any] | None = None,
code: AbstractCode | None = None,
command_info: dict[str, str] | None = None,
computer: str | Computer = "localhost",
metadata: dict[str, Any] | None = None,
upload_files: dict[str, str] = {},
process_label: str | None = None,
pickled_function: PickledFunction | None = None,
function: Optional[Callable[..., Any]] = None,
function_inputs: Optional[Dict[str, Any]] = None,
function_outputs: Optional[Dict[str, Any]] = None,
code: Optional[AbstractCode] = None,
command_info: Optional[Dict[str, str]] = None,
computer: Union[str, Computer] = "localhost",
metadata: Optional[Dict[str, Any]] = None,
upload_files: Dict[str, str] = {},
process_label: Optional[str] = None,
pickled_function: Optional[PickledFunction] = None,
**kwargs: Any,
) -> dict[str, Any]:
) -> Dict[str, Any]:
pass
"""Prepare the inputs for PythonJob"""

if function is None and pickled_function is None:
Expand Down
6 changes: 3 additions & 3 deletions src/aiida_pythonjob/utils.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from typing import Optional
from typing import Optional, Union

from aiida.common.exceptions import NotExistent
from aiida.orm import Computer, InstalledCode, load_code, load_computer


def get_or_create_code(
label: str = "python3",
computer: Optional[str | Computer] = "localhost",
computer: Optional[Union[str, "Computer"]] = "localhost",
filepath_executable: Optional[str] = None,
prepend_text: str = "",
):
) -> InstalledCode:
"""Try to load code, create if not exit."""

try:
Expand Down

0 comments on commit faa77b3

Please sign in to comment.