Example #1
0
 def keychain(klass: Type['ConfigContext'],
              context: VerediContext) -> Nullable[Iterable[Any]]:
     '''
     Checks for a KEYCHAIN link in config's spot in this context.
     '''
     keychain = context.sub_get(ConfigLink.KEYCHAIN)
     return keychain
Example #2
0
    def id(klass: Type['ConfigContext'],
           context: VerediContext) -> Nullable[Any]:
        '''
        Checks for an ID link in config's spot in this context.

        If none, returns Null().
        '''
        id = context.sub_get(ConfigLink.ID)
        if not id:
            log.debug("No id in context! context.id: {}, ",
                      id,
                      context=context)
        return id
Example #3
0
    def path(klass: Type['ConfigContext'],
             context: VerediContext) -> Nullable[pathlib.Path]:
        '''
        Checks for a PATH link in config's spot in this context.

        If none, returns PATH from background.manager.data.
        '''
        path = context.sub_get(ConfigLink.PATH)
        if null_or_none(path):
            log.debug(
                "No path in context; using background's. "
                "context.path: {}, ",
                "bg.path: {}",
                path,
                background.manager.data.path,
                context=context)
            path = background.manager.data.path
        return path