feat(preset): add build and publish tasks
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user