From patchwork Sun Dec 2 04:46:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 13315 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 26C492425B for ; Sun, 2 Dec 2012 04:46:16 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id B2623A1806E for ; Sun, 2 Dec 2012 04:46:15 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so2509560ieb.11 for ; Sat, 01 Dec 2012 20:46:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :content-type:mime-version:x-launchpad-project:x-launchpad-branch :x-launchpad-message-rationale:x-launchpad-branch-revision-number :x-launchpad-notification-type:to:from:subject:message-id:date :reply-to:sender:errors-to:precedence:x-generated-by :x-launchpad-hash:x-gm-message-state; bh=VXGtpn3dYTnWM/V9XFHMoCfFXgNjo55phXWgls4M++U=; b=AmtMlkBZ+ywstlHEqD7epgyOUigYS4h6TNawooEebjyB58sIuqeoHwHz3DtKE9RhBb 4n/gvi0AhAVtyeWF21pYNGf/35RADIGmUiBuVfOELGv6ak+L3qM2ZVwDwRRgHQFogBsh 8a+MG+uuAEiY8j3gqV4ZrOVIOF1unplZCZ0+E9/1assWjTovDqZhBrrODmg1CsbBimrD ibkcFM9TxECb80zkFNhy/EqudJQ5RHu1vGiveJjIhcH0XvD3Pd6VVORgXBTrCy79p0pi qliEo0AUb9z/5t89IGq2EZpimjudS+nn9gOnKwUIIHaLSWwu1eVm3x366+Zz6fTdM4hP hjBA== Received: by 10.50.173.34 with SMTP id bh2mr2885422igc.70.1354423575081; Sat, 01 Dec 2012 20:46:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp1240185igt; Sat, 1 Dec 2012 20:46:13 -0800 (PST) Received: by 10.180.103.201 with SMTP id fy9mr4099367wib.10.1354423572733; Sat, 01 Dec 2012 20:46:12 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id l4si4003140wef.101.2012.12.01.20.46.11 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 01 Dec 2012 20:46:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Tf1RT-0001Cz-JZ for ; Sun, 02 Dec 2012 04:46:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 7152BE03DD for ; Sun, 2 Dec 2012 04:46:11 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 474 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 474: fix some pylint warnings in config.py Message-Id: <20121202044611.21737.20126.launchpad@ackee.canonical.com> Date: Sun, 02 Dec 2012 04:46:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16319"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 3762b92c8f754c7364dc0daa6dc516b1e0776a97 X-Gm-Message-State: ALoCoQlhz5PNgm3Fclgysy4iJqYp11hxffTuDT0nqRscWTfLNJ9ZO5o9G/a7hlxul53DtqOT/UaY ------------------------------------------------------------ revno: 474 committer: Andy Doan branch nick: device-list timestamp: Fri 2012-11-30 13:13:30 -0600 message: fix some pylint warnings in config.py modified: lava_dispatcher/config.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava_dispatcher/config.py' --- lava_dispatcher/config.py 2012-11-30 01:54:29 +0000 +++ lava_dispatcher/config.py 2012-11-30 19:13:30 +0000 @@ -23,15 +23,15 @@ import StringIO import logging - from configglue import parser, schema + class DeviceSchema(schema.Schema): android_binary_drivers = schema.StringOption() cts_media_url = schema.StringOption() - boot_cmds = schema.StringOption(fatal=True) # Can do better here - boot_cmds_android = schema.StringOption(fatal=True) # And here - boot_cmds_oe = schema.StringOption(fatal=True) # And here? + boot_cmds = schema.StringOption(fatal=True) # Can do better here + boot_cmds_android = schema.StringOption(fatal=True) # And here + boot_cmds_oe = schema.StringOption(fatal=True) # And here? boot_options = schema.ListOption() boot_linaro_timeout = schema.IntOption(default=300) boot_part = schema.IntOption(fatal=True) @@ -74,9 +74,11 @@ simulator_command = schema.StringOption() simulator_axf_files = schema.ListOption() + class OptionDescriptor(object): def __init__(self, name): self.name = name + def __get__(self, inst, cls=None): return inst.cp.get('__main__', self.name) @@ -106,8 +108,9 @@ class DispatcherConfig(object): - def __init__(self, cp): + def __init__(self, cp, config_dir): self.cp = cp + self.config_dir = config_dir for option in DispatcherSchema().options(): locals()[option.name] = OptionDescriptor(option.name) @@ -154,20 +157,19 @@ if not config_files: raise Exception("no config files named %r found" % (name + ".conf")) config_files.reverse() - logging.debug("About to read %s" % str(config_files)) + logging.debug("About to read %s", str(config_files)) for path in config_files: _read_into(path, cp) return cp + def get_config(config_dir): cp = parser.SchemaConfigParser(DispatcherSchema()) _get_config("lava-dispatcher", config_dir, cp) valid, report = cp.is_valid(report=True) if not valid: logging.warning("dispatcher config is not valid:\n %s", '\n '.join(report)) - c = DispatcherConfig(cp) - c.config_dir = config_dir - return c + return DispatcherConfig(cp, config_dir) def get_device_config(name, config_dir):