From 8838d4dd498c8f66ea4237fe8a79a5f77d6f95c9 Mon Sep 17 00:00:00 2001 From: Vytis Banaitis Date: Wed, 1 Feb 2017 18:41:56 +0200 Subject: Refs #23919 -- Replaced kwargs.pop() with keyword-only arguments. --- django/utils/datastructures.py | 7 +------ django/utils/deconstruct.py | 6 ++---- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'django/utils') diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 8e64328a2c..c15cb5eb49 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -235,12 +235,7 @@ class ImmutableList(tuple): AttributeError: You cannot mutate this. """ - def __new__(cls, *args, **kwargs): - if 'warning' in kwargs: - warning = kwargs['warning'] - del kwargs['warning'] - else: - warning = 'ImmutableList object is immutable.' + def __new__(cls, *args, warning='ImmutableList object is immutable.', **kwargs): self = tuple.__new__(cls, *args, **kwargs) self.warning = warning return self diff --git a/django/utils/deconstruct.py b/django/utils/deconstruct.py index 6bc70f7e53..c546fc1dea 100644 --- a/django/utils/deconstruct.py +++ b/django/utils/deconstruct.py @@ -3,15 +3,13 @@ from importlib import import_module from django.utils.version import get_docs_version -def deconstructible(*args, **kwargs): +def deconstructible(*args, path=None): """ Class decorator that allow the decorated class to be serialized by the migrations subsystem. Accepts an optional kwarg `path` to specify the import path. """ - path = kwargs.pop('path', None) - def decorator(klass): def __new__(cls, *args, **kwargs): # We capture the arguments to make returning them trivial @@ -54,4 +52,4 @@ def deconstructible(*args, **kwargs): if not args: return decorator - return decorator(*args, **kwargs) + return decorator(*args) -- cgit v1.3