Beispiel #1
0
 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
Beispiel #2
0
 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
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
0
 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