Skip to content

Commit

Permalink
Merge pull request #406 from afuetterer/fix-deprecation-warnings
Browse files Browse the repository at this point in the history
fix: make re-strings raw strings to fix DeprecationWarnings
  • Loading branch information
huberrob authored Sep 23, 2023
2 parents b42e269 + 3158806 commit 67ee852
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions fuji_server/harvester/metadata_harvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,13 @@ def parse_signposting_http_link_format(self, signposting_link_format_text):
for link_prop in parsed_link[1:]:
link_prop = str(link_prop).strip()
if link_prop.startswith('anchor'):
anchor_match = re.search('anchor\s*=\s*\"?([^,;"]+)\"?', link_prop)
anchor_match = re.search(r'anchor\s*=\s*\"?([^,;"]+)\"?', link_prop)
if link_prop.startswith('rel'):
rel_match = re.search('rel\s*=\s*\"?([^,;"]+)\"?', link_prop)
rel_match = re.search(r'rel\s*=\s*\"?([^,;"]+)\"?', link_prop)
elif link_prop.startswith('type'):
type_match = re.search('type\s*=\s*\"?([^,;"]+)\"?', link_prop)
type_match = re.search(r'type\s*=\s*\"?([^,;"]+)\"?', link_prop)
elif link_prop.startswith('formats'):
formats_match = re.search('formats\s*=\s*\"?([^,;"]+)\"?', link_prop)
formats_match = re.search(r'formats\s*=\s*\"?([^,;"]+)\"?', link_prop)
if type_match:
found_type = type_match[1]
if rel_match:
Expand Down
2 changes: 1 addition & 1 deletion fuji_server/helper/identifier_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __init__(self, idstring, logger = None):
#workaround to identify arks properly:
self.identifier = self.identifier.replace('/ark:' , '/ark:/' )
self.identifier = self.identifier.replace('/ark://', '/ark:/')
generic_identifiers_org_pattern = '^([a-z0-9\._]+):(.+)'
generic_identifiers_org_pattern = r'^([a-z0-9\._]+):(.+)'

if self.is_uuid():
self.identifier_schemes = ['uuid']
Expand Down
4 changes: 2 additions & 2 deletions fuji_server/helper/metadata_collector_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def get_mapped_xml_metadata(self, tree, mapping):
res[prop] = propcontent[0].get('tree').text
else:
res[prop] = lxml.etree.tostring(propcontent[0].get('tree'), method='text', encoding='unicode')
res[prop] = re.sub('\s+', ' ', res[prop])
res[prop] = re.sub(r'\s+', ' ', res[prop])
res[prop] = res[prop].strip()
else:
for propelem in propcontent:
Expand All @@ -324,7 +324,7 @@ def get_mapped_xml_metadata(self, tree, mapping):
res[prop].append(propelem.get('tree').text)
else:
resprop = lxml.etree.tostring(propelem.get('tree'), method='text', encoding='unicode')
resprop = re.sub('\s+', ' ', resprop)
resprop = re.sub(r'\s+', ' ', resprop)
resprop = resprop.strip()
res[prop].append(resprop)

Expand Down

0 comments on commit 67ee852

Please sign in to comment.