def input(klass: Type['InputContext'], context: VerediContext) -> Optional[str]: ''' Checks for & returns our input string or None. ''' input_ctx = context._get().get(klass.KEY, {}) input_id = input_ctx.get(InputLink.INPUT_SAFE, None) return input_id
def type(klass: Type['InputContext'], context: VerediContext) -> Union[int, enum.Enum]: ''' If there is a type id, get it. ''' input_ctx = context._get().get(klass.KEY, {}) type_id = input_ctx.get(InputLink.TYPE, None) return type_id
def source_designation(klass: Type['InputContext'], context: VerediContext) -> Optional[str]: ''' Checks for & returns our Input ID or InputId.INVALID. ''' input_ctx = context._get().get(klass.KEY, {}) designation = input_ctx.get(InputLink.SOURCE_DESIGNATION, None) return designation
def source_id(klass: Type['InputContext'], context: VerediContext) -> Union[int, 'MonotonicId']: ''' If there is a source id (EntityId, whatever), get it. ''' input_ctx = context._get().get(klass.KEY, {}) ident = input_ctx.get(InputLink.SOURCE_ID, None) return ident
def input_id(klass: Type['InputContext'], context: VerediContext) -> Optional[InputId]: ''' Checks for & returns our Input ID or InputId.INVALID. ''' input_ctx = context._get().get(klass.KEY, {}) input_id = input_ctx.get(InputLink.INPUT_ID, InputId.INVALID) return input_id