[Pkg-mpd-commits] [python-mpd] 57/91: asyncio base modifications: Restore Python 2 compatibility

Simon McVittie smcv at debian.org
Sat Feb 24 14:55:36 UTC 2018


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository python-mpd.

commit 2d383a49b71bf9003a03253fd494eb8f97307358
Author: chrysn <chrysn at fsfe.org>
Date:   Fri Apr 21 09:27:50 2017 +0200

    asyncio base modifications: Restore Python 2 compatibility
    
    The (*args, key=word) syntax was introduced with PEP 3102; this works
    around the missing syntax by using **kwargs; the additional check is
    required to avoid silently ignoring arguments.
---
 mpd/base.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mpd/base.py b/mpd/base.py
index 1d0d565..af58455 100644
--- a/mpd/base.py
+++ b/mpd/base.py
@@ -117,9 +117,12 @@ class mpd_commands(object):
     callback.
     """
 
-    def __init__(self, *commands, is_direct=False):
+    def __init__(self, *commands, **kwargs):
         self.commands = commands
-        self.is_direct = is_direct
+        self.is_direct = kwargs.pop('is_direct', False)
+        if kwargs:
+            raise AttributeError("mpd_commands() got unexpected keyword"
+                    " arguments %s" % ",".join(kwargs))
 
     def __call__(self, ob):
         ob.mpd_commands = self.commands

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list