From c10c92c59b1d6861d054cf9bf8b218da26762b58 Mon Sep 17 00:00:00 2001 From: Pravin Kamble Date: Mon, 21 Aug 2023 00:21:23 +0530 Subject: [PATCH] fixing the whitespaces --- rest_framework/throttling.py | 3 +-- rest_framework/utils/throttling_duration_parser.py | 2 +- tests/test_throttling.py | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/rest_framework/throttling.py b/rest_framework/throttling.py index 3483b1713..a438bedd4 100644 --- a/rest_framework/throttling.py +++ b/rest_framework/throttling.py @@ -95,14 +95,13 @@ class SimpleRateThrottle(BaseThrottle): msg = "No default throttle rate set for '%s' scope" % self.scope raise ImproperlyConfigured(msg) - def parse_rate(self,rate): + def parse_rate(self, rate): """ Given the request rate string, return a two tuple of: , """ if rate is None: return (None, None) - num, period = rate.split('/') quantity, unit = parse_quantity_and_unit(period).values() num_requests = int(num) diff --git a/rest_framework/utils/throttling_duration_parser.py b/rest_framework/utils/throttling_duration_parser.py index 859fd432f..923c4dc61 100644 --- a/rest_framework/utils/throttling_duration_parser.py +++ b/rest_framework/utils/throttling_duration_parser.py @@ -19,4 +19,4 @@ def parse_quantity_and_unit(quantity_unit_string): else: quantity_unit_dict['quantity'] = int(quantity_unit_string[:i]) quantity_unit_dict['unit'] = quantity_unit_string[i:] - return quantity_unit_dict \ No newline at end of file + return quantity_unit_dict diff --git a/tests/test_throttling.py b/tests/test_throttling.py index 0962269a8..0563bd9d8 100644 --- a/tests/test_throttling.py +++ b/tests/test_throttling.py @@ -470,10 +470,8 @@ class SimpleRateThrottleTests(TestCase): def test_parse_quantity_and_unit_parses_correctly(self): result = parse_quantity_and_unit("5min") assert result == {'quantity': 5, 'unit': 'min'} - result = parse_quantity_and_unit("h") assert result == {'quantity': 1, 'unit': 'h'} - result = parse_quantity_and_unit("123s") assert result == {'quantity': 123, 'unit': 's'}