From db82233446da4be573d5b7cfa66653dc521f30cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= <zebuline@entrouvert.com>
Date: Tue, 22 Mar 2022 08:50:15 +0100
Subject: [PATCH 62/65] misc: fix unneeded-not pylint error (#62099)

---
 passerelle/apps/family/loaders/concerto_fondettes.py | 2 +-
 passerelle/apps/family/loaders/concerto_orleans.py   | 2 +-
 passerelle/apps/family/loaders/egee_thonon.py        | 2 +-
 passerelle/apps/sfr_dmc/models.py                    | 2 +-
 passerelle/contrib/solis_apa/models.py               | 2 +-
 passerelle/contrib/tcl/models.py                     | 2 +-
 passerelle/contrib/toulouse_smart/models.py          | 2 +-
 passerelle/utils/jsonresponse.py                     | 2 +-
 tests/test_base_adresse.py                           | 2 +-
 tests/test_cmis.py                                   | 6 +++---
 tests/test_generic_endpoint.py                       | 2 +-
 tests/test_manager.py                                | 6 +++---
 tests/test_misc.py                                   | 4 ++--
 tests/test_sms.py                                    | 2 +-
 14 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/passerelle/apps/family/loaders/concerto_fondettes.py b/passerelle/apps/family/loaders/concerto_fondettes.py
index 6fbb29e0..a0e94c93 100644
--- a/passerelle/apps/family/loaders/concerto_fondettes.py
+++ b/passerelle/apps/family/loaders/concerto_fondettes.py
@@ -35,7 +35,7 @@ class Loader:
         self.connector = connector
 
     def clean(self, archive):
-        if not 'data_full.csv' in archive.namelist():
+        if 'data_full.csv' not in archive.namelist():
             raise ValidationError(_('Missing data_full.csv file in zip.'))
 
     def load(self, archive):
diff --git a/passerelle/apps/family/loaders/concerto_orleans.py b/passerelle/apps/family/loaders/concerto_orleans.py
index d0451cf9..c455c7c5 100644
--- a/passerelle/apps/family/loaders/concerto_orleans.py
+++ b/passerelle/apps/family/loaders/concerto_orleans.py
@@ -118,7 +118,7 @@ class Loader:
             'extract_prcit_enfant.csv',
             'extract_prcit_facture.csv',
         ):
-            if not filename in archive.namelist():
+            if filename not in archive.namelist():
                 raise ValidationError(_('Missing %(filename)s file in zip.') % {'filename': filename})
 
     def csvread(self, filename):
diff --git a/passerelle/apps/family/loaders/egee_thonon.py b/passerelle/apps/family/loaders/egee_thonon.py
index b47804ff..86dfce25 100644
--- a/passerelle/apps/family/loaders/egee_thonon.py
+++ b/passerelle/apps/family/loaders/egee_thonon.py
@@ -28,7 +28,7 @@ class Loader:
         self.connector = connector
 
     def clean(self, archive):
-        if not 'factures.xml' in archive.namelist():
+        if 'factures.xml' not in archive.namelist():
             raise ValidationError(_('Missing factures.xml file in zip.'))
 
     def load(self, archive):
diff --git a/passerelle/apps/sfr_dmc/models.py b/passerelle/apps/sfr_dmc/models.py
index f69b2af9..2af2b34a 100644
--- a/passerelle/apps/sfr_dmc/models.py
+++ b/passerelle/apps/sfr_dmc/models.py
@@ -293,6 +293,6 @@ class SfrDmcGateway(SMSResource):
         if 'success' not in json_data:
             raise APIError('Bad JSON response')
         if not json_data['success']:
-            if not 'errorDetail' in json_data:
+            if 'errorDetail' not in json_data:
                 raise APIError('Bad JSON response')
             raise APIError(json_data['errorDetail'])
diff --git a/passerelle/contrib/solis_apa/models.py b/passerelle/contrib/solis_apa/models.py
index b61629bd..587566f2 100644
--- a/passerelle/contrib/solis_apa/models.py
+++ b/passerelle/contrib/solis_apa/models.py
@@ -182,7 +182,7 @@ class SolisAPA(BaseResource):
                 continue
             text = '%0.5d %s' % (attrs['stdr.commune.cp_lieu'], v['value'].strip())
 
-            if query and not query in text.lower():
+            if query and query not in text.lower():
                 continue
             ret.append({'id': v['id'], 'text': text})
         return ret
diff --git a/passerelle/contrib/tcl/models.py b/passerelle/contrib/tcl/models.py
index 335caecd..1a403e9a 100644
--- a/passerelle/contrib/tcl/models.py
+++ b/passerelle/contrib/tcl/models.py
@@ -81,7 +81,7 @@ class Tcl(BaseResource):
             stop['passings'].append(passing)
             # create dictionary key from both line number and direction
             line_info_key = passing['line_info']['ligne'] + '-' + passing['direction']
-            if not line_info_key in passings_by_line:
+            if line_info_key not in passings_by_line:
                 passings_by_line[line_info_key] = []
             passings_by_line[line_info_key].append(passing)
 
diff --git a/passerelle/contrib/toulouse_smart/models.py b/passerelle/contrib/toulouse_smart/models.py
index 0e056e57..5ed0a2d7 100644
--- a/passerelle/contrib/toulouse_smart/models.py
+++ b/passerelle/contrib/toulouse_smart/models.py
@@ -71,7 +71,7 @@ class ToulouseSmartResource(BaseResource, HTTPResource):
                     if prop.get('restrictedValues'):
                         prop['type'] = 'item'
                     if prop.get('type') in ('string', 'int', 'boolean', 'item'):
