misc: fix function-redefined pylint error (#56288)
This commit is contained in:
parent
6e1c8b4f84
commit
da61304c4c
|
@ -268,19 +268,19 @@ class MapLayer(models.Model):
|
|||
east_lng = geod.fwd(center_lng, center_lat, 90, distance)[0]
|
||||
west_lng = geod.fwd(center_lng, center_lat, -90, distance)[0]
|
||||
|
||||
def match(feature):
|
||||
def match_geom(feature):
|
||||
if feature['geometry']['type'] != 'Point':
|
||||
return True
|
||||
lng, lat = feature['geometry']['coordinates']
|
||||
return bool(west_lng < lng < east_lng and south_lat < lat < north_lat)
|
||||
|
||||
features = [x for x in features if match(x)]
|
||||
features = [x for x in features if match_geom(x)]
|
||||
|
||||
if request and not query_parameter and request.GET.get('q'):
|
||||
# all words must match
|
||||
query_words = [slugify(x) for x in request.GET['q'].split()]
|
||||
|
||||
def match(feature):
|
||||
def match_words(feature):
|
||||
matching_query_words = set()
|
||||
feature_words = [self.label]
|
||||
|
||||
|
@ -301,7 +301,7 @@ class MapLayer(models.Model):
|
|||
return True
|
||||
return False
|
||||
|
||||
features = [x for x in features if match(x)]
|
||||
features = [x for x in features if match_words(x)]
|
||||
|
||||
return {'type': 'FeatureCollection', 'features': features}
|
||||
|
||||
|
|
|
@ -1480,10 +1480,10 @@ def test_dataviz_check_validity(nocache):
|
|||
assert ValidityInfo.objects.exists() is False
|
||||
|
||||
@urlmatch(scheme='https', netloc=r'stat.com', path='/stats/1/')
|
||||
def url_mock(url, request):
|
||||
def url_mock2(url, request):
|
||||
return {'content': json.dumps({'data': [], 'err': 1}), 'status_code': 404}
|
||||
|
||||
with HTTMock(url_mock):
|
||||
with HTTMock(url_mock2):
|
||||
cell.check_validity()
|
||||
validity_info = ValidityInfo.objects.latest('pk')
|
||||
assert validity_info.invalid_reason_code == 'statistic_data_not_found'
|
||||
|
|
Loading…
Reference in New Issue