diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2022-01-28 20:15:53 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-10-31 12:30:13 +0100 |
| commit | d3cb91db87b78629c0d2682630e90a048275179e (patch) | |
| tree | 92476354cbb4df1bcff3cd1514a1bac6cbc98676 /django/utils | |
| parent | a320aab5129f4019b3c1d28b7a3b509582bc56f9 (diff) | |
Used more augmented assignment statements.
Identified using the following command:
$ git grep -I '\(\<[_a-zA-Z0-9]\+\>\) *= *\1 *[-+/*^%&|<>@]'
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/datetime_safe.py | 4 | ||||
| -rw-r--r-- | django/utils/duration.py | 4 | ||||
| -rw-r--r-- | django/utils/numberformat.py | 2 | ||||
| -rw-r--r-- | django/utils/timezone.py | 2 | ||||
| -rw-r--r-- | django/utils/translation/__init__.py | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/django/utils/datetime_safe.py b/django/utils/datetime_safe.py index 817ddcf0fa..2792b48a26 100644 --- a/django/utils/datetime_safe.py +++ b/django/utils/datetime_safe.py @@ -95,10 +95,10 @@ def strftime(dt, fmt): # 6 years to get into the 28-year repeat cycle delta = 2000 - year off = 6 * (delta // 100 + delta // 400) - year = year + off + year += off # Move to around the year 2000 - year = year + ((2000 - year) // 28) * 28 + year += ((2000 - year) // 28) * 28 timetuple = dt.timetuple() s1 = time.strftime(fmt, (year,) + timetuple[1:]) sites1 = _findall(s1, str(year)) diff --git a/django/utils/duration.py b/django/utils/duration.py index 8495af3fa8..eae8527710 100644 --- a/django/utils/duration.py +++ b/django/utils/duration.py @@ -7,10 +7,10 @@ def _get_duration_components(duration): microseconds = duration.microseconds minutes = seconds // 60 - seconds = seconds % 60 + seconds %= 60 hours = minutes // 60 - minutes = minutes % 60 + minutes %= 60 return days, hours, minutes, seconds, microseconds diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py index 6e3628ff91..a1ecd1bd0d 100644 --- a/django/utils/numberformat.py +++ b/django/utils/numberformat.py @@ -81,7 +81,7 @@ def format( else: int_part, dec_part = str_number, "" if decimal_pos is not None: - dec_part = dec_part + ("0" * (decimal_pos - len(dec_part))) + dec_part += "0" * (decimal_pos - len(dec_part)) dec_part = dec_part and decimal_sep + dec_part # grouping if use_grouping: diff --git a/django/utils/timezone.py b/django/utils/timezone.py index 2107ec96ae..f3eac0e7b2 100644 --- a/django/utils/timezone.py +++ b/django/utils/timezone.py @@ -334,7 +334,7 @@ def _is_pytz_zone(tz): _PYTZ_BASE_CLASSES = (pytz.tzinfo.BaseTzInfo, pytz._FixedOffset) # In releases prior to 2018.4, pytz.UTC was not a subclass of BaseTzInfo if not isinstance(pytz.UTC, pytz._FixedOffset): - _PYTZ_BASE_CLASSES = _PYTZ_BASE_CLASSES + (type(pytz.UTC),) + _PYTZ_BASE_CLASSES += (type(pytz.UTC),) return isinstance(tz, _PYTZ_BASE_CLASSES) diff --git a/django/utils/translation/__init__.py b/django/utils/translation/__init__.py index 6b8cc73d5c..0b3f78e486 100644 --- a/django/utils/translation/__init__.py +++ b/django/utils/translation/__init__.py @@ -149,7 +149,7 @@ def lazy_number(func, resultclass, number=None, **kwargs): number_value = rhs translated = self._translate(number_value) try: - translated = translated % rhs + translated %= rhs except TypeError: # String doesn't contain a placeholder for the number. pass |
