aboutsummaryrefslogtreecommitdiff
path: root/trappy/utils.py
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2015-11-26 11:51:53 +0000
committerJavi Merino <javi.merino@arm.com>2015-11-26 11:57:08 +0000
commitb95a4c5504771224bfe6a4abec759c00d2612a73 (patch)
tree8de715af9c8ed679df2fbb36ac5a43eb6193a2f4 /trappy/utils.py
parent742af6fed8570bbfe0f0e8f48ca5c23a2d4b7602 (diff)
downloadtrappy-b95a4c5504771224bfe6a4abec759c00d2612a73.tar.gz
utils: move listify to a generic trappy.utils file
listify() is used in both plotter and stats. Move it out of trappy.plotter.Utils into a generic trappy.utils file as it's not something specific of the plotter.
Diffstat (limited to 'trappy/utils.py')
-rw-r--r--trappy/utils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/trappy/utils.py b/trappy/utils.py
new file mode 100644
index 0000000..5d205e9
--- /dev/null
+++ b/trappy/utils.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2015 ARM Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""Generic functions that can be used in multiple places in trappy
+"""
+
+def listify(to_select):
+ """Utitlity function to handle both single and
+ list inputs
+ """
+
+ if not isinstance(to_select, list):
+ to_select = [to_select]
+
+ return to_select