From e70a7a96754e6758db323162395488f84fad0fa8 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Sat, 9 Dec 2023 12:33:46 +0300 Subject: [PATCH] Apply fixes from fixit RewriteToLiteral: It's slower to call list() than using the empty literal --- dspace_statistics_api/app.py | 4 ++-- dspace_statistics_api/util.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dspace_statistics_api/app.py b/dspace_statistics_api/app.py index aa129c8..28bddcd 100644 --- a/dspace_statistics_api/app.py +++ b/dspace_statistics_api/app.py @@ -90,7 +90,7 @@ class AllStatisticsResource: ) # create a list to hold dicts of stats - statistics = list() + statistics = [] # iterate over results and build statistics object for result in cursor: @@ -162,7 +162,7 @@ class AllStatisticsResource: ) # create a list to hold dicts of stats - statistics = list() + statistics = [] # iterate over views dict to extract views and use the element id as an # index to the downloads dict to extract downloads. diff --git a/dspace_statistics_api/util.py b/dspace_statistics_api/util.py index 8879272..ae292e1 100644 --- a/dspace_statistics_api/util.py +++ b/dspace_statistics_api/util.py @@ -140,7 +140,7 @@ def validate_post_parameters(req, resp, resource, params): description=f'The "{req.context.statistics_scope}" parameter is invalid. The value must be a comma-separated list of UUIDs.', ) else: - req.context.elements = list() + req.context.elements = [] def set_statistics_scope(req, resp, resource, params):