Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814430/?format=api
{ "id": 814430, "url": "http://patchwork.ozlabs.org/api/patches/814430/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170915233739.26860-7-ehabkost@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170915233739.26860-7-ehabkost@redhat.com>", "list_archive_url": null, "date": "2017-09-15T23:37:30", "name": "[PULL,06/15] qmp.py: Couple of pylint/style fixes", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "afd210706c6029fa8ba93bccfb63799988fb51f1", "submitter": { "id": 195, "url": "http://patchwork.ozlabs.org/api/people/195/?format=api", "name": "Eduardo Habkost", "email": "ehabkost@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170915233739.26860-7-ehabkost@redhat.com/mbox/", "series": [ { "id": 3400, "url": "http://patchwork.ozlabs.org/api/series/3400/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3400", "date": "2017-09-15T23:37:24", "name": "[PULL,01/15] qemu.py: Pylint/style fixes", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3400/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814430/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814430/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=ehabkost@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xvBkS520Nz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 16 Sep 2017 09:41:36 +1000 (AEST)", "from localhost ([::1]:55366 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dt0Eo-0007R3-N9\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 19:41:34 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:56396)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <ehabkost@redhat.com>) id 1dt0Bf-0005Io-RX\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 19:38:21 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <ehabkost@redhat.com>) id 1dt0Bc-0001Wx-8V\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 19:38:19 -0400", "from mx1.redhat.com ([209.132.183.28]:51400)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <ehabkost@redhat.com>) id 1dt0Bc-0001UP-0M\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 19:38:16 -0400", "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 110827E420;\n\tFri, 15 Sep 2017 23:38:15 +0000 (UTC)", "from localhost (ovpn-116-24.gru2.redhat.com [10.97.116.24])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 01B3A62461;\n\tFri, 15 Sep 2017 23:38:09 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 110827E420", "From": "Eduardo Habkost <ehabkost@redhat.com>", "To": "Peter Maydell <peter.maydell@linaro.org>,\n\tqemu-devel@nongnu.org", "Date": "Fri, 15 Sep 2017 20:37:30 -0300", "Message-Id": "<20170915233739.26860-7-ehabkost@redhat.com>", "In-Reply-To": "<20170915233739.26860-1-ehabkost@redhat.com>", "References": "<20170915233739.26860-1-ehabkost@redhat.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tFri, 15 Sep 2017 23:38:15 +0000 (UTC)", "Content-Transfer-Encoding": "quoted-printable", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [PULL 06/15] qmp.py: Couple of pylint/style fixes", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "=?utf-8?b?THVrw6HFoSBEb2t0b3I=?= <ldoktor@redhat.com>,\n\tAmador Pahim <apahim@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "From: Lukáš Doktor <ldoktor@redhat.com>\n\nNo actual code changes, just initializing attributes earlier to avoid\nAttributeError on early introspection, a few pylint/style fixes and\ndocstring clarifications.\n\nSigned-off-by: Lukáš Doktor <ldoktor@redhat.com>\nReviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\nMessage-Id: <20170818142613.32394-7-ldoktor@redhat.com>\nSigned-off-by: Eduardo Habkost <ehabkost@redhat.com>\n---\n scripts/qmp/qmp.py | 37 ++++++++++++++++++++++++-------------\n 1 file changed, 24 insertions(+), 13 deletions(-)", "diff": "diff --git a/scripts/qmp/qmp.py b/scripts/qmp/qmp.py\nindex 62d3651967..782d1ac5df 100644\n--- a/scripts/qmp/qmp.py\n+++ b/scripts/qmp/qmp.py\n@@ -13,19 +13,30 @@ import errno\n import socket\n import sys\n \n+\n class QMPError(Exception):\n pass\n \n+\n class QMPConnectError(QMPError):\n pass\n \n+\n class QMPCapabilitiesError(QMPError):\n pass\n \n+\n class QMPTimeoutError(QMPError):\n pass\n \n+\n class QEMUMonitorProtocol:\n+\n+ #: Socket's error class\n+ error = socket.error\n+ #: Socket's timeout\n+ timeout = socket.timeout\n+\n def __init__(self, address, server=False, debug=False):\n \"\"\"\n Create a QEMUMonitorProtocol class.\n@@ -42,6 +53,7 @@ class QEMUMonitorProtocol:\n self.__address = address\n self._debug = debug\n self.__sock = self.__get_sock()\n+ self.__sockfile = None\n if server:\n self.__sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n self.__sock.bind(self.__address)\n@@ -56,7 +68,7 @@ class QEMUMonitorProtocol:\n \n def __negotiate_capabilities(self):\n greeting = self.__json_read()\n- if greeting is None or not greeting.has_key('QMP'):\n+ if greeting is None or \"QMP\" not in greeting:\n raise QMPConnectError\n # Greeting seems ok, negotiate capabilities\n resp = self.cmd('qmp_capabilities')\n@@ -78,8 +90,6 @@ class QEMUMonitorProtocol:\n continue\n return resp\n \n- error = socket.error\n-\n def __get_events(self, wait=False):\n \"\"\"\n Check for new events in the stream and cache them in __events.\n@@ -89,8 +99,8 @@ class QEMUMonitorProtocol:\n \n @raise QMPTimeoutError: If a timeout float is provided and the timeout\n period elapses.\n- @raise QMPConnectError: If wait is True but no events could be retrieved\n- or if some other error occurred.\n+ @raise QMPConnectError: If wait is True but no events could be\n+ retrieved or if some other error occurred.\n \"\"\"\n \n # Check for new events regardless and pull them into the cache:\n@@ -175,7 +185,7 @@ class QEMUMonitorProtocol:\n @param args: command arguments (dict)\n @param id: command id (dict, list, string or int)\n \"\"\"\n- qmp_cmd = { 'execute': name }\n+ qmp_cmd = {'execute': name}\n if args:\n qmp_cmd['arguments'] = args\n if id:\n@@ -183,6 +193,9 @@ class QEMUMonitorProtocol:\n return self.cmd_obj(qmp_cmd)\n \n def command(self, cmd, **kwds):\n+ \"\"\"\n+ Build and send a QMP command to the monitor, report errors if any\n+ \"\"\"\n ret = self.cmd(cmd, kwds)\n if ret.has_key('error'):\n raise Exception(ret['error']['desc'])\n@@ -190,15 +203,15 @@ class QEMUMonitorProtocol:\n \n def pull_event(self, wait=False):\n \"\"\"\n- Get and delete the first available QMP event.\n+ Pulls a single event.\n \n @param wait (bool): block until an event is available.\n @param wait (float): If wait is a float, treat it as a timeout value.\n \n @raise QMPTimeoutError: If a timeout float is provided and the timeout\n period elapses.\n- @raise QMPConnectError: If wait is True but no events could be retrieved\n- or if some other error occurred.\n+ @raise QMPConnectError: If wait is True but no events could be\n+ retrieved or if some other error occurred.\n \n @return The first available QMP event, or None.\n \"\"\"\n@@ -217,8 +230,8 @@ class QEMUMonitorProtocol:\n \n @raise QMPTimeoutError: If a timeout float is provided and the timeout\n period elapses.\n- @raise QMPConnectError: If wait is True but no events could be retrieved\n- or if some other error occurred.\n+ @raise QMPConnectError: If wait is True but no events could be\n+ retrieved or if some other error occurred.\n \n @return The list of available QMP events.\n \"\"\"\n@@ -235,8 +248,6 @@ class QEMUMonitorProtocol:\n self.__sock.close()\n self.__sockfile.close()\n \n- timeout = socket.timeout\n-\n def settimeout(self, timeout):\n self.__sock.settimeout(timeout)\n \n", "prefixes": [ "PULL", "06/15" ] }