Skip to content

Commit 6b4f8f1

Browse files
committed
Move all functions associated with display_cimobjects to separate
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.
1 parent 3bac9a8 commit 6b4f8f1

File tree

8 files changed

+1188
-1072
lines changed

8 files changed

+1188
-1072
lines changed

pywbemtools/pywbemcli/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from ._association_shrub import * # noqa: F403,F401
4040
from ._utils import * # noqa: F403,F401
4141
from ._cimvalueformatter import * # noqa: F403,F401
42+
from ._display_cimobjects import * # noqa: F403,F401
4243

4344

4445
from .._version import __version__ # noqa: F401

pywbemtools/pywbemcli/_cmd_class.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@
2929
CIM_ERR_NOT_FOUND, CIMClass
3030

3131
from .pywbemcli import cli
32-
from ._common import display_cim_objects, filter_namelist, \
32+
from ._common import filter_namelist, \
3333
resolve_propertylist, CMD_OPTS_TXT, GENERAL_OPTS_TXT, SUBCMD_HELP_TXT, \
3434
output_format_is_table, format_table, process_invokemethod, \
3535
raise_pywbem_error_exception, warning_msg, validate_output_format
36+
37+
from ._display_cimobjects import display_cim_objects
38+
3639
from ._common_options import add_options, propertylist_option, \
3740
names_only_option, include_classorigin_class_option, namespace_option, \
3841
summary_option, multiple_namespaces_option, class_filter_options, \
@@ -708,6 +711,7 @@ def cmd_class_get(context, classname, options):
708711
the class. If the class cannot be found, the server returns a CIMError
709712
exception.
710713
"""
714+
711715
format_group = get_format_group(context, options)
712716
output_format = validate_output_format(context.output_format, format_group)
713717

pywbemtools/pywbemcli/_cmd_instance.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828
CIM_ERR_NOT_FOUND
2929

3030
from .pywbemcli import cli
31-
from ._common import display_cim_objects, \
32-
pick_instance, resolve_propertylist, create_ciminstance, \
31+
from ._common import pick_instance, resolve_propertylist, create_ciminstance, \
3332
filter_namelist, format_table, verify_operation, \
3433
process_invokemethod, raise_pywbem_error_exception, \
3534
parse_kv_pair, warning_msg, validate_output_format, \
3635
CMD_OPTS_TXT, GENERAL_OPTS_TXT, SUBCMD_HELP_TXT
3736

37+
from ._display_cimobjects import display_cim_objects
38+
3839
from ._common_options import add_options, propertylist_option, \
3940
names_only_option, include_classorigin_instance_option, namespace_option, \
4041
summary_option, verify_option, multiple_namespaces_option, \

pywbemtools/pywbemcli/_cmd_qualifier.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@
2727
from pywbem import Error
2828

2929
from .pywbemcli import cli
30-
from ._common import display_cim_objects, sort_cimobjects, \
30+
from ._common import sort_cimobjects, \
3131
raise_pywbem_error_exception, validate_output_format, \
3232
CMD_OPTS_TXT, GENERAL_OPTS_TXT, SUBCMD_HELP_TXT
33+
from ._display_cimobjects import display_cim_objects
3334
from ._common_options import add_options, namespace_option, summary_option, \
3435
help_option
3536
from ._click_extensions import PywbemcliGroup, PywbemcliCommand

0 commit comments

Comments
 (0)