fred-oss 0.18.0__tar.gz → 0.20.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fred_oss-0.18.0/src/main/fred_oss.egg-info → fred_oss-0.20.0}/PKG-INFO +1 -1
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/comp/_keyval.py +16 -3
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/comp/_queue.py +23 -0
- fred_oss-0.20.0/src/main/fred/dao/service/_stdlib.py +54 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/service/catalog.py +2 -0
- fred_oss-0.20.0/src/main/fred/monad/__init__.py +11 -0
- fred_oss-0.20.0/src/main/fred/monad/_either.py +93 -0
- fred_oss-0.20.0/src/main/fred/monad/catalog.py +11 -0
- fred_oss-0.20.0/src/main/fred/monad/interface.py +22 -0
- fred_oss-0.20.0/src/main/fred/version +1 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0/src/main/fred_oss.egg-info}/PKG-INFO +1 -1
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred_oss.egg-info/SOURCES.txt +5 -0
- fred_oss-0.18.0/src/main/fred/version +0 -1
- {fred_oss-0.18.0 → fred_oss-0.20.0}/MANIFEST.in +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/NOTICE.txt +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/README.md +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/requirements.txt +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/setup.cfg +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/setup.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/cli/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/cli/__main__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/cli/interface.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/cli/main.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/comp/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/comp/catalog.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/comp/interface.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/service/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/service/_redis.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/service/interface.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/dao/service/utils.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/cli_ext.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/runtime.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/runtimes/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/runtimes/scanner.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/runtimes/sync.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/wrappers/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/runpod/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/runpod/cli_ext.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/runpod/helper.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/maturity.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/settings.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/utils/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/utils/dateops.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/utils/runtime.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/version.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/interface.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/client.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/handler.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/info.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/plugins/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/plugins/_local.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/plugins/catalog.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/plugins/interface.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/rest/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/rest/cli_ext.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/rest/routers/__init__.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/rest/routers/_runner.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/rest/routers/catalog.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/rest/routers/interface.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/rest/server.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/worker/runner/utils.py +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred_oss.egg-info/dependency_links.txt +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred_oss.egg-info/entry_points.txt +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred_oss.egg-info/requires.txt +0 -0
- {fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred_oss.egg-info/top_level.txt +0 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
|
+
from fred.settings import logger_manager
|
|
4
5
|
from fred.dao.service.catalog import ServiceCatalog
|
|
5
6
|
from fred.dao.comp.interface import ComponentInterface
|
|
6
7
|
|
|
8
|
+
logger = logger_manager.get_logger(name=__name__)
|
|
9
|
+
|
|
7
10
|
|
|
8
11
|
@dataclass(frozen=True, slots=True)
|
|
9
12
|
class FredKeyVal(ComponentInterface):
|
|
@@ -34,6 +37,11 @@ class FredKeyVal(ComponentInterface):
|
|
|
34
37
|
expire = kwargs.get("expire")
|
|
35
38
|
if expire and isinstance(expire, int):
|
|
36
39
|
self._srv.client.expire(key, expire)
|
|
40
|
+
case ServiceCatalog.STDLIB:
|
|
41
|
+
self._srv.client._memstore_keyval[key] = value
|
|
42
|
+
# TODO: Implement expiration logic
|
|
43
|
+
if "expire" in kwargs:
|
|
44
|
+
logger.warning("Expiration not implemented for STDLIB service.")
|
|
37
45
|
case _:
|
|
38
46
|
raise NotImplementedError(f"Set method not implemented for service {self._nme}")
|
|
39
47
|
|
|
@@ -53,14 +61,17 @@ class FredKeyVal(ComponentInterface):
|
|
|
53
61
|
NotImplementedError: If the method is not implemented for the current service.
|
|
54
62
|
"""
|
|
55
63
|
key = key or self.key
|
|
64
|
+
result = None
|
|
56
65
|
match self._cat:
|
|
57
66
|
case ServiceCatalog.REDIS:
|
|
58
67
|
result = self._srv.client.get(key)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return result
|
|
68
|
+
case ServiceCatalog.STDLIB:
|
|
69
|
+
result = self._srv.client._memstore_keyval.get(key)
|
|
62
70
|
case _:
|
|
63
71
|
raise NotImplementedError(f"Get method not implemented for service {self._nme}")
|
|
72
|
+
if fail and result is None:
|
|
73
|
+
raise KeyError(f"Key {key} not found.")
|
|
74
|
+
return result
|
|
64
75
|
|
|
65
76
|
def delete(self, key: Optional[str] = None) -> None:
|
|
66
77
|
"""Deletes a key-value pair from the store.
|
|
@@ -76,5 +87,7 @@ class FredKeyVal(ComponentInterface):
|
|
|
76
87
|
match self._cat:
|
|
77
88
|
case ServiceCatalog.REDIS:
|
|
78
89
|
self._srv.client.delete(key)
|
|
90
|
+
case ServiceCatalog.STDLIB:
|
|
91
|
+
self._srv.client._memstore_keyval.pop(key, None)
|
|
79
92
|
case _:
|
|
80
93
|
raise NotImplementedError(f"Delete method not implemented for service {self._nme}")
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
|
+
from fred.settings import logger_manager
|
|
4
5
|
from fred.dao.service.catalog import ServiceCatalog
|
|
5
6
|
from fred.dao.comp.interface import ComponentInterface
|
|
6
7
|
|
|
8
|
+
logger = logger_manager.get_logger(name=__name__)
|
|
9
|
+
|
|
7
10
|
|
|
8
11
|
@dataclass(frozen=True, slots=True)
|
|
9
12
|
class FredQueue(ComponentInterface):
|
|
@@ -29,6 +32,9 @@ class FredQueue(ComponentInterface):
|
|
|
29
32
|
match self._cat:
|
|
30
33
|
case ServiceCatalog.REDIS:
|
|
31
34
|
return self._srv.client.llen(self.name)
|
|
35
|
+
case ServiceCatalog.STDLIB:
|
|
36
|
+
q = self._srv.client._memstore_queue.get(self.name, None)
|
|
37
|
+
return q.qsize() if q else 0
|
|
32
38
|
case _:
|
|
33
39
|
raise NotImplementedError(f"Size method not implemented for service {self._nme}")
|
|
34
40
|
|
|
@@ -43,6 +49,9 @@ class FredQueue(ComponentInterface):
|
|
|
43
49
|
match self._cat:
|
|
44
50
|
case ServiceCatalog.REDIS:
|
|
45
51
|
self._srv.client.delete(self.name)
|
|
52
|
+
case ServiceCatalog.STDLIB:
|
|
53
|
+
if (q := self._srv.client._memstore_queue.pop(self.name, None)):
|
|
54
|
+
del q
|
|
46
55
|
case _:
|
|
47
56
|
raise NotImplementedError(f"Clear method not implemented for service {self._nme}")
|
|
48
57
|
|
|
@@ -59,6 +68,11 @@ class FredQueue(ComponentInterface):
|
|
|
59
68
|
match self._cat:
|
|
60
69
|
case ServiceCatalog.REDIS:
|
|
61
70
|
self._srv.client.lpush(self.name, item)
|
|
71
|
+
case ServiceCatalog.STDLIB:
|
|
72
|
+
from queue import Queue
|
|
73
|
+
qs = self._srv.client._memstore_queue
|
|
74
|
+
q = qs[self.name] = qs.get(self.name, None) or Queue()
|
|
75
|
+
q.put(item)
|
|
62
76
|
case _:
|
|
63
77
|
raise NotImplementedError(f"Add method not implemented for service {self._srv._nme}")
|
|
64
78
|
|
|
@@ -75,5 +89,14 @@ class FredQueue(ComponentInterface):
|
|
|
75
89
|
match self._cat:
|
|
76
90
|
case ServiceCatalog.REDIS:
|
|
77
91
|
return self._srv.client.rpop(self.name)
|
|
92
|
+
case ServiceCatalog.STDLIB:
|
|
93
|
+
from queue import Empty
|
|
94
|
+
if not (q := self._srv.client._memstore_queue.get(self.name, None)):
|
|
95
|
+
return None
|
|
96
|
+
try:
|
|
97
|
+
return q.get_nowait()
|
|
98
|
+
except Empty:
|
|
99
|
+
logger.info(f"Queue '{self.name}' is empty.")
|
|
100
|
+
return None
|
|
78
101
|
case _:
|
|
79
102
|
raise NotImplementedError(f"Pop method not implemented for service {self._srv._nme}")
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from queue import Queue
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from fred.utils.runtime import RuntimeInfo
|
|
6
|
+
from fred.dao.service.interface import ServiceConnectionPoolInterface, ServiceInterface
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class StdLibSingleton:
|
|
10
|
+
_instance: Optional["StdLib"] = None
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def get_instance(cls, **kwargs) -> "StdLib":
|
|
14
|
+
if cls._instance is None:
|
|
15
|
+
cls._instance = StdLib.auto(**kwargs)
|
|
16
|
+
return cls._instance
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(frozen=True, slots=True)
|
|
20
|
+
class StdLib:
|
|
21
|
+
runtime_info: RuntimeInfo
|
|
22
|
+
_memstore_keyval: dict[str, str]
|
|
23
|
+
_memstore_queue: dict[str, Queue]
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def auto(cls, **kwargs) -> "StdLib":
|
|
27
|
+
_memstore_keyval = kwargs.pop("memstore_keyval", {})
|
|
28
|
+
_memstore_queue = kwargs.pop("memstore_queue", {})
|
|
29
|
+
return cls(
|
|
30
|
+
runtime_info=RuntimeInfo.auto(**kwargs),
|
|
31
|
+
_memstore_keyval=_memstore_keyval,
|
|
32
|
+
_memstore_queue=_memstore_queue,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class StdLibConnectionPool(ServiceConnectionPoolInterface[StdLibSingleton]):
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def _create_pool(cls, **kwargs) -> StdLibSingleton:
|
|
40
|
+
return StdLibSingleton(**kwargs)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class StdLibService(ServiceInterface[StdLib]):
|
|
44
|
+
instance: StdLib
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def _create_instance(cls, **kwargs) -> StdLib:
|
|
48
|
+
pool = StdLibConnectionPool.get_or_create_pool(**kwargs)
|
|
49
|
+
return pool.get_instance(**kwargs)
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def auto(cls, **kwargs) -> "StdLib":
|
|
53
|
+
cls.instance = cls._create_instance(**kwargs)
|
|
54
|
+
return cls(**kwargs)
|
|
@@ -4,11 +4,13 @@ from typing import TypeVar, Optional
|
|
|
4
4
|
|
|
5
5
|
from fred.dao.service.interface import ServiceInterface
|
|
6
6
|
from fred.dao.service._redis import RedisService
|
|
7
|
+
from fred.dao.service._stdlib import StdLibService
|
|
7
8
|
|
|
8
9
|
T = TypeVar("T")
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class ServiceCatalog(enum.Enum):
|
|
13
|
+
STDLIB = StdLibService
|
|
12
14
|
REDIS = RedisService
|
|
13
15
|
|
|
14
16
|
@classmethod
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from fred.maturity import Maturity, MaturityLevel
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
module_maturity = Maturity(
|
|
5
|
+
level=MaturityLevel.ALPHA,
|
|
6
|
+
reference=__name__,
|
|
7
|
+
message=(
|
|
8
|
+
"Fred-Monad implementation is in early development "
|
|
9
|
+
"and therefore currently with incomplete and unstable features."
|
|
10
|
+
)
|
|
11
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from functools import wraps
|
|
3
|
+
from typing import (
|
|
4
|
+
Callable,
|
|
5
|
+
Generic,
|
|
6
|
+
Generator,
|
|
7
|
+
TypeVar,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
from fred.settings import logger_manager
|
|
11
|
+
from fred.monad.interface import MonadInterface
|
|
12
|
+
|
|
13
|
+
logger = logger_manager.get_logger(__name__)
|
|
14
|
+
|
|
15
|
+
A = TypeVar("A")
|
|
16
|
+
B = TypeVar("B")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(frozen=True, slots=True)
|
|
20
|
+
class EitherWrapper(Generic[A]):
|
|
21
|
+
function: Callable[..., A]
|
|
22
|
+
|
|
23
|
+
def __call__(self, *args, **kwargs) -> A:
|
|
24
|
+
return self.function(*args, **kwargs)
|
|
25
|
+
|
|
26
|
+
def either(self, *args, **kwargs)-> 'Either[A]':
|
|
27
|
+
try:
|
|
28
|
+
return Right[A].from_value(val=self.function(*args, **kwargs))
|
|
29
|
+
except Exception as e:
|
|
30
|
+
return Left(exception=e)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Either(MonadInterface[A]):
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def comprehension(cls, generator: Generator):
|
|
37
|
+
try:
|
|
38
|
+
return Either.from_value(val=next(generator))
|
|
39
|
+
except Exception as e:
|
|
40
|
+
return Left(exception=e)
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def decorator(cls, function: Callable):
|
|
44
|
+
return wraps(function, updated=())(EitherWrapper(function=function))
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def from_value(cls, val: A) -> 'Either[A]':
|
|
48
|
+
if isinstance(val, Exception):
|
|
49
|
+
return Left(exception=val)
|
|
50
|
+
return Right(value=val)
|
|
51
|
+
|
|
52
|
+
def resolve(self) -> A:
|
|
53
|
+
match self:
|
|
54
|
+
case Right(value=value):
|
|
55
|
+
return value
|
|
56
|
+
case Left(exception=exception):
|
|
57
|
+
raise exception
|
|
58
|
+
case _:
|
|
59
|
+
raise TypeError("Unknown Either type")
|
|
60
|
+
|
|
61
|
+
def __iter__(self) -> Generator[A, None, None]:
|
|
62
|
+
match self:
|
|
63
|
+
case Right(value=value):
|
|
64
|
+
yield from [value]
|
|
65
|
+
case Left(exception=exception):
|
|
66
|
+
logger.warning(f"Attempted to iterate over Left: {exception}")
|
|
67
|
+
yield from []
|
|
68
|
+
case _:
|
|
69
|
+
raise TypeError("Unknown Either type")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclass(frozen=True, slots=True)
|
|
73
|
+
class Right(Either[A]):
|
|
74
|
+
value: A
|
|
75
|
+
|
|
76
|
+
def flat_map(self, function: Callable[[A], Either[B]]) -> Either[B]:
|
|
77
|
+
try:
|
|
78
|
+
return function(self.value)
|
|
79
|
+
except Exception as e:
|
|
80
|
+
logger.exception(f"Error in flat_map: {e}")
|
|
81
|
+
# Consider that a right that fails is a left
|
|
82
|
+
return Left(exception=e)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass(frozen=True, slots=True)
|
|
86
|
+
class Left(Either[A]):
|
|
87
|
+
exception: Exception
|
|
88
|
+
|
|
89
|
+
def flat_map(self, function: Callable[[A], Either[B]]) -> Either[B]:
|
|
90
|
+
return Left(exception=self.exception) # Propagate exception
|
|
91
|
+
|
|
92
|
+
def map(self, function: Callable[[A], B]) -> Either[B]:
|
|
93
|
+
return Left(exception=self.exception) # Propagate exception
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
from fred.monad._either import Either, Left, Right
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class MonadCatalog(enum.Enum):
|
|
7
|
+
"""Enum representing the different types of Monads."""
|
|
8
|
+
EITHER = type("Either", (Either,), {"Left": Left, "Right": Right})
|
|
9
|
+
|
|
10
|
+
def __call__(self, *args, **kwargs):
|
|
11
|
+
return self.value.from_value(*args, **kwargs)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from typing import (
|
|
2
|
+
Callable,
|
|
3
|
+
Generic,
|
|
4
|
+
TypeVar,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
A = TypeVar("A")
|
|
8
|
+
B = TypeVar("B")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MonadInterface(Generic[A]):
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def from_value(cls, val: A) -> 'MonadInterface[A]':
|
|
15
|
+
raise NotImplementedError
|
|
16
|
+
|
|
17
|
+
def flat_map(self, function: Callable[[A], 'MonadInterface[B]']) -> 'MonadInterface[B]':
|
|
18
|
+
raise NotImplementedError
|
|
19
|
+
|
|
20
|
+
def map(self, function: Callable[[A], B]) -> 'MonadInterface[B]':
|
|
21
|
+
# Map can be implemented using flat_map to avoid code duplication and ensure consistency
|
|
22
|
+
return self.flat_map(function=lambda value: type(self).from_value(function(value)))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.20.0
|
|
@@ -19,6 +19,7 @@ src/main/fred/dao/comp/catalog.py
|
|
|
19
19
|
src/main/fred/dao/comp/interface.py
|
|
20
20
|
src/main/fred/dao/service/__init__.py
|
|
21
21
|
src/main/fred/dao/service/_redis.py
|
|
22
|
+
src/main/fred/dao/service/_stdlib.py
|
|
22
23
|
src/main/fred/dao/service/catalog.py
|
|
23
24
|
src/main/fred/dao/service/interface.py
|
|
24
25
|
src/main/fred/dao/service/utils.py
|
|
@@ -33,6 +34,10 @@ src/main/fred/integrations/databricks/wrappers/dbutils.py
|
|
|
33
34
|
src/main/fred/integrations/runpod/__init__.py
|
|
34
35
|
src/main/fred/integrations/runpod/cli_ext.py
|
|
35
36
|
src/main/fred/integrations/runpod/helper.py
|
|
37
|
+
src/main/fred/monad/__init__.py
|
|
38
|
+
src/main/fred/monad/_either.py
|
|
39
|
+
src/main/fred/monad/catalog.py
|
|
40
|
+
src/main/fred/monad/interface.py
|
|
36
41
|
src/main/fred/utils/__init__.py
|
|
37
42
|
src/main/fred/utils/dateops.py
|
|
38
43
|
src/main/fred/utils/runtime.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.18.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/runtimes/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/runtimes/scanner.py
RENAMED
|
File without changes
|
|
File without changes
|
{fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/wrappers/__init__.py
RENAMED
|
File without changes
|
{fred_oss-0.18.0 → fred_oss-0.20.0}/src/main/fred/integrations/databricks/wrappers/dbutils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|