-                        if not 'properties' in item:
+                        if 'properties' not in item:
                             item['properties'] = []
                         item['properties'].append(prop)
                 intervention_types.append(item)
diff --git a/passerelle/utils/jsonresponse.py b/passerelle/utils/jsonresponse.py
index 325de98a..dbefb183 100644
--- a/passerelle/utils/jsonresponse.py
+++ b/passerelle/utils/jsonresponse.py
@@ -63,7 +63,7 @@ class to_json:
         return wrapper
 
     def obj_to_response(self, req, obj):
-        if isinstance(obj, dict) and not 'err' in obj:
+        if isinstance(obj, dict) and 'err' not in obj:
             obj['err'] = 0
         return obj
 
diff --git a/tests/test_base_adresse.py b/tests/test_base_adresse.py
index 9579308f..43b5c563 100644
--- a/tests/test_base_adresse.py
+++ b/tests/test_base_adresse.py
@@ -734,7 +734,7 @@ def test_base_adresse_command_update_geo(mocked_get, db, base_adresse, base_adre
         paris2 = cities.get(zipcode='75002')
         paris_json = paris.to_json()
         for key, value in paris2.to_json().items():
-            if not key in ['id', 'text', 'zipcode']:
+            if key not in ['id', 'text', 'zipcode']:
                 assert paris_json[key] == value
 
         miquelon = cities.get(zipcode='97500')
diff --git a/tests/test_cmis.py b/tests/test_cmis.py
index 01fd9504..9e8a03fc 100644
--- a/tests/test_cmis.py
+++ b/tests/test_cmis.py
@@ -490,9 +490,9 @@ def test_cmis_types_view(setup, app, admin_user, monkeypatch):
 
     resp = resp.click('Explore available object types')
     assert all(id in resp.text for id in root_types)
-    assert not 'Back to' in resp.text
-    assert not 'Children' in resp.text
-    assert not 'Properties' in resp.text
+    assert 'Back to' not in resp.text
+    assert 'Children' not in resp.text
+    assert 'Properties' not in resp.text
 
     resp = resp.click(root_type1.id)
     assert all(id in resp.text for id in root_type1.properties)
diff --git a/tests/test_generic_endpoint.py b/tests/test_generic_endpoint.py
index 1f3c0d07..882adf70 100644
--- a/tests/test_generic_endpoint.py
+++ b/tests/test_generic_endpoint.py
@@ -316,7 +316,7 @@ def test_endpoint_decorator():
         connector.foo6.endpoint_info.example_url_as_html()
         == '/fake/connector/foo6/<i class="varname">param1</i>/'
     )
-    assert not '&reg' in connector.foo8.endpoint_info.example_url_as_html()
+    assert '&reg' not in connector.foo8.endpoint_info.example_url_as_html()
 
     connector.foo6.endpoint_info.pattern = None
     connector.foo6.endpoint_info.example_pattern = None
diff --git a/tests/test_manager.py b/tests/test_manager.py
index 1dc2940a..55018bb6 100644
--- a/tests/test_manager.py
+++ b/tests/test_manager.py
@@ -430,7 +430,7 @@ def test_jobs(app, admin_user):
 
     app = login(app)
     resp = app.get(csv.get_absolute_url())
-    assert not 'jobs' in resp.text
+    assert 'jobs' not in resp.text
 
     csv.add_job('sample_job')
     resp = app.get(csv.get_absolute_url())
@@ -683,13 +683,13 @@ def test_manager_open_access_flag(app, admin_user):
     app = login(app)
     resp = app.get('/manage/', status=200)
     assert len(resp.pyquery('li.connector')) == 1
-    assert not 'open access' in resp.text
+    assert 'open access' not in resp.text
 
     obj_type = ContentType.objects.get_for_model(csv)
     AccessRight.objects.create(codename='can_access', apiuser=api, resource_type=obj_type, resource_pk=csv.pk)
 
     resp = app.get('/manage/', status=200)
-    assert not 'open access' in resp.text
+    assert 'open access' not in resp.text
 
     api.key = ''
     api.save()
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 620ae9af..4dd6311d 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -32,8 +32,8 @@ def test_get_description_url_fields(db):
 
 def test_get_description_secret_fields(db):
     connector = ClicRdv(slug='plop', apikey='secret1', username='plop', password='secret2')
-    assert not 'secret1' in [x[1] for x in connector.get_description_fields()]
-    assert not 'secret2' in [x[1] for x in connector.get_description_fields()]
+    assert 'secret1' not in [x[1] for x in connector.get_description_fields()]
+    assert 'secret2' not in [x[1] for x in connector.get_description_fields()]
 
 
 def test_log_cleaning(app, db, admin_user, settings):
diff --git a/tests/test_sms.py b/tests/test_sms.py
index c99c81c4..e1e76e80 100644
--- a/tests/test_sms.py
+++ b/tests/test_sms.py
@@ -216,7 +216,7 @@ def test_manage_views(admin_user, app, connector):
     url = '/%s/%s/' % (connector.get_connector_slug(), connector.slug)
     resp = app.get(url)
     assert 'Endpoints' in resp.text
-    assert not 'accessright/add' in resp.text
+    assert 'accessright/add' not in resp.text
     app = login(app)
     resp = app.get(url)
     description_fields = [
-- 
2.34.1

