Core.Client.request_search location parameter should be a dictionary that contains lat, lon and radius floats
435356
def search_location_check(cls, location):
        
        if not (isinstance(location, Mapping) and set(location.keys()) == _LOCATION_SEARCH_ARGS):
            raise ValueError('Search location should be mapping with keys: %s' % _LOCATION_SEARCH_ARGS)

        cls.location_check(location['lat'], location['long'])
        radius = location['radius']
        if not (isinstance(radius, number_types) and 0 < radius <= 20038):  # half circumference
            raise ValueError("Radius: '{radius}' is invalid".format(radius=radius))
93756
function geoLocationToCamelCase (obj) {
  const 
    converted = {},
    keys = Object.keys(obj);
  let i; // NOSONAR

  for(i = 0; i < keys.length; i++) {
    const
      k = keys[i],
      idx = ['lat_lon', 'top_left', 'bottom_right'].indexOf(k);

    if (idx === -1) {
      converted[k] = obj[k];
    }
    else {
      converted[k
        .split('_')
        .map((v,j) => j === 0 ? v : v.charAt(0).toUpperCase() + v.substring(1))
        .join('')] = obj[k];
    }
  }

  return converted;
}
83906
def get(self, pos):
        """"""
        latitude = int(round(pos['latitude']))
        search_set = self.bins[latitude]
        i = 1
        if latitude - i >= -90:
            search_set += self.bins[latitude-i]
        if latitude + i <= 90:
            search_set += self.bins[latitude+i]
        while len(search_set) == 0 and i <= 200:
            if latitude - i >= -90:
                search_set += self.bins[latitude-i]
            if latitude + i <= 90:
                search_set += self.bins[latitude+i]
            i += 1
        return find_closest(search_set, pos)
937909
def coerce(self, value):
        

        return {
            'lat': float(value.get('lat', value.get('latitude'))),
            'lon': float(value.get('lon', value.get('longitude')))
        }
1227633
def search_target_obj(target):
    '''
    
    '''
    base_url = "http://asterank.com/api/skymorph/search?"

    if not isinstance(target, str):
        raise ValueError("The target arg you provided is not the type of str")
    else:
        base_url += "target=" + target

    return dispatch_http_get(base_url)
384426
def get_bounds(locations, lonlat=False):
    
    bounds = [[None, None], [None, None]]
    for point in iter_coords(locations):
        bounds = [
            [
                none_min(bounds[0][0], point[0]),
                none_min(bounds[0][1], point[1]),
            ],
            [
                none_max(bounds[1][0], point[0]),
                none_max(bounds[1][1], point[1]),
            ],
        ]
    if lonlat:
        bounds = _locations_mirror(bounds)
    return bounds
1030979
def url_builder(self, latitude, longitude):
        
        try:
            float(latitude)
            float(longitude)
        except TypeError:
            raise TypeError('Latitude (%s) and Longitude (%s) must be a float number' % (latitude, longitude))
        url = self._darksky_url + self.forecast_io_api_key + '/'
        url += str(latitude).strip() + ',' + str(longitude).strip()
        if self.time_url and not self.time_url.isspace():
            url += ',' + self.time_url.strip()
        url += '?units=' + self.units_url.strip()
        url += '&lang=' + self.lang_url.strip()
        if self.exclude_url is not None:
            excludes = ''
            if self.exclude_url in self._allowed_excludes_extends:
                excludes += self.exclude_url + ','
            else:
                for item in self.exclude_url:
                    if item in self._allowed_excludes_extends:
                        excludes += item + ','
            if len(excludes) > 0:
                url += '&exclude=' + excludes.rstrip(',')
        if self.extend_url is not None:
            extends = ''
            if self.extend_url in self._allowed_excludes_extends:
                extends += self.extend_url + ','
            else:
                for item in self.extend_url:
                    if item in self._allowed_excludes_extends:
                        extends += item + ','
            if len(extends) > 0:
                url += '&extend=' + extends.rstrip(',')
        return url
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)
1230605
def get_utm_crs(lat: float, lon: float) -> Dict:
    
    zone = utm.from_latlon(lat, lon)[2]
    south = lat < 0
    return {
        "proj": "utm",
        "zone": zone,
        "south": south,
        "ellps": "WGS84",
        "datum": "WGS84",
        "units": "m",
        "no_defs": True,
    }
1268632
def set_query_latlon(self):
        '''
        
        '''

        if (isinstance(self.longitude, list) and
                isinstance(self.latitude, list)):
            self.lbox = True
            # west, east, south, north
            self.query.lonlat_box(self.longitude[0], self.longitude[1],
                                  self.latitude[0], self.latitude[1])
        else:
            self.lbox = False
            self.query.lonlat_point(self.longitude, self.latitude)
