1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Replaced kwargs.pop() with keyword-only arguments.

This commit is contained in:
Jon Dufresne 2018-10-08 12:06:02 -07:00 committed by Tim Graham
parent 2ba588e773
commit 1e87c9fe71
2 changed files with 5 additions and 7 deletions

View File

@ -42,9 +42,9 @@ class CommandParser(ArgumentParser):
SystemExit in several occasions, as SystemExit is unacceptable when a SystemExit in several occasions, as SystemExit is unacceptable when a
command is called programmatically. command is called programmatically.
""" """
def __init__(self, **kwargs): def __init__(self, *, missing_args_message=None, called_from_command_line=None, **kwargs):
self.missing_args_message = kwargs.pop('missing_args_message', None) self.missing_args_message = missing_args_message
self.called_from_command_line = kwargs.pop('called_from_command_line', None) self.called_from_command_line = called_from_command_line
super().__init__(**kwargs) super().__init__(**kwargs)
def parse_args(self, args=None, namespace=None): def parse_args(self, args=None, namespace=None):

View File

@ -55,10 +55,8 @@ class Q(tree.Node):
default = AND default = AND
conditional = True conditional = True
def __init__(self, *args, **kwargs): def __init__(self, *args, _connector=None, _negated=False, **kwargs):
connector = kwargs.pop('_connector', None) super().__init__(children=[*args, *sorted(kwargs.items())], connector=_connector, negated=_negated)
negated = kwargs.pop('_negated', False)
super().__init__(children=[*args, *sorted(kwargs.items())], connector=connector, negated=negated)
def _combine(self, other, conn): def _combine(self, other, conn):
if not isinstance(other, Q): if not isinstance(other, Q):