Пример #1
0
 def findInRemotesByHA(self, remoteHa: HA):
     remotes = [r for r in self.remotes.values() if r.ha == remoteHa]
     if len(remotes) > 1:
         raise DuplicateRemotes(remotes)
     if not remotes:
         raise RemoteNotFound(remoteHa)
     return remotes[0]
Пример #2
0
    def findInRemotesByName(self, name: str):
        """
        Find the remote by name.

        :param name: the name of the remote to find
        :raises: RemoteNotFound
        """
        remotes = [r for r in self.remotes.values() if r.name == name]
        if len(remotes) > 1:
            raise DuplicateRemotes(remotes)
        if not remotes:
            raise RemoteNotFound(name)
        return remotes[0]