px.input
용도
input port의 description·unit·required metadata를 parameter 기본값 자리에서 선언합니다. 타입은 여전히 일반 Python annotation이 정합니다.
문법
python
px.input(*, description: str, unit: str | None = None, required: bool = True)예제
python
from pipelinexlab import px
class CheckResults(px.Results):
ratio: float
@px.function(key="check_span", version="1.0.0", description="Checks a span.")
def check_span(
span: float = px.input(description="Clear span.", unit="m"),
) -> CheckResults:
return CheckResults(ratio=span / 10.0)매개변수
description— 이 input의 한 문장 설명.unit— RFC-003 unit code. 생략하면 단위 없음.required—False면 값 생략을 허용합니다.
반환
registry가 소비하는 내부 _PortSpec marker를 반환합니다. 함수 기본값 자리 밖에서는 사용하지 않습니다.
규칙
- parameter 이름이
portKey, annotation이 value type을 정합니다.px.input은 metadata만 더합니다. px.resultmarker를 input 자리에 쓰면 이름 있는 거부를 받습니다.