Skip to content

Commit

Permalink
Move all functions associated with display_cimobjects to separate
Browse files Browse the repository at this point in the history
module.

This is first part of adding the code for issue #249, display classes
as tables.  Because the new code is going to significantly increase the
size of the functions associated with displaying objects as tables, it
was logical to move this from _common.py to its own file.

Fixes alse  one pylint issue by changing code

Fixes issue where pylint was reporting possible undefined variable in
pick_one_from_list() when the variable was part of a for statement by
not using that variable and creating a new variable to represent the
same information.

In the process we noted that there was no test for the correct pick of
last item in the list and confirmation that if the next higher number
was picked it treated as invalid a so test was added.
  • Loading branch information
KSchopmeyer authored and andy-maier committed Aug 11, 2020
1 parent 3bac9a8 commit 8d123a4
Show file tree
Hide file tree
Showing 9 changed files with 1,191 additions and 1,072 deletions.
3 changes: 3 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ Released: not yet
--connections-file general option in various places, for consistency.
(Related to issue #708)

* Move code associated with display_cimobjects() to a separate module. This
is part of creating table representation of classes (See issue #249)

**Known issues:**

* See `list of open issues`_.
Expand Down
1 change: 1 addition & 0 deletions pywbemtools/pywbemcli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from ._association_shrub import * # noqa: F403,F401
from ._utils import * # noqa: F403,F401
from ._cimvalueformatter import * # noqa: F403,F401
from ._display_cimobjects import * # noqa: F403,F401


from .._version import __version__ # noqa: F401
6 changes: 5 additions & 1 deletion pywbemtools/pywbemcli/_cmd_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
CIM_ERR_NOT_FOUND, CIMClass

from .pywbemcli import cli
from ._common import display_cim_objects, filter_namelist, \
from ._common import filter_namelist, \
resolve_propertylist, CMD_OPTS_TXT, GENERAL_OPTS_TXT, SUBCMD_HELP_TXT, \
output_format_is_table, format_table, process_invokemethod, \
raise_pywbem_error_exception, warning_msg, validate_output_format

from ._display_cimobjects import display_cim_objects

from ._common_options import add_options, propertylist_option, \
names_only_option, include_classorigin_class_option, namespace_option, \
summary_option, multiple_namespaces_option, class_filter_options, \
Expand Down Expand Up @@ -708,6 +711,7 @@ def cmd_class_get(context, classname, options):
the class. If the class cannot be found, the server returns a CIMError
exception.
"""

format_group = get_format_group(context, options)
output_format = validate_output_format(context.output_format, format_group)

Expand Down
5 changes: 3 additions & 2 deletions pywbemtools/pywbemcli/_cmd_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
CIM_ERR_NOT_FOUND

from .pywbemcli import cli
from ._common import display_cim_objects, \
pick_instance, resolve_propertylist, create_ciminstance, \
from ._common import pick_instance, resolve_propertylist, create_ciminstance, \
filter_namelist, format_table, verify_operation, \
process_invokemethod, raise_pywbem_error_exception, \
parse_kv_pair, warning_msg, validate_output_format, \
CMD_OPTS_TXT, GENERAL_OPTS_TXT, SUBCMD_HELP_TXT

from ._display_cimobjects import display_cim_objects

from ._common_options import add_options, propertylist_option, \
names_only_option, include_classorigin_instance_option, namespace_option, \
summary_option, verify_option, multiple_namespaces_option, \
Expand Down
3 changes: 2 additions & 1 deletion pywbemtools/pywbemcli/_cmd_qualifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
from pywbem import Error

from .pywbemcli import cli
from ._common import display_cim_objects, sort_cimobjects, \
from ._common import sort_cimobjects, \
raise_pywbem_error_exception, validate_output_format, \
CMD_OPTS_TXT, GENERAL_OPTS_TXT, SUBCMD_HELP_TXT
from ._display_cimobjects import display_cim_objects
from ._common_options import add_options, namespace_option, summary_option, \
help_option
from ._click_extensions import PywbemcliGroup, PywbemcliCommand
Expand Down
Loading

0 comments on commit 8d123a4

Please sign in to comment.