feat(preset): add build and publish tasks

This commit is contained in:
2023-03-21 23:49:56 +03:00
parent 34dcb5a991
commit dd2aea32b8
5 changed files with 37 additions and 4 deletions
+12 -1
View File
@@ -3,7 +3,7 @@ from typing import Any, Optional
from ..core import Pipe
__all__ = ("GetPipe",)
__all__ = ("GetPipe", "KeyPipe")
class GetPipe(Pipe[dict, Any]):
@@ -19,3 +19,14 @@ class GetPipe(Pipe[dict, Any]):
if result:
result = result.get(key)
return result
class KeyPipe(Pipe[dict, Any]):
type = "key"
def __init__(self, keyindex: Optional[str]):
self._keyindex = int(keyindex) if keyindex else 0
def apply(self, value: dict, basepath: Path) -> Optional[Any]:
keys = list(value.keys())
return keys[self._keyindex]