summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-07-06 12:00:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-08 09:57:06 +0100
commit5d4df14b0d38f6c89ca16de6dada58b4bb015d71 (patch)
tree69d41fd32b0e77b9d0131a65a76a8d9163503c01 /bin
parenta55c280c167f84caed6518119246e5a55f56cfd4 (diff)
downloadbitbake-contrib-5d4df14b0d38f6c89ca16de6dada58b4bb015d71.tar.gz
eventreplay: replace MockConfigParameters with namedtuple
class MockConfigParameters has only one attribute and only __init__ method. Replacing it with namedtuple makes code less nested and more readable. [YOCTO #9585] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/toaster-eventreplay14
1 files changed, 2 insertions, 12 deletions
diff --git a/bin/toaster-eventreplay b/bin/toaster-eventreplay
index a1072988a..b9ab79e42 100755
--- a/bin/toaster-eventreplay
+++ b/bin/toaster-eventreplay
@@ -30,6 +30,7 @@ from __future__ import print_function
import os
import sys, logging
import codecs
+from collections import namedtuple
# mangle syspath to allow easy import of modules
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
@@ -159,17 +160,6 @@ class FileReadEventsServerConnection():
self.events = FileReadEventsServerConnection.EventReader(self)
-
-
-
-
-class MockConfigParameters():
- """ stand-in for cookerdata.ConfigParameters; as we don't really config a cooker, this
- serves just to supply needed interfaces for the toaster ui to work """
- def __init__(self):
- self.observe_only = True # we can only read files
-
-
# run toaster ui on our mock bitbake class
if __name__ == "__main__":
if len(sys.argv) < 2:
@@ -178,7 +168,7 @@ if __name__ == "__main__":
file_name = sys.argv[-1]
mock_connection = FileReadEventsServerConnection(file_name)
- configParams = MockConfigParameters()
+ configParams = namedtuple('ConfigParams', ['observe_only'])(True)
# run the main program and set exit code to the returned value
sys.exit(toasterui.main(mock_connection.connection, mock_connection.events, configParams))