Returns the function, if any, that encloses a given location.
481705
def encloses(self,
                 location: FileLocation
                 ) -> Optional[FunctionDesc]:
        
        for func in self.in_file(location.filename):
            if location in func.location:
                return func
        return None
856097
def get(location, **kwargs):
    
    provider = kwargs.get('provider', 'bing').lower().strip()
    method = kwargs.get('method', 'geocode').lower().strip()
    if isinstance(location, (list, dict)) and method == 'geocode':
        raise ValueError("Location should be a string")

    if provider not in options:
        raise ValueError("Invalid provider")

    else:
        if method not in options[provider]:
            raise ValueError("Invalid method")
    return options[provider][method](location, **kwargs)
384691
def _match(self, x, op, y):
        
        if (op not in self.condition_mapper):
            raise ValueError('Invalid where condition given')

        func = getattr(self, self.condition_mapper.get(op))
        return func(x, y)
852945
function unless(pred, f) {
  if(!isPredOrFunc(pred)) {
    throw new TypeError(
      'unless: Pred or predicate function required for first argument'
    )
  }

  if(!isFunction(f)) {
    throw new TypeError(
      'unless: Function required for second argument'
    )
  }

  return x =>
    !predOrFunc(pred, x) ? f(x) : x
}
1265081
function getFunctionCallType (func) {
  if (!(isExternalDirectCall(func) || isThisLocalCall(func) || isSuperLocalCall(func) || isLocalCall(func) || isLibraryCall(func))) throw new Error('staticAnalysisCommon.js: not function call Node')
  if (isExternalDirectCall(func) || isThisLocalCall(func) || isSuperLocalCall(func) || isLibraryCall(func)) return func.attributes.type
  return findFirstSubNodeLTR(func, exactMatch(nodeTypes.IDENTIFIER)).attributes.type
}
840512
def avail_locations(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudException(
            'The avail_locations function must be called with -f or --function.'
        )

    response = _query('avail', 'datacenters')

    ret = {}
    for item in response['DATA']:
        name = item['LOCATION']
        ret[name] = item

    return ret
96416
function findClosestPoint (sources, target) {
  const distances = [];
  let minDistance;

  sources.forEach(function (source, index) {
    const d = distance(source, target);

    distances.push(d);

    if (index === 0) {
      minDistance = d;
    } else {
      minDistance = Math.min(d, minDistance);
    }
  });

  const index = distances.indexOf(minDistance);


  return sources[index];
}
637817
def get(self, location_name):
        
        location_ref = location_helper(location_name, search_only=True)
        if location_ref:
            for location in self:
                if location.location_ref == location_ref:
                    return location
544545
function(location) {
			return this._getEntry(location).then(function(dirEntry) {
				return readEntries(dirEntry);
			}).then(function(entries) {
				return orion.Deferred.all(entries.map(createFile));
			});
		}
136242
def find(self, func: Callable[[K, T], bool]) -> TOption[T]:
        
        for k, v in self.items():
            if func(k, v):
                return TOption(v)
        return TOption(None)
331353
def indexOfClosest( arr, val ):
    ''''''
    i_closest = None
    for i,v in enumerate(arr):
        d = math.fabs( v - val )
        if i_closest == None or d < d_closest:
            i_closest = i
            d_closest = d
    return i_closest
770978
function getClosest(elem, selector) {
        while (elem !== document.body) {
            elem = elem.parentElement;
            var matches = typeof elem.matches == 'function' ? elem.matches(selector) : elem.msMatchesSelector(selector);

            if (matches) return elem;
        }
    }
1180545
def unlocked(func_or_obj):
    
    if ismethod(func_or_obj) or isfunction(func_or_obj):
        return _unlocked_method(func_or_obj)
    else:
        return _UnlockedAttribute(func_or_obj)
182082
def _getSuperFunc(self, s, func):
        """"""

        return getattr(super(self.cls(), s), func.__name__)
789421
function getPlaceholder(func) {
        var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
        return object.placeholder;
      }
1151258
function isInRange(node, location) {
    return node && node.range[0] <= location && location <= node.range[1];
}
551455
function or(f, g) {
  if(!(isPredOrFunc(f) && isPredOrFunc(g))) {
    throw new TypeError(
      'or: Preds or predicate functions required for first two arguments'
    )
  }

  return x =>
    !!(predOrFunc(f, x) || predOrFunc(g, x))
}