From caae7d84bc05f9ac8c62242f92385883fc0a8020 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 2 Sep 2024 13:36:55 +0200 Subject: [PATCH] raw regexp strings --- pandora/documentcollection/views.py | 2 +- pandora/edit/views.py | 2 +- pandora/item/utils.py | 2 +- pandora/itemlist/views.py | 2 +- pandora/text/views.py | 2 +- pandora/urlalias/views.py | 2 +- pandora/user/views.py | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pandora/documentcollection/views.py b/pandora/documentcollection/views.py index cfe3e8f7d..a678bd171 100644 --- a/pandora/documentcollection/views.py +++ b/pandora/documentcollection/views.py @@ -246,7 +246,7 @@ def addCollection(request, data): 'type' and 'view'. see: editCollection, findCollections, getCollection, removeCollection, sortCollections ''' - data['name'] = re.sub(' \[\d+\]$', '', data.get('name', 'Untitled')).strip() + data['name'] = re.sub(r' \[\d+\]$', '', data.get('name', 'Untitled')).strip() name = data['name'] if not name: name = "Untitled" diff --git a/pandora/edit/views.py b/pandora/edit/views.py index 4de8679d8..c096b464f 100644 --- a/pandora/edit/views.py +++ b/pandora/edit/views.py @@ -262,7 +262,7 @@ def addEdit(request, data): } see: editEdit, findEdit, getEdit, removeEdit, sortEdits ''' - data['name'] = re.sub(' \[\d+\]$', '', data.get('name', 'Untitled')).strip() + data['name'] = re.sub(r' \[\d+\]$', '', data.get('name', 'Untitled')).strip() name = data['name'] if not name: name = "Untitled" diff --git a/pandora/item/utils.py b/pandora/item/utils.py index fce7d7247..83932967f 100644 --- a/pandora/item/utils.py +++ b/pandora/item/utils.py @@ -61,7 +61,7 @@ def sort_title(title): title = sort_string(title) #title - title = re.sub('[\'!¿¡,\.;\-"\:\*\[\]]', '', title) + title = re.sub(r'[\'!¿¡,\.;\-"\:\*\[\]]', '', title) return title.strip() def get_positions(ids, pos, decode_id=False): diff --git a/pandora/itemlist/views.py b/pandora/itemlist/views.py index 82857d459..a55f5f044 100644 --- a/pandora/itemlist/views.py +++ b/pandora/itemlist/views.py @@ -242,7 +242,7 @@ def addList(request, data): 'type' and 'view'. see: editList, findLists, getList, removeList, sortLists ''' - data['name'] = re.sub(' \[\d+\]$', '', data.get('name', 'Untitled')).strip() + data['name'] = re.sub(r' \[\d+\]$', '', data.get('name', 'Untitled')).strip() name = data['name'] if not name: name = "Untitled" diff --git a/pandora/text/views.py b/pandora/text/views.py index 33338675f..552db47f4 100644 --- a/pandora/text/views.py +++ b/pandora/text/views.py @@ -39,7 +39,7 @@ def addText(request, data): } see: editText, findTexts, getText, removeText, sortTexts ''' - data['name'] = re.sub(' \[\d+\]$', '', data.get('name', 'Untitled')).strip() + data['name'] = re.sub(r' \[\d+\]$', '', data.get('name', 'Untitled')).strip() name = data['name'] if not name: name = "Untitled" diff --git a/pandora/urlalias/views.py b/pandora/urlalias/views.py index 9ed1a36cc..541f61d8d 100644 --- a/pandora/urlalias/views.py +++ b/pandora/urlalias/views.py @@ -64,7 +64,7 @@ def padma_video(request, url): except: return app.views.index(request) if view: - timecodes = re.compile('(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view) + timecodes = re.compile(r'(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view) if timecodes: view = ','.join(timecodes[0]) if view: diff --git a/pandora/user/views.py b/pandora/user/views.py index aa452cecb..a2a678f1d 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -914,7 +914,7 @@ def addGroup(request, data): created = False n = 1 name = data['name'] - _name = re.sub(' \[\d+\]$', '', name).strip() + _name = re.sub(r' \[\d+\]$', '', name).strip() while not created: g, created = Group.objects.get_or_create(name=name) n += 1 @@ -946,7 +946,7 @@ def editGroup(request, data): name = data['name'] n = 1 name = data['name'] - _name = re.sub(' \[\d+\]$', '', name).strip() + _name = re.sub(r' \[\d+\]$', '', name).strip() while Group.objects.filter(name=name).count(): n += 1 name = '%s [%d]' % (_name, n)