Skip to content

Commit

Permalink
issue #1112 - Python 3.12 warnings about string escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
davmlaw committed Jul 31, 2024
1 parent 49c72b1 commit 08de042
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion classification/models/condition_text_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def embedded_ids_check(text: str) -> ConditionMatchingSuggestion:
result_text = text
for prefix in ontology_prefixes:
# fetch text between the matched term and the next ontology ID
pattern = f"{matched_term.id.lower()}(.*?)({prefix}:\d+)"
pattern = fr"{matched_term.id.lower()}(.*?)({prefix}:\d+)"
match = re.search(pattern, text)
if match:
found = True
Expand Down
2 changes: 1 addition & 1 deletion genes/hgvs/hgvs_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _hgvs_string_validation(hgvs_string: str):
""" raise exceptions on any errors """

if "ins" in hgvs_string:
if re.match(".*ins\d+$", hgvs_string):
if re.match(r".*ins\d+$", hgvs_string):
raise HGVSException("Insertions require inserted sequence, not an integer length")
if re.match(".*ins$", hgvs_string):
raise HGVSException("Insertions require inserted sequence")
Expand Down
2 changes: 1 addition & 1 deletion seqauto/illumina/samplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import pandas as pd

ILLUMINA = 'ILLUMINA'
ILLEGAL_CHARACTERS = "?()[]/\=+<>:;\"',*^|&. " # From Illumina docs
ILLEGAL_CHARACTERS = r"?()[]/\=+<>:;\"',*^|&. " # From Illumina docs
NO_SPACES_COLUMNS = ['sample_id', 'sample_name']


Expand Down
2 changes: 1 addition & 1 deletion uicore/templatetags/js_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def query_unquote(query_string):
@register.filter
def jsstring(text):
if text:
text = text.replace('\\', '\\\\').replace('`', '\`').replace('</script>', '<\\/script>')
text = text.replace('\\', '\\\\').replace('`', '\\`').replace('</script>', '<\\/script>')
return mark_safe(text)
return ''

Expand Down
2 changes: 1 addition & 1 deletion upload/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def upload(request):

file_dicts_list = get_file_dicts_list(upload_settings)
extensions = get_import_tasks_by_extension().keys()
accept_file_types = f"/(\.|\/)({'|'.join(extensions)})$/i"
accept_file_types = fr"/(\.|\/)({'|'.join(extensions)})$/i"
context = {'existing_files': file_dicts_list,
'form': form,
"upload_enabled": settings.UPLOAD_ENABLED,
Expand Down

0 comments on commit 08de042

Please sign in to comment.