Projet

Général

Profil

0020-misc-fix-function-redefined-pylint-error-56288.patch

Lauréline Guérin, 30 août 2021 17:53

Télécharger (2,52 ko)

Voir les différences:

Subject: [PATCH 20/31] misc: fix function-redefined pylint error (#56288)

 combo/apps/maps/models.py | 8 ++++----
 tests/test_dataviz.py     | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
combo/apps/maps/models.py
268 268
            east_lng = geod.fwd(center_lng, center_lat, 90, distance)[0]
269 269
            west_lng = geod.fwd(center_lng, center_lat, -90, distance)[0]
270 270

  
271
            def match(feature):
271
            def match_geom(feature):
272 272
                if feature['geometry']['type'] != 'Point':
273 273
                    return True
274 274
                lng, lat = feature['geometry']['coordinates']
275 275
                return bool(west_lng < lng < east_lng and south_lat < lat < north_lat)
276 276

  
277
            features = [x for x in features if match(x)]
277
            features = [x for x in features if match_geom(x)]
278 278

  
279 279
        if request and not query_parameter and request.GET.get('q'):
280 280
            # all words must match
281 281
            query_words = [slugify(x) for x in request.GET['q'].split()]
282 282

  
283
            def match(feature):
283
            def match_words(feature):
284 284
                matching_query_words = set()
285 285
                feature_words = [self.label]
286 286

  
......
301 301
                        return True
302 302
                return False
303 303

  
304
            features = [x for x in features if match(x)]
304
            features = [x for x in features if match_words(x)]
305 305

  
306 306
        return {'type': 'FeatureCollection', 'features': features}
307 307

  
tests/test_dataviz.py
1480 1480
    assert ValidityInfo.objects.exists() is False
1481 1481

  
1482 1482
    @urlmatch(scheme='https', netloc=r'stat.com', path='/stats/1/')
1483
    def url_mock(url, request):
1483
    def url_mock2(url, request):
1484 1484
        return {'content': json.dumps({'data': [], 'err': 1}), 'status_code': 404}
1485 1485

  
1486
    with HTTMock(url_mock):
1486
    with HTTMock(url_mock2):
1487 1487
        cell.check_validity()
1488 1488
    validity_info = ValidityInfo.objects.latest('pk')
1489 1489
    assert validity_info.invalid_reason_code == 'statistic_data_not_found'
1490
-