def testing(klass: Type['ConfigContext'], context: VerediContext) -> Nullable[bool]: ''' Returns the unit-testing link field or Null. ''' unit_testing = context._sub_get(klass.KEY, ConfigLink.UNIT_TESTING) return unit_testing or Null()
def subproc(klass: Type['ConfigContext'], context: VerediContext) -> Nullable['SubToProcComm']: ''' Returns a SubToProcComm or Null. ''' comms = context._sub_get(klass.KEY, ConfigLink.SUB_PROC) return comms or Null()
def log_level(klass: Type['ConfigContext'], context: VerediContext) -> log.Level: ''' Returns log_level in `context` or Null. ''' return log.Level.to_logging( context._sub_get(klass.KEY, ConfigLink.LOG_LEVEL))
def log_is_server(klass: Type['ConfigContext'], context: VerediContext) -> bool: ''' Returns True if the process is a log_server. ''' # _sub_get() returns None if key not found, which is convenient for # converting to a bool. return bool(context._sub_get(klass.KEY, ConfigLink.LOG_SERVER))