diff --git a/src/cdf/core/feature_flag/harness.py b/src/cdf/core/feature_flag/harness.py index 4308dcb..cbfedc6 100644 --- a/src/cdf/core/feature_flag/harness.py +++ b/src/cdf/core/feature_flag/harness.py @@ -1,5 +1,7 @@ """Harness feature flag provider.""" +from __future__ import annotations + import asyncio import logging import os diff --git a/src/cdf/core/logger.py b/src/cdf/core/logger.py index 21b9e1e..094945f 100644 --- a/src/cdf/core/logger.py +++ b/src/cdf/core/logger.py @@ -1,5 +1,7 @@ """Logger for CDF""" +from __future__ import annotations + import contextlib import logging import typing as t diff --git a/src/cdf/core/specification/base.py b/src/cdf/core/specification/base.py index aba0f6e..1253b48 100644 --- a/src/cdf/core/specification/base.py +++ b/src/cdf/core/specification/base.py @@ -1,5 +1,7 @@ """Base specification classes for continuous data framework components""" +from __future__ import annotations + import ast import importlib import inspect diff --git a/src/cdf/types/monads.py b/src/cdf/types/monads.py index fc359b6..5cc8a37 100644 --- a/src/cdf/types/monads.py +++ b/src/cdf/types/monads.py @@ -14,7 +14,9 @@ U = t.TypeVar("U") # The transformed type of the value inside the Monad K = t.TypeVar("K") # A known type that is not necessarily the same as T L = t.TypeVar("L") # A known type that is not necessarily the same as U -E = t.TypeVar("E", bound=BaseException, covariant=True) # The type of the error inside the Result +E = t.TypeVar( + "E", bound=BaseException, covariant=True +) # The type of the error inside the Result P = t.ParamSpec("P") TState = t.TypeVar("TState") # The type of the state @@ -269,7 +271,9 @@ def to_parts(self) -> t.Tuple[T, E | None]: pass @classmethod - def lift(cls, func: t.Callable[[U], K]) -> t.Callable[["U | Result[U, Exception]"], "Result[K, Exception]"]: + def lift( + cls, func: t.Callable[[U], K] + ) -> t.Callable[["U | Result[U, Exception]"], "Result[K, Exception]"]: """Transforms a function to work with arguments and output wrapped in Result monads. Args: @@ -304,7 +308,9 @@ def filter(self, predicate: t.Callable[[T], bool]) -> "Result[T, E]": ... def __call__(self, func: t.Callable[[T], "Result[U, E]"]) -> "Result[U, E]": ... - def __rshift__(self, func: t.Callable[[T], "Result[U, E]"]) -> "Result[U, E]": ... + def __rshift__( + self, func: t.Callable[[T], "Result[U, E]"] + ) -> "Result[U, E]": ... def __iter__(self) -> t.Iterator[T]: """Allows safely unwrapping the value of the Result using a for construct.""" @@ -656,7 +662,9 @@ async def _fut(): return cls(_fut) @classmethod - def lift(cls, func: t.Callable[[U], T]) -> t.Callable[["U | Promise[U]"], "Promise[T]"]: + def lift( + cls, func: t.Callable[[U], T] + ) -> t.Callable[["U | Promise[U]"], "Promise[T]"]: """ Lifts a synchronous function to work within the Promise context, making it return a Promise of the result and allowing it to be used @@ -834,10 +842,14 @@ def new_run_state(s: S) -> t.Tuple[A, S]: return State(new_run_state) def unwrap(self) -> A: - raise NotImplementedError("State cannot be directly unwrapped without providing an initial state.") + raise NotImplementedError( + "State cannot be directly unwrapped without providing an initial state." + ) def unwrap_or(self, default: B) -> t.Union[A, B]: - raise NotImplementedError("State cannot directly return a value without an initial state.") + raise NotImplementedError( + "State cannot directly return a value without an initial state." + ) def __hash__(self) -> int: return id(self.run_state) @@ -853,7 +865,9 @@ def __repr__(self) -> str: return f"State({self.run_state})" @classmethod - def lift(cls, func: t.Callable[[U], A]) -> t.Callable[["U | State[S, U]"], "State[S, A]"]: + def lift( + cls, func: t.Callable[[U], A] + ) -> t.Callable[["U | State[S, U]"], "State[S, A]"]: """Lifts a function to work within the State monad. Args: func: A function to lift.