aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Williams <neil.williams@linaro.org>2017-07-10 13:09:10 +0100
committerSenthil Kumaran Shanmugasundaram <senthil.kumaran@linaro.org>2017-07-10 17:17:32 +0000
commit2b8cb856107d71f599a7ee28c2deadcea224c828 (patch)
treecfeb54902f463c200df21eec70616147ee0de84c
parent9f36d595cd120b16bb6ed0cc47551ba172615c6c (diff)
Fix entrypoints errors and tests
Change-Id: I893dc0d960d059e7539c37a3f03a7f92cbf6e7e4 Reviewed-on: https://review.linaro.org/20578 Reviewed-by: lava-bot Reviewed-by: Senthil Kumaran Shanmugasundaram <senthil.kumaran@linaro.org>
-rwxr-xr-xci-run8
-rw-r--r--entry_points.ini2
-rw-r--r--lava_dashboard_tool/commands.py152
3 files changed, 20 insertions, 142 deletions
diff --git a/ci-run b/ci-run
index b539f66..c0a2c42 100755
--- a/ci-run
+++ b/ci-run
@@ -2,10 +2,10 @@
set -e
-pep8 --ignore E501 lava
-pep8 --ignore E501 lava_scheduler_tool
-pep8 --ignore E501,W291 lava_dashboard_tool
-pep8 --ignore E501 lava_tool
+pep8 --ignore E501,E722 lava
+pep8 --ignore E501,E722 lava_scheduler_tool
+pep8 --ignore E501,E722,W291 lava_dashboard_tool
+pep8 --ignore E501,E722 lava_tool
python -m unittest discover lava -v
python -m unittest discover lava_tool -v
diff --git a/entry_points.ini b/entry_points.ini
index d5d3b4f..0c3feb9 100644
--- a/entry_points.ini
+++ b/entry_points.ini
@@ -74,7 +74,6 @@ put=lava_dashboard_tool.commands:put
query_data_view=lava_dashboard_tool.commands:query_data_view
server_version=lava_dashboard_tool.commands:server_version
streams=lava_dashboard_tool.commands:streams
-version=lava_dashboard_tool.commands:version
[lava_dashboard_tool.commands]
bundles=lava_dashboard_tool.commands:bundles
@@ -87,7 +86,6 @@ put=lava_dashboard_tool.commands:put
query_data_view=lava_dashboard_tool.commands:query_data_view
server_version=lava_dashboard_tool.commands:server_version
streams=lava_dashboard_tool.commands:streams
-version=lava_dashboard_tool.commands:version
[lava.job.commands]
new = lava.job.commands:new
diff --git a/lava_dashboard_tool/commands.py b/lava_dashboard_tool/commands.py
index bdad5a3..c27ad28 100644
--- a/lava_dashboard_tool/commands.py
+++ b/lava_dashboard_tool/commands.py
@@ -60,6 +60,7 @@ class InsufficientServerVersion(Exception):
class DataSetRenderer(object):
"""
+ ** DEPRECATED **
Support class for rendering a table out of list of dictionaries.
It supports several features that make printing tabular data easier.
@@ -96,6 +97,8 @@ class DataSetRenderer(object):
def _analyze_dataset(self, dataset):
"""
+ ** DEPRECATED **
+
Determine the columns that will be displayed and the maximum
length of each of those columns.
@@ -104,68 +107,6 @@ class DataSetRenderer(object):
column name to maximum length of any value in the row or the
column header and the dataset is a copy of the dataset altered
as necessary.
-
- Some examples:
-
- First the dataset, an array of dictionaries
- >>> dataset = [
- ... {'a': 'shorter', 'bee': ''},
- ... {'a': 'little longer', 'bee': 'b'}]
-
- Note that column 'bee' is actually three characters long as the
- column name made it wider.
- >>> dataset_out, columns, maxlen = DataSetRenderer(
- ... )._analyze_dataset(dataset)
-
- Unless you format rows with a custom function the data is not altered.
- >>> dataset_out is dataset
- True
-
- Columns come out in sorted alphabetic order
- >>> columns
- ['a', 'bee']
-
- Maximum length determines the width of each column. Note that
- the header affects the column width.
- >>> maxlen
- {'a': 13, 'bee': 3}
-
- You can constrain or reorder columns. In that case columns you
- decided to ignore are simply left out of the output.
- >>> dataset_out, columns, maxlen = DataSetRenderer(
- ... order=['bee'])._analyze_dataset(dataset)
- >>> columns
- ['bee']
- >>> maxlen
- {'bee': 3}
-
- You can format values anyway you like:
- >>> dataset_out, columns, maxlen = DataSetRenderer(row_formatter={
- ... 'bee': lambda value: "%10s" % value}
- ... )._analyze_dataset(dataset)
-
- Dataset is altered to take account of the row formatting
- function. The original dataset argument is copied.
- >>> dataset_out
- [{'a': 'shorter', 'bee': ' '}, {'a': 'little longer', 'bee': ' b'}]
- >>> dataset_out is not dataset
- True
-
- Columns stay the same though:
- >>> columns
- ['a', 'bee']
-
- Note how formatting altered the width of the column 'bee'
- >>> maxlen
- {'a': 13, 'bee': 10}
-
- You can also format columns (with nice aliases).Note how
- column 'bee' maximum width is now dominated by the long column
- name:
- >>> dataset_out, columns, maxlen = DataSetRenderer(column_map={
- ... 'bee': "Column B"})._analyze_dataset(dataset)
- >>> maxlen
- {'a': 13, 'bee': 8}
"""
if self.order:
columns = self.order
@@ -191,49 +132,7 @@ class DataSetRenderer(object):
"""
Render a header, possibly with a caption string
- Caption is controlled by the constructor.
- >>> dataset = [
- ... {'a': 'shorter', 'bee': ''},
- ... {'a': 'little longer', 'bee': 'b'}]
- >>> columns = ['a', 'bee']
- >>> maxlen = {'a': 13, 'bee': 3}
-
- By default there is no caption, just column names:
- >>> DataSetRenderer()._render_header(
- ... dataset, columns, maxlen)
- a bee
-
- If you enable the header separator then column names will be visually
- separated from the first row of data.
- >>> DataSetRenderer(header_separator=True)._render_header(
- ... dataset, columns, maxlen)
- a bee
- -----------------
-
- If you provide a caption it gets rendered as a centered
- underlined text before the data:
- >>> DataSetRenderer(caption="Dataset")._render_header(
- ... dataset, columns, maxlen)
- Dataset
- =================
- a bee
-
- You can use both caption and header separator
- >>> DataSetRenderer(caption="Dataset", header_separator=True)._render_header(
- ... dataset, columns, maxlen)
- Dataset
- =================
- a bee
- -----------------
-
- Observe how the total length of the output horizontal line
- depends on the separator! Also note the columns labels are
- aligned to the center of the column
- >>> DataSetRenderer(caption="Dataset", separator=" | ")._render_header(
- ... dataset, columns, maxlen)
- Dataset
- ===================
- a | bee
+ ** DEPRECATED **
"""
total_len = sum(maxlen.itervalues())
if len(columns):
@@ -252,25 +151,12 @@ class DataSetRenderer(object):
def _render_rows(self, dataset, columns, maxlen):
"""
+ ** DEPRECATED **
+
Render rows of the dataset.
Each row is printed on one line using the maxlen argument to
determine correct column size. Text is aligned left.
-
- First the dataset, columns and maxlen as produced by
- _analyze_dataset()
- >>> dataset = [
- ... {'a': 'shorter', 'bee': ''},
- ... {'a': 'little longer', 'bee': 'b'}]
- >>> columns = ['a', 'bee']
- >>> maxlen = {'a': 13, 'bee': 3}
-
- Now a plain table. Note! To really understand this test
- you should check out the whitespace in the strings below. There
- are two more spaces after 'b' in the second row
- >>> DataSetRenderer()._render_rows(dataset, columns, maxlen)
- shorter
- little longer b
"""
for row in dataset:
print self.separator.join([
@@ -279,6 +165,8 @@ class DataSetRenderer(object):
def _render_dataset(self, dataset):
"""
+ ** DEPRECATED **
+
Render the header followed by the rows of data.
"""
dataset, columns, maxlen = self._analyze_dataset(dataset)
@@ -287,15 +175,9 @@ class DataSetRenderer(object):
def _render_empty_dataset(self):
"""
- Render empty dataset.
+ ** DEPRECATED **
- By default it just prints out a fixed sentence:
- >>> DataSetRenderer()._render_empty_dataset()
- There is no data to display
-
- This can be changed by passing an argument to the constructor
- >>> DataSetRenderer(empty="there is no data")._render_empty_dataset()
- there is no data
+ Render empty dataset.
"""
print self.empty
@@ -309,6 +191,8 @@ class DataSetRenderer(object):
class XMLRPCCommand(Command):
"""
+ ** DEPRECATED **
+
Abstract base class for commands that interact with dashboard server
over XML-RPC.
@@ -333,17 +217,11 @@ class XMLRPCCommand(Command):
@staticmethod
def _strict_server_version(version):
"""
+ ** DEPRECATED **
+
Calculate strict server version (as defined by
distutils.version.StrictVersion). This works by discarding .candidate
and .dev release-levels.
- >>> XMLRPCCommand._strict_server_version("0.4.0.candidate.5")
- '0.4.0'
- >>> XMLRPCCommand._strict_server_version("0.4.0.dev.126")
- '0.4.0'
- >>> XMLRPCCommand._strict_server_version("0.4.0.alpha.1")
- '0.4.0a1'
- >>> XMLRPCCommand._strict_server_version("0.4.0.beta.2")
- '0.4.0b2'
"""
try:
major, minor, micro, releaselevel, serial = version.split(".")
@@ -364,6 +242,8 @@ class XMLRPCCommand(Command):
def _check_server_version(self, server_obj, required_version):
"""
+ ** DEPRECATED **
+
Obsolete function dating from pre-packaging requirements
"""
return True