1356445
def request_location(cls, text, *,
                         resize=None, single_use=None, selective=None):
        
        return cls(types.KeyboardButtonRequestGeoLocation(text),
                   resize=resize, single_use=single_use, selective=selective)
1283456
def main(lat, lon, loc):
    """"""
    writer = get_writer()

    try:
        if (not lat or not lon) and (not loc):
            raise IncorrectParametersException('Please specify a latitude, longitude, or location'
                                               'Example: wilos --lat=19.8968 --lon=155.5828 --loc="hawaii"')
        if lat is not None and long is not None:
            get_live_weather(lat, lon, writer)
        elif loc is not None:
            loc_data = get_coordinates(loc)
            writer.title(loc_data['address'])
            get_live_weather(loc_data['coordinates']['lat'],
                             loc_data['coordinates']['lng'],
                             writer)

    except IncorrectParametersException as e:
        click.secho(e.message, fg="red", bold=True)
39701
def search(self, query, locations: list=None):
        '''
        '''
        cas_number = re.search(r"\b[1-9]{1}[0-9]{1,5}-\d{2}-\d\b", str(query))
        if cas_number:
            query = cas_number[0]
            search_type = 'cas'   
        else:
            try:
                query = int(query)
                search_type = 'barcode'
            except ValueError:
                query = f"%{query}%"
                search_type = 'name'
        if not locations:
            locations = self.get_locations(filter_to_my_group=True)
            locations = [loc.inventory_id for loc in locations]
        data = {
            'groupid': self.groupid,
            'searchtype': search_type,
            'searchterm':  query,
            'limitlocations': locations.append(1)
        }
        r = self._post('search-search', referer_path='search', data=data)
        
        #return a list of container objects
        if r['searchresults']['containers']:
            containers = []
            for container in r['searchresults']['containers']:
                loc = Location(name=container.get('location'))
                ct = Container(
                    inventory_id = container.get('id'), 
                    compound_id = container.get('sid'),
                    name=container.get('containername'),
                    location=loc,
                    size=container.get('size'),
                    smiles=container.get('smiles'),
                    cas=container.get('cas'),
                    comments=container.get('comments'),
                    barcode=container.get('barcode'),
                    supplier=container.get('supplier'),
                    date_acquired=container.get('dateacquired'),
                    owner=container.get('owner'))
                containers.append(ct)
            return containers
        else:
            return []
681775
function ( value ) {
            if ( $B.isObject(value) ) {
                var str = location.search;
    
                str = ( /^\?[^\?\=]+\=/.test(str) )? str + '&' : '?' + str;
    
                for ( var key in value ) {
                    str += key + '=' + value[key] + '&';
                }
    
                return str.replace( /\&$/, '' );
            } else {
                var result = {};
                location.search.replace( /(\w*)\=([^&]*)/g, $B.bind(function ( str, prop, val ) {
                    if ( prop ) result[prop] = $B.string.convertDataType( val );
                }, this));
    
                if ( typeof value === 'string' ) {
                    if ( result[value] ) {
                        result = result[value];
                    } else {
                        result = '';
                    }
                }
    
                return result;
            }
        }
572333
def lon_lat(value):
    
    lon, lat = value.split()
    return longitude(lon), latitude(lat)
2413
def serialize(cls, geolocation):
        

        obj = {}

        cls.add_if_not_none(obj, cls._FIELD_LATITUDE, geolocation.latitude)
        cls.add_if_not_none(obj, cls._FIELD_LONGITUDE, geolocation.longitude)
        cls.add_if_not_none(obj, cls._FIELD_ALTITUDE, geolocation.altitude)
        cls.add_if_not_none(obj, cls._FIELD_RADIUS, geolocation.radius)

        return obj
1009185
def _solve_location(self, req, dut_req_len, idx):
        
        if not req.get("location"):
            return
        if len(req.get("location")) == 2:
            for x_and_y, coord in enumerate(req.get("location")):

                if isinstance(coord, string_types):
                    coord = ResourceConfig.__replace_coord_variables(coord,
                                                                     x_and_y,
                                                                     dut_req_len,
                                                                     idx)
                    try:
                        loc = req.get("location")
                        loc[x_and_y] = eval(coord)  # pylint: disable=eval-used
                        req.set("location", loc)
                    except SyntaxError as error:
                        self.logger.error(error)
                        loc = req.get("location")
                        loc[x_and_y] = 0.0
                        req.set("location", loc)
        else:
            self.logger.error("invalid location field!")
            req.set("location", [0.0, 0.0])