Skip to content

Commit

Permalink
fix: more pylint stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
kreczko committed Mar 20, 2024
1 parent 7913736 commit 04c9429
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ignore=CVS

# Add files or directories matching the regex patterns to the ignore-list. The
# regex matches against paths and can be in Posix or Windows format.
ignore-paths=
ignore-paths=^src/fasthep_flow/_version.py$

# Files or directories matching the regex patterns are skipped. The regex
# matches against base names, not paths.
Expand Down Expand Up @@ -87,7 +87,8 @@ disable=raw-checker-failed,
deprecated-pragma,
use-symbolic-message-instead,
import-outside-toplevel,
fixme
fixme,
super-init-not-called

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
1 change: 1 addition & 0 deletions src/fasthep_flow/_version.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Type hints for the version module."""
from __future__ import annotations

version: str
Expand Down
1 change: 1 addition & 0 deletions src/fasthep_flow/cli.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Command line interface for fasthep-flow."""
from __future__ import annotations

from pathlib import Path
Expand Down
15 changes: 9 additions & 6 deletions src/fasthep_flow/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Definitions for the configuration for describing the workflow."""

from __future__ import annotations

import importlib
Expand All @@ -22,20 +24,21 @@ class StageConfig:

@field_validator("type")
@classmethod
def validate_type(cls, v: str) -> str:
"""Validate the type field. Any specified type needs to be a Python class that can be imported"""
def validate_type(cls, value: str) -> str:
"""Validate the type field
Any specified type needs to be a Python class that can be imported"""
# Split the string to separate the module from the class name
module_path, class_name = v.rsplit(".", 1)
module_path, class_name = value.rsplit(".", 1)
try:
# Import the module
mod = importlib.import_module(module_path)
# this must be a class
getattr(mod, class_name)
except ImportError as e:
except ImportError as previous_error:
msg = f"Could not import {module_path}.{class_name}"
raise ValueError(msg) from e
raise ValueError(msg) from previous_error
# Return the original string if everything is fine
return v
return value

def resolve(self) -> Any:
"""Resolve the stage to a class."""
Expand Down
1 change: 1 addition & 0 deletions src/fasthep_flow/operators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Module for defining basic operators."""
from __future__ import annotations

from .base import Operator
Expand Down
4 changes: 3 additions & 1 deletion src/fasthep_flow/operators/base.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""Definition of the Operator protocol."""
from __future__ import annotations

from typing import Any, Protocol


class Operator(Protocol):
"""The base class for all operators.
Only named parameters are allowed, since we need to have a way to pass the YAML configuration to the operator.
Only named parameters are allowed,
since we need to have a way to pass the YAML configuration to the operator.
"""

def __call__(self, **kwargs: Any) -> dict[str, Any]:
Expand Down
1 change: 1 addition & 0 deletions src/fasthep_flow/operators/bash.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Bash related operators."""
from __future__ import annotations

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions src/fasthep_flow/workflow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Workflow and Task classes to define and execute a compute graph."""
from __future__ import annotations

from dataclasses import dataclass
Expand Down

0 comments on commit 04c9429

Please sign in to comment.