mirror of
https://github.com/ilri/dspace-statistics-api.git
synced 2024-12-23 05:02:22 +01:00
dspace_statistics_api/items.py: Fix flake8 warning
According to flake8 we need to use a different syntax for strings with backslash escape sequences: > As of Python 3.6, a backslash-character pair that is not a valid > escape sequence now generates a DeprecationWarning. This will > eventually become a SyntaxError. The warning was: W605 invalid escape sequence '\-' See: https://www.flake8rules.com/rules/W605.html
This commit is contained in:
parent
946f0749e2
commit
3ceb9a6eb0
@ -13,7 +13,7 @@ def get_views(solr_date_string: str, items: list):
|
||||
:returns: A dict of item IDs and views
|
||||
"""
|
||||
# Join the UUIDs with "OR" and escape the hyphens for Solr
|
||||
solr_items_string: str = " OR ".join(items).replace("-", "\-")
|
||||
solr_items_string: str = " OR ".join(items).replace("-", r"\-")
|
||||
|
||||
solr_query_params = {
|
||||
"q": f"id:({solr_items_string})",
|
||||
@ -60,7 +60,7 @@ def get_downloads(solr_date_string: str, items: list):
|
||||
:returns: A dict of item IDs and downloads
|
||||
"""
|
||||
# Join the UUIDs with "OR" and escape the hyphens for Solr
|
||||
solr_items_string: str = " OR ".join(items).replace("-", "\-")
|
||||
solr_items_string: str = " OR ".join(items).replace("-", r"\-")
|
||||
|
||||
solr_query_params = {
|
||||
"q": f"owningItem:({solr_items_string})",
|
||||
|
Loading…
Reference in New Issue
Block a user