Skip to content

Commit d18dbc0

Browse files
authored
Retire unused old SOAP output support to address lint errors in output.py (#386)
Retire unused old SOAP output support to address lint errors in `output.py`. Drop the long disabled `xml_format` while at it. Includes a few unrelated autopep8 style fixes.
2 parents fa2a3ba + 1860b7c commit d18dbc0

File tree

1 file changed

+11
-26
lines changed

1 file changed

+11
-26
lines changed

mig/shared/output.py

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,7 @@ def html_format(configuration, ret_val, ret_msg, out_obj):
19031903
skip_list = i.get('skip_list', [])
19041904
optional_cols = [('access', 'Access'), ('created', 'Created'),
19051905
('active', 'Active'), ('owner', 'Owner'),
1906-
('invites', 'Invites'), ('expire', 'Expire'),
1906+
('invites', 'Invites'), ('expire', 'Expire'),
19071907
('single_file', 'Single file'),
19081908
]
19091909
# IMPORTANT: AdBlock Plus hides elements with class sharelink(s)
@@ -2647,20 +2647,6 @@ def html_format(configuration, ret_val, ret_msg, out_obj):
26472647
return '\n'.join(lines)
26482648

26492649

2650-
# def xml_format(configuration, ret_val, ret_msg, out_obj):
2651-
# """Generate output in xml format"""
2652-
#
2653-
# print "xml format not implemented yet"
2654-
# return True
2655-
2656-
2657-
def soap_format(configuration, ret_val, ret_msg, out_obj):
2658-
"""Generate output in soap format"""
2659-
2660-
import SOAPpy
2661-
return SOAPpy.buildSOAP(out_obj)
2662-
2663-
26642650
def pickle_helper(configuration, ret_val, ret_msg, out_obj, protocol=None):
26652651
"""Generate output in requested pickle protocol format"""
26662652

@@ -2749,7 +2735,7 @@ def file_format(configuration, ret_val, ret_msg, out_obj):
27492735
content_type = val
27502736
if content_type in ('text/plain', 'text/html'):
27512737
render_text, render_errors = True, True
2752-
#_logger.debug("render output in file_format: %s (%s %s)" %
2738+
# _logger.debug("render output in file_format: %s (%s %s)" %
27532739
# (out_obj, render_text, render_errors))
27542740
for entry in out_obj:
27552741
if entry['object_type'] == 'file_output':
@@ -2797,11 +2783,10 @@ def get_outputformat_helper(name, default_format='html'):
27972783
name = 'txt'
27982784
# TODO: can we use functools or similar to generate this map on the fly?
27992785
valid_format_map = {'txt': txt_format, 'html': html_format,
2800-
'soap': soap_format, 'pickle': pickle_format,
2801-
'pickle1': pickle1_format, 'pickle2': pickle2_format,
2802-
'yaml': yaml_format, 'xmlrpc': xmlrpc_format,
2803-
'resource': resource_format, 'json': json_format,
2804-
'file': file_format}
2786+
'pickle': pickle_format, 'pickle1': pickle1_format,
2787+
'pickle2': pickle2_format, 'yaml': yaml_format,
2788+
'xmlrpc': xmlrpc_format, 'resource': resource_format,
2789+
'json': json_format, 'file': file_format}
28052790
return valid_format_map[name]
28062791

28072792

@@ -2816,7 +2801,7 @@ def format_output(
28162801
"""This is the public method that should be called from other scripts"""
28172802

28182803
logger = configuration.logger
2819-
#logger.debug("format output to %s" % outputformat)
2804+
# logger.debug("format output to %s" % outputformat)
28202805
valid_formats = get_valid_outputformats()
28212806
(val_ret, val_msg) = validate(out_obj)
28222807
if not val_ret:
@@ -2867,7 +2852,7 @@ def format_output(
28672852
if not outputformat in ('txt', 'html', 'file'):
28682853
out_obj = [i for i in out_obj if i['object_type'] != 'wsgi']
28692854

2870-
#logger.debug("%s formatting output" % outputformat)
2855+
# logger.debug("%s formatting output" % outputformat)
28712856
try:
28722857
# return eval('%s_format(configuration, ret_val, ret_msg, out_obj)' %
28732858
# outputformat)
@@ -2900,10 +2885,10 @@ def format_output(
29002885
def format_timedelta(timedelta):
29012886
"""Formats timedelta as '[Years,] [days,] HH:MM:SS'"""
29022887
years = timedelta.days // 365
2903-
days = timedelta.days - (years*365)
2888+
days = timedelta.days - (years * 365)
29042889
hours = timedelta.seconds // 3600
2905-
minutes = (timedelta.seconds-(hours*3600)) // 60
2906-
seconds = timedelta.seconds - (hours*3600) - (minutes*60)
2890+
minutes = (timedelta.seconds - (hours * 3600)) // 60
2891+
seconds = timedelta.seconds - (hours * 3600) - (minutes * 60)
29072892

29082893
hours_str = "%s" % hours
29092894
if hours < 10:

0 commit comments

Comments
 (0)