Finds the lock with the key name that matches that given.
        :param name: the lock key to match
        :return: the found lock
329906
def find(self, name: str) -> Optional[ConnectedConsulLockInformation]:
        
        lock = self.consul_client.kv.get(name)[1]
        if lock is None:
            return None

        lock_information = json.loads(lock["Value"], cls=ConsulLockInformationJSONDecoder)
        return ConnectedConsulLockInformation(
            self, lock_information.key, lock_information.session_id, lock_information.created,
            lock_information.seconds_to_lock, lock_information.metadata)
351404
def get_foreign_key(self, name):
        
        name = self._normalize_identifier(name)

        if not self.has_foreign_key(name):
            raise ForeignKeyDoesNotExist(name, self._name)

        return self._fk_constraints[name]
824835
def getObjective(self, name):
        
        return lock_and_call(
            lambda: Objective(self._impl.getObjective(name)),
            self._lock
        )
230117
def getmember(self, name):
        '''
        
        '''
        members = self.getmembers()
        for m in members[::-1]:
            if m.name == name:
                return m

        raise KeyError("member %s could not be found" % name)
1297399
def get_name_curr(self, name):
        
        self._register_name(name)

        return self._var_name_mappers[name].get_current()
57391
def find_by_name(name):
    
    for format in FORMATS:
        if name == format.name:
            return format

    raise UnknownFormat('No format found with name "%s"' % name)
1115051
def _find_snapshot(self, name):
        
        remote_snapshots = self._get_snapshots(self.client)
        for remote in reversed(remote_snapshots):
            if remote["Name"] == name or \
                    re.match(name, remote["Name"]):
                return remote
        return None
123377
protected Properties getLockProperties(String name) {
        return lockProperties != null ? lockProperties.get(name) : null;
    }
782863
def getReferenceSetByName(self, name):
        
        if name not in self._referenceSetNameMap:
            raise exceptions.ReferenceSetNameNotFoundException(name)
        return self._referenceSetNameMap[name]
344634
public IEntityLock find(IEntityLock lock) throws LockingException {
        IEntityLock foundLock = null;
        Map m = getLockCache(lock.getEntityType());
        foundLock = getLockFromCache(getCacheKey(lock), m);

        if (foundLock != null) {
            if (lock.getLockType() != foundLock.getLockType()
                    || !lock.getExpirationTime().equals(foundLock.getExpirationTime())) {
                foundLock = null;
            }
        }

        return foundLock;
    }
356445
def acquire_lock(lock_name)
      begin
        acquired = false
        sql = lock_query(lock_name)
        connection.query(sql) do |result|
          acquired = result.fetch_row.first == "1"
        end
        acquired
      rescue ::Exception
        false
      end
    end
1278697
def find(self, name):
        
        for c in self.children:
            if c.name == name:
                return c
            result = c.find(name)
            if result:
                return result
505144
def __find(self, name):
        
        port = None
        if not len(self.__ports):
            raise Exception('No ports defined: %s' % self.__qn)
        if isinstance(name, int):
            qn = '%s[%d]' % (self.__qn, name)
            try:
                port = self.__ports[name]
            except IndexError:
                raise PortNotFound(qn)
        else:
            qn = '.'.join((self.__qn, name))
            for p in self.__ports:
                if name == p.name:
                    port = p
                    break
        if port is None:
            raise PortNotFound(qn)
        qn = '.'.join((self.__qn, port.name))
        return MethodSelector(self.__client, port.methods, qn)
6816
def get_name(self, key):
        '''
        '''
        try:
            return self.nameDict[key]
        except IndexError as e:
            print 'IndexError {0}: {1}'.format(e.errno, e.strerror)
539407
def find(cls, name):
        ''''''
        if not cls.mapping:  # pragma: no branch
            for _, obj in inspect.getmembers(exceptions):
                if inspect.isclass(obj):
                    if issubclass(obj, exceptions.NSQException):  # pragma: no branch
                        if hasattr(obj, 'name'):
                            cls.mapping[obj.name] = obj
        klass = cls.mapping.get(name)
        if klass == None:
            raise TypeError('No matching exception for %s' % name)
        return klass
1351900
def get_mor(self, key, name):
        
        with self._mor_lock:
            mors = self._mor[key]
            try:
                return mors[name]
            except KeyError:
                raise MorNotFoundError("Mor object '{}' is not in the cache.".format(name))
93945
def _get_name(self, key):
        
        if key in self.display_names:
            return self.display_names[key]

        return key.capitalize()