From 8ba833d994fbafaab7e4fc05fd61419f2e80caef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laur=C3=A9line=20Gu=C3=A9rin?= <zebuline@entrouvert.com>
Date: Thu, 17 Mar 2022 17:09:39 +0100
Subject: [PATCH 08/65] misc: fix anomalous-backslash-in-string pylint error
 (#62099)

---
 passerelle/apps/airquality/models.py       |  2 +-
 passerelle/apps/arpege_ecp/models.py       |  2 +-
 passerelle/apps/atal/models.py             |  8 ++++----
 passerelle/apps/cartads_cs/models.py       |  6 +++---
 passerelle/apps/clicrdv/models.py          |  2 +-
 passerelle/apps/okina/models.py            | 20 +++++++++++---------
 passerelle/contrib/gdema/models.py         |  6 +++---
 passerelle/contrib/iparapheur/models.py    |  4 ++--
 passerelle/contrib/iws/models.py           |  2 +-
 passerelle/contrib/solis_apa/models.py     |  2 +-
 passerelle/contrib/stub_invoices/models.py |  6 +++---
 passerelle/contrib/tcl/models.py           |  2 +-
 passerelle/contrib/teamnet_axel/models.py  | 12 +++++++-----
 13 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/passerelle/apps/airquality/models.py b/passerelle/apps/airquality/models.py
index eae5cec8..96203583 100644
--- a/passerelle/apps/airquality/models.py
+++ b/passerelle/apps/airquality/models.py
@@ -43,7 +43,7 @@ class AirQuality(BaseResource):
         verbose_name = _('Air Quality')
 
     @endpoint(
-        pattern='^(?P<country>\w+)/(?P<city>\w+)/$',
+        pattern=r'^(?P<country>\w+)/(?P<city>\w+)/$',
         example_pattern='{country}/{city}/',
         parameters={
             'country': {'description': _('Country Code'), 'example_value': 'fr'},
diff --git a/passerelle/apps/arpege_ecp/models.py b/passerelle/apps/arpege_ecp/models.py
index bf0823b8..54227c16 100644
--- a/passerelle/apps/arpege_ecp/models.py
+++ b/passerelle/apps/arpege_ecp/models.py
@@ -74,7 +74,7 @@ class ArpegeECP(BaseResource):
 
     @endpoint(
         name='api',
-        pattern='^users/(?P<nameid>\w+)/forms$',
+        pattern=r'^users/(?P<nameid>\w+)/forms$',
         perm='can_access',
         description='Returns user forms',
     )
diff --git a/passerelle/apps/atal/models.py b/passerelle/apps/atal/models.py
index b3716d8d..4d141817 100644
--- a/passerelle/apps/atal/models.py
+++ b/passerelle/apps/atal/models.py
@@ -169,7 +169,7 @@ class ATALConnector(BaseResource):
         methods=['get'],
         perm='can_access',
         example_pattern='{demande_number}/',
-        pattern='^(?P<demande_number>\w+)/$',
+        pattern=r'^(?P<demande_number>\w+)/$',
         name='retrieve-details-demande',
         parameters={'demande_number': DEMANDE_NUMBER_PARAM},
     )
@@ -183,7 +183,7 @@ class ATALConnector(BaseResource):
         methods=['get'],
         perm='can_access',
         example_pattern='{demande_number}/',
-        pattern='^(?P<demande_number>\w+)/$',
+        pattern=r'^(?P<demande_number>\w+)/$',
         name='retrieve-etat-travaux',
         parameters={'demande_number': DEMANDE_NUMBER_PARAM},
     )
@@ -195,7 +195,7 @@ class ATALConnector(BaseResource):
         methods=['get'],
         perm='can_access',
         example_pattern='{demande_number}/',
-        pattern='^(?P<demande_number>\w+)/$',
+        pattern=r'^(?P<demande_number>\w+)/$',
         parameters={
             'demande_number': DEMANDE_NUMBER_PARAM,
             'full': {
@@ -289,7 +289,7 @@ class ATALConnector(BaseResource):
         methods=['get'],
         perm='can_access',
         example_pattern='{demande_number}/',
-        pattern='^(?P<demande_number>\w+)/$',
+        pattern=r'^(?P<demande_number>\w+)/$',
         name='new-comments',
         parameters={
             'demande_number': DEMANDE_NUMBER_PARAM,
diff --git a/passerelle/apps/cartads_cs/models.py b/passerelle/apps/cartads_cs/models.py
index 627f6704..93668e2b 100644
--- a/passerelle/apps/cartads_cs/models.py
+++ b/passerelle/apps/cartads_cs/models.py
@@ -687,7 +687,7 @@ class AbstractCartaDSCS(BaseResource):
 
     @endpoint(
         methods=['post'],
-        pattern='^(?P<id_piece>[\w-]+)/(?P<token>[\w:_-]+)/$',
+        pattern=r'^(?P<id_piece>[\w-]+)/(?P<token>[\w:_-]+)/$',
         description=_('Upload a single document file'),
         parameters={
             'id_piece': PIECE_ID_PARAM,
@@ -726,7 +726,7 @@ class AbstractCartaDSCS(BaseResource):
     @endpoint(
         methods=['post'],
         name='upload',
-        pattern='^(?P<id_piece>[\w-]+)/(?P<token>[\w:_-]+)/(?P<file_upload>[\w:_-]+)/delete/$',
+        pattern=r'^(?P<id_piece>[\w-]+)/(?P<token>[\w:_-]+)/(?P<file_upload>[\w:_-]+)/delete/$',
         description=_('Delete a single document file'),
         parameters={
             'id_piece': PIECE_ID_PARAM,
@@ -875,7 +875,7 @@ class AbstractCartaDSCS(BaseResource):
         self.sync_subscribers_role(dossier)
 
     @endpoint(
-        pattern='^(?P<signed_dossier_id>[\w:_-]+)/$',
+        pattern=r'^(?P<signed_dossier_id>[\w:_-]+)/$',
         methods=['post'],
         description=_('Notification of file processing by Cart@DS CS'),
         parameters={
diff --git a/passerelle/apps/clicrdv/models.py b/passerelle/apps/clicrdv/models.py
index 4cd13d84..7e8fd369 100644
--- a/passerelle/apps/clicrdv/models.py
+++ b/passerelle/apps/clicrdv/models.py
@@ -78,7 +78,7 @@ class ClicRdv(BaseResource):
                 ret.append({'id': record['id'], 'text': record['publicname'], 'details': record})
         return {'data': ret}
 
-    @endpoint(name='interventionsets', pattern='(?P<set>\d+)/')
+    @endpoint(name='interventionsets', pattern=r'(?P<set>\d+)/')
     def get_interventions(self, request, set, **kwargs):
         ret = []
         response = self.request('interventions?interventionset_id=%s' % set)
diff --git a/passerelle/apps/okina/models.py b/passerelle/apps/okina/models.py
index f94f9fb5..c1fbd10b 100644
--- a/passerelle/apps/okina/models.py
+++ b/passerelle/apps/okina/models.py
@@ -124,7 +124,7 @@ class Okina(BaseResource):
             query = ''
         return {'data': self.get_institutions(query)}
 
-    @endpoint(name='institutions', pattern='^from-city/(?P<city_insee_code>\d+)/*$')
+    @endpoint(name='institutions', pattern=r'^from-city/(?P<city_insee_code>\d+)/*$')
     def institutions_from_city(self, request, city_insee_code):
         return {'data': self.get_institutions('/subscriberCity/%s' % city_insee_code)}
 
@@ -158,7 +158,7 @@ class Okina(BaseResource):
 
     @endpoint(
         name='stop-areas',
-        pattern='^from-city/(?P<city_insee_code>\d+)/to-institution/(?P<institution_id>\d+)/*$',
+        pattern=r'^from-city/(?P<city_insee_code>\d+)/to-institution/(?P<institution_id>\d+)/*$',
     )
     def stop_areas(self, request, city_insee_code, institution_id):
         stops = self.request(
@@ -196,13 +196,13 @@ class Okina(BaseResource):
     def origin_destinations(self, request):
         return self.get_ods()
 
-    @endpoint(name='origin-destinations', pattern='^to-institution/(?P<institution_id>\d+)/*$')
+    @endpoint(name='origin-destinations', pattern=r'^to-institution/(?P<institution_id>\d+)/*$')
     def origin_destinations_to_institution(self, request, institution_id):
         return self.get_ods('/institution/%s' % institution_id)
 
     @endpoint(
         name='origin-destinations',
-        pattern='^from-stop-area/(?P<stop_area_id>\d+)/to-institution/(?P<institution_id>\d+)/*$',
+        pattern=r'^from-stop-area/(?P<stop_area_id>\d+)/to-institution/(?P<institution_id>\d+)/*$',
     )
     def origin_destinations_from_stop_to_institution(self, request, stop_area_id, institution_id):
         endpoint = 'ods/institution/%s/stop-area/%s' % (institution_id, stop_area_id)
@@ -225,12 +225,12 @@ class Okina(BaseResource):
 
     @endpoint(
         name='origin-destinations',
-        pattern='^from-city/(?P<city_insee_code>\d+)/to-institution/(?P<institution_id>\d+)/*$',
+        pattern=r'^from-city/(?P<city_insee_code>\d+)/to-institution/(?P<institution_id>\d+)/*$',
     )
     def origin_destinations_from_city_to_institution(self, request, city_insee_code, institution_id):
         return self.get_ods('/institution/%s/subscriberCity/%s' % (institution_id, city_insee_code))
 
-    @endpoint(name='origin-destinations', pattern='^from-city/(?P<city_insee_code>\d+)/*$')
+    @endpoint(name='origin-destinations', pattern=r'^from-city/(?P<city_insee_code>\d+)/*$')
     def origin_destinations_from_city(self, request, city_insee_code):
         return self.get_ods('/subscriberCity/%s' % city_insee_code)
 
@@ -252,11 +252,11 @@ class Okina(BaseResource):
             raise APIError('payload must be a dict', http_status=400)
         return {'data': self.request('subscribers', payload, result_is_list=False)}
 
-    @endpoint(name='subscriber', pattern='^(?P<subscriber_id>\d+)/*$', methods=['get'], perm='can_access')
+    @endpoint(name='subscriber', pattern=r'^(?P<subscriber_id>\d+)/*$', methods=['get'], perm='can_access')
     def get_subscriber(self, request, subscriber_id):
         return {'data': self.request('subscribers/%s' % subscriber_id, result_is_list=False)}
 
-    @endpoint(name='subscriber', pattern='^(?P<subscriber_id>\d+)/qrcode/*$', perm='can_access')
+    @endpoint(name='subscriber', pattern=r'^(?P<subscriber_id>\d+)/qrcode/*$', perm='can_access')
     def get_subscriber_qrcode(self, request, subscriber_id):
         qrcode = self.request('subscribers/%s/qrcode' % subscriber_id, result_is_json=False)
         content_type = qrcode.headers.get('Content-Type')
@@ -283,6 +283,8 @@ class Okina(BaseResource):
             return {'data': subscriptions}
         return {'data': self.request('subscriptions', payload, result_is_list=False)}
 
-    @endpoint(name='subscription', pattern='^(?P<subscription_id>\d+)/*$', methods=['get'], perm='can_access')
+    @endpoint(
+        name='subscription', pattern=r'^(?P<subscription_id>\d+)/*$', methods=['get'], perm='can_access'
+    )
     def get_subscription(self, request, subscription_id):
         return {'data': self.request('subscriptions/%s' % subscription_id, result_is_list=False)}
diff --git a/passerelle/contrib/gdema/models.py b/passerelle/contrib/gdema/models.py
index f4289a47..79a93d25 100644
--- a/passerelle/contrib/gdema/models.py
+++ b/passerelle/contrib/gdema/models.py
@@ -213,7 +213,7 @@ class Gdema(BaseResource):
 
     @endpoint(
         name='referentiel',
-        pattern='^(?P<name>\w+)/*$',
+        pattern=r'^(?P<name>\w+)/*$',
         description=_('Get reference items'),
         example_pattern='{name}/',
         parameters={
@@ -264,7 +264,7 @@ class Gdema(BaseResource):
 
     @endpoint(
         name='get-request',
-        pattern='^(?P<request_id>\d+)/*$',
+        pattern=r'^(?P<request_id>\d+)/*$',
         description=_('Get request details'),
         example_pattern='{request_id}/',
         parameters={
@@ -282,7 +282,7 @@ class Gdema(BaseResource):
 
     @endpoint(
         name='get-request-state',
-        pattern='^(?P<request_id>\d+)/*$',
+        pattern=r'^(?P<request_id>\d+)/*$',
         description=_('Get request status'),
         example_pattern='{request_id}/',
         parameters={
diff --git a/passerelle/contrib/iparapheur/models.py b/passerelle/contrib/iparapheur/models.py
index 30bcc9b3..ef63427a 100644
--- a/passerelle/contrib/iparapheur/models.py
+++ b/passerelle/contrib/iparapheur/models.py
@@ -209,7 +209,7 @@ class IParapheur(BaseResource, HTTPResource):
             dossier_id = generated_dossier_id
         return {'data': {'dossier_id': dossier_id, 'message': resp.MessageRetour.message}}
 
-    @endpoint(perm='can_access', name='get-file', pattern='(?P<file_id>[\w-]+)')
+    @endpoint(perm='can_access', name='get-file', pattern=r'(?P<file_id>[\w-]+)')
     def get_file(self, request, file_id, appendix=None):
         # We need to disable strict mode since the response
         # can be non compliant with the xsd
@@ -252,7 +252,7 @@ class IParapheur(BaseResource, HTTPResource):
         )
         return response
 
-    @endpoint(perm='can_access', name='get-file-status', pattern='(?P<file_id>[\w-]+)')
+    @endpoint(perm='can_access', name='get-file-status', pattern=r'(?P<file_id>[\w-]+)')
     def get_file_status(self, request, file_id):
         resp = self.call('GetHistoDossier', file_id)
         if not resp or not resp.MessageRetour:
diff --git a/passerelle/contrib/iws/models.py b/passerelle/contrib/iws/models.py
index 64e59805..a06f0e70 100644
--- a/passerelle/contrib/iws/models.py
+++ b/passerelle/contrib/iws/models.py
@@ -140,7 +140,7 @@ class IWSConnector(BaseResource):
         methods=['get'],
         perm='can_access',
         example_pattern='{sti_code}/{request_type}/{volume}/',
-        pattern='^(?P<sti_code>[0-9]{16}.?)/(?P<request_type>\w+)/(?P<volume>[0-9]+)/$',
+        pattern=r'^(?P<sti_code>[0-9]{16}.?)/(?P<request_type>\w+)/(?P<volume>[0-9]+)/$',
         parameters={
             'sti_code': {'description': _('Address STI code'), 'example_value': '3155570464130003'},
             'request_type': {'description': _('DECHET or ENCOMBRANT'), 'example_value': 'DECHET'},
diff --git a/passerelle/contrib/solis_apa/models.py b/passerelle/contrib/solis_apa/models.py
index 4f8c0605..e2124333 100644
--- a/passerelle/contrib/solis_apa/models.py
+++ b/passerelle/contrib/solis_apa/models.py
@@ -147,7 +147,7 @@ class SolisAPA(BaseResource):
 
         if query:
             query = query.lower()
-            if re.match('^\d\d', query):
+            if re.match(r'^\d\d', query):
                 # query est le debut d'un code postal
                 code_dep = query[:2]
         if not code_dep:
diff --git a/passerelle/contrib/stub_invoices/models.py b/passerelle/contrib/stub_invoices/models.py
index 160ad008..4712aa86 100644
--- a/passerelle/contrib/stub_invoices/models.py
+++ b/passerelle/contrib/stub_invoices/models.py
@@ -80,7 +80,7 @@ class StubInvoicesConnector(BaseResource):
 
     @endpoint(
         name='invoice',
-        pattern='^(?P<invoice_id>\w+)/?$',
+        pattern=r'^(?P<invoice_id>\w+)/?$',
         description=_('Get invoice details'),
         example_pattern='{invoice_id}/',
         parameters={
@@ -95,7 +95,7 @@ class StubInvoicesConnector(BaseResource):
 
     @endpoint(
         name='invoice',
-        pattern='^(?P<invoice_id>\w+)/pdf/?$',
+        pattern=r'^(?P<invoice_id>\w+)/pdf/?$',
         description=_('Get invoice as a PDF file'),
         long_description=_('not yet implemented'),
         example_pattern='{invoice_id}/pdf/',
@@ -116,7 +116,7 @@ class StubInvoicesConnector(BaseResource):
         name='invoice',
         perm='can_access',
         methods=['post'],
-        pattern='^(?P<invoice_id>\w+)/pay/?$',
+        pattern=r'^(?P<invoice_id>\w+)/pay/?$',
         description=_('Pay invoice'),
         long_description=_('not yet implemented'),
         example_pattern='{invoice_id}/pay/',
diff --git a/passerelle/contrib/tcl/models.py b/passerelle/contrib/tcl/models.py
index 9fac7230..335caecd 100644
--- a/passerelle/contrib/tcl/models.py
+++ b/passerelle/contrib/tcl/models.py
@@ -38,7 +38,7 @@ class Tcl(BaseResource):
         verbose_name = _('TCL')
 
     @endpoint(
-        pattern='^(?P<identifier>\w+)/?$',
+        pattern=r'^(?P<identifier>\w+)/?$',
         perm='can_access',
         description=_('Info about a stop'),
         example_pattern='{identifier}/',
diff --git a/passerelle/contrib/teamnet_axel/models.py b/passerelle/contrib/teamnet_axel/models.py
index dca590ea..0721ec5b 100644
--- a/passerelle/contrib/teamnet_axel/models.py
+++ b/passerelle/contrib/teamnet_axel/models.py
@@ -239,7 +239,7 @@ class TeamnetAxel(BaseResource):
                 payable_invoices.update(normalize_invoice(i.attrib, family_id))
         return payable_invoices
 
-    @endpoint(name='regie', pattern='^(?P<regie_id>\w+)/invoices/$')
+    @endpoint(name='regie', pattern=r'^(?P<regie_id>\w+)/invoices/$')
     def active_invoices(self, request, regie_id, **kwargs):
         family_id = self.get_family_id(request)
         if not family_id:
@@ -266,7 +266,7 @@ class TeamnetAxel(BaseResource):
                 historical_invoices.update(normalize_invoice(i.attrib, family_id, historical=True))
         return historical_invoices
 
-    @endpoint(name='regie', perm='can_access', pattern='^(?P<regie_id>\w+)/invoices/history/$')
+    @endpoint(name='regie', perm='can_access', pattern=r'^(?P<regie_id>\w+)/invoices/history/$')
     def invoices_history(self, request, regie_id, **kwargs):
         family_id = self.get_family_id(request)
         if not family_id:
@@ -277,7 +277,9 @@ class TeamnetAxel(BaseResource):
         invoices = sorted(historical, key=lambda i: i['created'], reverse=True)
         return {'data': invoices}
 
-    @endpoint(name='regie', perm='can_access', pattern='^(?P<regie_id>\w+)/invoice/(?P<invoice_id>[\w,-]+)/$')
+    @endpoint(
+        name='regie', perm='can_access', pattern=r'^(?P<regie_id>\w+)/invoice/(?P<invoice_id>[\w,-]+)/$'
+    )
     def get_invoice_details(self, request, regie_id, invoice_id, **kwargs):
         family_id, i = invoice_id.split('-', 1)
         payable = self.get_teamnet_payable_invoices(regie_id, family_id)
@@ -289,7 +291,7 @@ class TeamnetAxel(BaseResource):
         return {'data': None}
 
     @endpoint(
-        name='regie', perm='can_access', pattern='^(?P<regie_id>\w+)/invoice/(?P<invoice_id>[\w,-]+)/pdf/$'
+        name='regie', perm='can_access', pattern=r'^(?P<regie_id>\w+)/invoice/(?P<invoice_id>[\w,-]+)/pdf/$'
     )
     def invoice_pdf(self, request, regie_id, invoice_id, **kwargs):
         family_id, invoice = invoice_id.split('-', 1)
@@ -310,7 +312,7 @@ class TeamnetAxel(BaseResource):
         name='regie',
         methods=['post'],
         perm='can_access',
-        pattern='^(?P<regie_id>\w+)/invoice/(?P<invoice_id>[\w,-]+)/pay/$',
+        pattern=r'^(?P<regie_id>\w+)/invoice/(?P<invoice_id>[\w,-]+)/pay/$',
     )
     def pay_invoice(self, request, regie_id, invoice_id, **kwargs):
         data = json_loads(request.body)
-- 
2.34.1

