Python3 support
ForsetiJan opened this issue · comments
Juan commented
Hi there!
I really enjoy using your great app but unfortunately Splunk 8.2 doesn't like the python 2 code. Please find the python upgrade readiness app's output below. The page on splunkbase states that 8.2 is supported however; are you planning to move to python3?
{
"apps":[
{
"name":"SplunkAdmins",
"label":"SplunkAdmins",
"version":"2.6.4",
"app_path":"/opt/splunk/etc/apps/SplunkAdmins",
"summary":{
"Passed":2,
"Blocker":0,
"Warning":1,
"Skipped":0,
"type":"Private App",
"app_link":"",
"dismiss_app":0,
"dismiss_app_date":"",
"Status":"WARNING"
},
"checks":[
{
"name":"Python in custom Mako templates",
"result":"PASSED",
"messages":[
],
"required_action":"None"
},
{
"description":"Check for the existence of Python scripts, which must be upgraded to be cross-compatible with Python 2 and 3 for the upcoming Splunk Enterprise Python 3 release. ",
"name":"Python scripts",
"result":"WARNING",
"messages":[
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lookup_watcher.py",
"code":[
"@@ -8,6 +8,7 @@\n from subprocess import Popen, PIPE\n from time import sleep\n from lookup_watcher_class import LookupWatcher \n+from six.moves import range\n \n sys.path.insert(0, os.path.join(os.path.dirname(__file__), \"lib\"))\n "
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -8,6 +8,7 @@\n from subprocess import Popen, PIPE\n from time import sleep\n from lookup_watcher_class import LookupWatcher \n+from six.moves import range\n \n sys.path.insert(0, os.path.join(os.path.dirname(__file__), \"lib\"))\n \nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lookup_watcher.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/binding.py",
"code":[
"@@ -92,7 +92,7 @@\n :type dictionary: ``dict``\n \"\"\"\n parsed_cookie = six.moves.http_cookies.SimpleCookie(cookie_str)\n- for cookie in parsed_cookie.values():\n+ for cookie in list(parsed_cookie.values()):\n dictionary[cookie.key] = cookie.coded_value\n \n "
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -92,7 +92,7 @@\n :type dictionary: ``dict``\n \"\"\"\n parsed_cookie = six.moves.http_cookies.SimpleCookie(cookie_str)\n- for cookie in parsed_cookie.values():\n+ for cookie in list(parsed_cookie.values()):\n dictionary[cookie.key] = cookie.coded_value\n \n \nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/binding.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/ordereddict.py",
"code":[
"@@ -21,6 +21,7 @@\n # OTHER DEALINGS IN THE SOFTWARE.\n \n from UserDict import DictMixin\n+from six.moves import zip\n \n \n class OrderedDict(dict, DictMixin):",
"@@ -71,9 +72,9 @@\n if not self:\n raise KeyError('dictionary is empty')\n if last:\n- key = reversed(self).next()\n+ key = next(reversed(self))\n else:\n- key = iter(self).next()\n+ key = next(iter(self))\n value = self.pop(key)\n return key, value\n ",
"@@ -102,7 +103,7 @@\n def __repr__(self):\n if not self:\n return '%s()' % (self.__class__.__name__,)\n- return '%s(%r)' % (self.__class__.__name__, self.items())\n+ return '%s(%r)' % (self.__class__.__name__, list(self.items()))\n \n def copy(self):\n return self.__class__(self)",
"@@ -118,7 +119,7 @@\n if isinstance(other, OrderedDict):\n if len(self) != len(other):\n return False\n- for p, q in zip(self.items(), other.items()):\n+ for p, q in zip(list(self.items()), list(other.items())):\n if p != q:\n return False\n return True"
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -21,6 +21,7 @@\n # OTHER DEALINGS IN THE SOFTWARE.\n \n from UserDict import DictMixin\n+from six.moves import zip\n \n \n class OrderedDict(dict, DictMixin):\n@@ -71,9 +72,9 @@\n if not self:\n raise KeyError('dictionary is empty')\n if last:\n- key = reversed(self).next()\n+ key = next(reversed(self))\n else:\n- key = iter(self).next()\n+ key = next(iter(self))\n value = self.pop(key)\n return key, value\n \n@@ -102,7 +103,7 @@\n def __repr__(self):\n if not self:\n return '%s()' % (self.__class__.__name__,)\n- return '%s(%r)' % (self.__class__.__name__, self.items())\n+ return '%s(%r)' % (self.__class__.__name__, list(self.items()))\n \n def copy(self):\n return self.__class__(self)\n@@ -118,7 +119,7 @@\n if isinstance(other, OrderedDict):\n if len(self) != len(other):\n return False\n- for p, q in zip(self.items(), other.items()):\n+ for p, q in zip(list(self.items()), list(other.items())):\n if p != q:\n return False\n return True\nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/ordereddict.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/client.py",
"code":[
"Error while checking the script:\nCan't parse /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/client.py: ParseError: bad input: type=1, value='if', context=(' ', (3678, 53))"
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"Error while checking the script:\nCan't parse /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/client.py: ParseError: bad input: type=1, value='if', context=(' ', (3678, 53))\nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/client.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/six.py",
"code":[
"@@ -27,6 +27,7 @@\n import operator\n import sys\n import types\n+import six\n \n __author__ = \"Benjamin Peterson <benjamin@python.org>\"\n __version__ = \"1.14.0\"",
"@@ -46,10 +47,10 @@\n \n MAXSIZE = sys.maxsize\n else:\n- string_types = basestring,\n- integer_types = (int, long)\n- class_types = (type, types.ClassType)\n- text_type = unicode\n+ string_types = six.string_types,\n+ integer_types = six.integer_types\n+ class_types = (type, type)\n+ text_type = six.text_type\n binary_type = str\n \n if sys.platform.startswith(\"java\"):",
"@@ -529,7 +530,7 @@\n advance_iterator = next\n except NameError:\n def advance_iterator(it):\n- return it.next()\n+ return next(it)\n next = advance_iterator\n \n ",
"@@ -552,7 +553,7 @@\n Iterator = object\n else:\n def get_unbound_function(unbound):\n- return unbound.im_func\n+ return unbound.__func__\n \n def create_bound_method(func, obj):\n return types.MethodType(func, obj, obj.__class__)",
"@@ -655,7 +656,7 @@\n # Workaround for standalone backslash\n \n def u(s):\n- return unicode(s.replace(r'\\\\', r'\\\\\\\\'), \"unicode_escape\")\n+ return six.text_type(s.replace(r'\\\\', r'\\\\\\\\'), \"unicode_escape\")\n unichr = unichr\n int2byte = chr\n ",
"@@ -747,11 +748,11 @@\n return\n \n def write(data):\n- if not isinstance(data, basestring):\n+ if not isinstance(data, six.string_types):\n data = str(data)\n # If the file has an encoding, encode unicode with it.\n if (isinstance(fp, file) and\n- isinstance(data, unicode) and\n+ isinstance(data, six.text_type) and\n fp.encoding is not None):\n errors = getattr(fp, \"errors\", None)\n if errors is None:",
"@@ -761,13 +762,13 @@\n want_unicode = False\n sep = kwargs.pop(\"sep\", None)\n if sep is not None:\n- if isinstance(sep, unicode):\n+ if isinstance(sep, six.text_type):\n want_unicode = True\n elif not isinstance(sep, str):\n raise TypeError(\"sep must be None or a string\")\n end = kwargs.pop(\"end\", None)\n if end is not None:\n- if isinstance(end, unicode):\n+ if isinstance(end, six.text_type):\n want_unicode = True\n elif not isinstance(end, str):\n raise TypeError(\"end must be None or a string\")",
"@@ -775,12 +776,12 @@\n raise TypeError(\"invalid keyword arguments to print()\")\n if not want_unicode:\n for arg in args:\n- if isinstance(arg, unicode):\n+ if isinstance(arg, six.text_type):\n want_unicode = True\n break\n if want_unicode:\n- newline = unicode(\"\\n\")\n- space = unicode(\" \")\n+ newline = six.text_type(\"\\n\")\n+ space = six.text_type(\" \")\n else:\n newline = \"\\n\"\n space = \" \"",
"@@ Warnings/messages while checking the script: @@\n### In file /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/six.py ###\nLine 533: Calls to builtin next() possibly shadowed by global binding"
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -27,6 +27,7 @@\n import operator\n import sys\n import types\n+import six\n \n __author__ = \"Benjamin Peterson <benjamin@python.org>\"\n __version__ = \"1.14.0\"\n@@ -46,10 +47,10 @@\n \n MAXSIZE = sys.maxsize\n else:\n- string_types = basestring,\n- integer_types = (int, long)\n- class_types = (type, types.ClassType)\n- text_type = unicode\n+ string_types = six.string_types,\n+ integer_types = six.integer_types\n+ class_types = (type, type)\n+ text_type = six.text_type\n binary_type = str\n \n if sys.platform.startswith(\"java\"):\n@@ -529,7 +530,7 @@\n advance_iterator = next\n except NameError:\n def advance_iterator(it):\n- return it.next()\n+ return next(it)\n next = advance_iterator\n \n \n@@ -552,7 +553,7 @@\n Iterator = object\n else:\n def get_unbound_function(unbound):\n- return unbound.im_func\n+ return unbound.__func__\n \n def create_bound_method(func, obj):\n return types.MethodType(func, obj, obj.__class__)\n@@ -655,7 +656,7 @@\n # Workaround for standalone backslash\n \n def u(s):\n- return unicode(s.replace(r'\\\\', r'\\\\\\\\'), \"unicode_escape\")\n+ return six.text_type(s.replace(r'\\\\', r'\\\\\\\\'), \"unicode_escape\")\n unichr = unichr\n int2byte = chr\n \n@@ -747,11 +748,11 @@\n return\n \n def write(data):\n- if not isinstance(data, basestring):\n+ if not isinstance(data, six.string_types):\n data = str(data)\n # If the file has an encoding, encode unicode with it.\n if (isinstance(fp, file) and\n- isinstance(data, unicode) and\n+ isinstance(data, six.text_type) and\n fp.encoding is not None):\n errors = getattr(fp, \"errors\", None)\n if errors is None:\n@@ -761,13 +762,13 @@\n want_unicode = False\n sep = kwargs.pop(\"sep\", None)\n if sep is not None:\n- if isinstance(sep, unicode):\n+ if isinstance(sep, six.text_type):\n want_unicode = True\n elif not isinstance(sep, str):\n raise TypeError(\"sep must be None or a string\")\n end = kwargs.pop(\"end\", None)\n if end is not None:\n- if isinstance(end, unicode):\n+ if isinstance(end, six.text_type):\n want_unicode = True\n elif not isinstance(end, str):\n raise TypeError(\"end must be None or a string\")\n@@ -775,12 +776,12 @@\n raise TypeError(\"invalid keyword arguments to print()\")\n if not want_unicode:\n for arg in args:\n- if isinstance(arg, unicode):\n+ if isinstance(arg, six.text_type):\n want_unicode = True\n break\n if want_unicode:\n- newline = unicode(\"\\n\")\n- space = unicode(\" \")\n+ newline = six.text_type(\"\\n\")\n+ space = six.text_type(\" \")\n else:\n newline = \"\\n\"\n space = \" \"\n@@ Warnings/messages while checking the script: @@\n### In file /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/six.py ###\nLine 533: Calls to builtin next() possibly shadowed by global binding\nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/six.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/data.py",
"code":[
"@@ -79,7 +79,7 @@\n }\n \n # Convert to unicode encoding in only python 2 for xml parser\n- if(sys.version_info < (3, 0, 0) and isinstance(text, unicode)):\n+ if(sys.version_info < (3, 0, 0) and isinstance(text, six.text_type)):\n text = text.encode('utf-8')\n \n root = XML(text)"
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -79,7 +79,7 @@\n }\n \n # Convert to unicode encoding in only python 2 for xml parser\n- if(sys.version_info < (3, 0, 0) and isinstance(text, unicode)):\n+ if(sys.version_info < (3, 0, 0) and isinstance(text, six.text_type)):\n text = text.encode('utf-8')\n \n root = XML(text)\nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/data.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/modularinput/utils.py",
"code":[
"@@ -16,6 +16,7 @@\n \n from __future__ import absolute_import\n from splunklib.six.moves import zip\n+from six.moves import zip\n def xml_compare(expected, found):\n \"\"\"Checks equality of two ``ElementTree`` objects.\n "
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -16,6 +16,7 @@\n \n from __future__ import absolute_import\n from splunklib.six.moves import zip\n+from six.moves import zip\n def xml_compare(expected, found):\n \"\"\"Checks equality of two ``ElementTree`` objects.\n \nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/modularinput/utils.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/decorators.py",
"code":[
"@@ -197,7 +197,7 @@\n \n if len(values) > 0:\n settings = sorted(list(six.iteritems(values)))\n- settings = imap(lambda n_v: '{}={}'.format(n_v[0], repr(n_v[1])), settings)\n+ settings = map(lambda n_v: '{}={}'.format(n_v[0], repr(n_v[1])), settings)\n raise AttributeError('Inapplicable configuration settings: ' + ', '.join(settings))\n \n cls.configuration_setting_definitions = definitions",
"@@ -423,7 +423,7 @@\n OrderedDict.__init__(self, ((option.name, item_class(command, option)) for (name, option) in definitions))\n \n def __repr__(self):\n- text = 'Option.View([' + ','.join(imap(lambda item: repr(item), six.itervalues(self))) + '])'\n+ text = 'Option.View([' + ','.join(map(lambda item: repr(item), six.itervalues(self))) + '])'\n return text\n \n def __str__(self):"
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -197,7 +197,7 @@\n \n if len(values) > 0:\n settings = sorted(list(six.iteritems(values)))\n- settings = imap(lambda n_v: '{}={}'.format(n_v[0], repr(n_v[1])), settings)\n+ settings = map(lambda n_v: '{}={}'.format(n_v[0], repr(n_v[1])), settings)\n raise AttributeError('Inapplicable configuration settings: ' + ', '.join(settings))\n \n cls.configuration_setting_definitions = definitions\n@@ -423,7 +423,7 @@\n OrderedDict.__init__(self, ((option.name, item_class(command, option)) for (name, option) in definitions))\n \n def __repr__(self):\n- text = 'Option.View([' + ','.join(imap(lambda item: repr(item), six.itervalues(self))) + '])'\n+ text = 'Option.View([' + ','.join(map(lambda item: repr(item), six.itervalues(self))) + '])'\n return text\n \n def __str__(self):\nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/decorators.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/eventing_command.py",
"code":[
"@@ -140,7 +140,7 @@\n # N.B.: Does not use Python 2 dict copy semantics\n def iteritems(self):\n iteritems = SearchCommand.ConfigurationSettings.iteritems(self)\n- return imap(lambda name_value: (name_value[0], 'events' if name_value[0] == 'type' else name_value[1]), iteritems)\n+ return map(lambda name_value: (name_value[0], 'events' if name_value[0] == 'type' else name_value[1]), iteritems)\n \n # N.B.: Does not use Python 3 dict view semantics\n if not six.PY2:"
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -140,7 +140,7 @@\n # N.B.: Does not use Python 2 dict copy semantics\n def iteritems(self):\n iteritems = SearchCommand.ConfigurationSettings.iteritems(self)\n- return imap(lambda name_value: (name_value[0], 'events' if name_value[0] == 'type' else name_value[1]), iteritems)\n+ return map(lambda name_value: (name_value[0], 'events' if name_value[0] == 'type' else name_value[1]), iteritems)\n \n # N.B.: Does not use Python 3 dict view semantics\n if not six.PY2:\nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/eventing_command.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/streaming_command.py",
"code":[
"@@ -180,11 +180,11 @@\n version = self.command.protocol_version\n if version == 1:\n if self.required_fields is None:\n- iteritems = ifilter(lambda name_value: name_value[0] != 'clear_required_fields', iteritems)\n+ iteritems = filter(lambda name_value: name_value[0] != 'clear_required_fields', iteritems)\n else:\n- iteritems = ifilter(lambda name_value2: name_value2[0] != 'distributed', iteritems)\n+ iteritems = filter(lambda name_value2: name_value2[0] != 'distributed', iteritems)\n if not self.distributed:\n- iteritems = imap(\n+ iteritems = map(\n lambda name_value1: (name_value1[0], 'stateful') if name_value1[0] == 'type' else (name_value1[0], name_value1[1]), iteritems)\n return iteritems\n "
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -180,11 +180,11 @@\n version = self.command.protocol_version\n if version == 1:\n if self.required_fields is None:\n- iteritems = ifilter(lambda name_value: name_value[0] != 'clear_required_fields', iteritems)\n+ iteritems = filter(lambda name_value: name_value[0] != 'clear_required_fields', iteritems)\n else:\n- iteritems = ifilter(lambda name_value2: name_value2[0] != 'distributed', iteritems)\n+ iteritems = filter(lambda name_value2: name_value2[0] != 'distributed', iteritems)\n if not self.distributed:\n- iteritems = imap(\n+ iteritems = map(\n lambda name_value1: (name_value1[0], 'stateful') if name_value1[0] == 'type' else (name_value1[0], name_value1[1]), iteritems)\n return iteritems\n \nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/streaming_command.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/search_command.py",
"code":[
"@@ -21,6 +21,7 @@\n from collections import namedtuple\n \n import io\n+from io import open\n \n try:\n from collections import OrderedDict # must be python 2.7",
"@@ -300,7 +301,7 @@\n except ValueError:\n return value\n \n- info = ObjectView(dict(imap(lambda f_v: (convert_field(f_v[0]), convert_value(f_v[1])), izip(fields, values))))\n+ info = ObjectView(dict(map(lambda f_v: (convert_field(f_v[0]), convert_value(f_v[1])), zip(fields, values))))\n \n try:\n count_map = info.countMap",
"@@ -309,7 +310,7 @@\n else:\n count_map = count_map.split(';')\n n = len(count_map)\n- info.countMap = dict(izip(islice(count_map, 0, n, 2), islice(count_map, 1, n, 2)))\n+ info.countMap = dict(zip(islice(count_map, 0, n, 2), islice(count_map, 1, n, 2)))\n \n try:\n msg_type = info.msgType",
"@@ -317,7 +318,7 @@\n except AttributeError:\n pass\n else:\n- messages = ifilter(lambda t_m: t_m[0] or t_m[1], izip(msg_type.split('\\n'), msg_text.split('\\n')))\n+ messages = filter(lambda t_m: t_m[0] or t_m[1], zip(msg_type.split('\\n'), msg_text.split('\\n')))\n info.msg = [Message(message) for message in messages]\n del info.msgType\n ",
"@@ -928,12 +929,12 @@\n \n if len(mv_fieldnames) == 0:\n for values in reader:\n- yield OrderedDict(izip(fieldnames, values))\n+ yield OrderedDict(zip(fieldnames, values))\n return\n \n for values in reader:\n record = OrderedDict()\n- for fieldname, value in izip(fieldnames, values):\n+ for fieldname, value in zip(fieldnames, values):\n if fieldname.startswith('__mv_'):\n if len(value) > 0:\n record[mv_fieldnames[fieldname]] = self._decode_list(value)",
"@@ -1008,7 +1009,7 @@\n \n \"\"\"\n definitions = type(self).configuration_setting_definitions\n- settings = imap(\n+ settings = map(\n lambda setting: repr((setting.name, setting.__get__(self), setting.supporting_protocols)), definitions)\n return '[' + ', '.join(settings) + ']'\n ",
"@@ -1046,9 +1047,9 @@\n def iteritems(self):\n definitions = type(self).configuration_setting_definitions\n version = self.command.protocol_version\n- return ifilter(\n- lambda name_value1: name_value1[1] is not None, imap(\n- lambda setting: (setting.name, setting.__get__(self)), ifilter(\n+ return filter(\n+ lambda name_value1: name_value1[1] is not None, map(\n+ lambda setting: (setting.name, setting.__get__(self)), filter(\n lambda setting: setting.is_supported_by_protocol(version), definitions)))\n \n # N.B.: Does not use Python 3 dict view semantics"
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -21,6 +21,7 @@\n from collections import namedtuple\n \n import io\n+from io import open\n \n try:\n from collections import OrderedDict # must be python 2.7\n@@ -300,7 +301,7 @@\n except ValueError:\n return value\n \n- info = ObjectView(dict(imap(lambda f_v: (convert_field(f_v[0]), convert_value(f_v[1])), izip(fields, values))))\n+ info = ObjectView(dict(map(lambda f_v: (convert_field(f_v[0]), convert_value(f_v[1])), zip(fields, values))))\n \n try:\n count_map = info.countMap\n@@ -309,7 +310,7 @@\n else:\n count_map = count_map.split(';')\n n = len(count_map)\n- info.countMap = dict(izip(islice(count_map, 0, n, 2), islice(count_map, 1, n, 2)))\n+ info.countMap = dict(zip(islice(count_map, 0, n, 2), islice(count_map, 1, n, 2)))\n \n try:\n msg_type = info.msgType\n@@ -317,7 +318,7 @@\n except AttributeError:\n pass\n else:\n- messages = ifilter(lambda t_m: t_m[0] or t_m[1], izip(msg_type.split('\\n'), msg_text.split('\\n')))\n+ messages = filter(lambda t_m: t_m[0] or t_m[1], zip(msg_type.split('\\n'), msg_text.split('\\n')))\n info.msg = [Message(message) for message in messages]\n del info.msgType\n \n@@ -928,12 +929,12 @@\n \n if len(mv_fieldnames) == 0:\n for values in reader:\n- yield OrderedDict(izip(fieldnames, values))\n+ yield OrderedDict(zip(fieldnames, values))\n return\n \n for values in reader:\n record = OrderedDict()\n- for fieldname, value in izip(fieldnames, values):\n+ for fieldname, value in zip(fieldnames, values):\n if fieldname.startswith('__mv_'):\n if len(value) > 0:\n record[mv_fieldnames[fieldname]] = self._decode_list(value)\n@@ -1008,7 +1009,7 @@\n \n \"\"\"\n definitions = type(self).configuration_setting_definitions\n- settings = imap(\n+ settings = map(\n lambda setting: repr((setting.name, setting.__get__(self), setting.supporting_protocols)), definitions)\n return '[' + ', '.join(settings) + ']'\n \n@@ -1046,9 +1047,9 @@\n def iteritems(self):\n definitions = type(self).configuration_setting_definitions\n version = self.command.protocol_version\n- return ifilter(\n- lambda name_value1: name_value1[1] is not None, imap(\n- lambda setting: (setting.name, setting.__get__(self)), ifilter(\n+ return filter(\n+ lambda name_value1: name_value1[1] is not None, map(\n+ lambda setting: (setting.name, setting.__get__(self)), filter(\n lambda setting: setting.is_supported_by_protocol(version), definitions)))\n \n # N.B.: Does not use Python 3 dict view semantics\nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/search_command.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/generating_command.py",
"code":[
"@@ -333,9 +333,9 @@\n iteritems = SearchCommand.ConfigurationSettings.iteritems(self)\n version = self.command.protocol_version\n if version == 2:\n- iteritems = ifilter(lambda name_value1: name_value1[0] != 'distributed', iteritems)\n+ iteritems = filter(lambda name_value1: name_value1[0] != 'distributed', iteritems)\n if not self.distributed and self.type == 'streaming':\n- iteritems = imap(\n+ iteritems = map(\n lambda name_value: (name_value[0], 'stateful') if name_value[0] == 'type' else (name_value[0], name_value[1]), iteritems)\n return iteritems\n "
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -333,9 +333,9 @@\n iteritems = SearchCommand.ConfigurationSettings.iteritems(self)\n version = self.command.protocol_version\n if version == 2:\n- iteritems = ifilter(lambda name_value1: name_value1[0] != 'distributed', iteritems)\n+ iteritems = filter(lambda name_value1: name_value1[0] != 'distributed', iteritems)\n if not self.distributed and self.type == 'streaming':\n- iteritems = imap(\n+ iteritems = map(\n lambda name_value: (name_value[0], 'stateful') if name_value[0] == 'type' else (name_value[0], name_value[1]), iteritems)\n return iteritems\n \nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/generating_command.py"
},
{
"message_filename":"/opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/internals.py",
"code":[
"@@ -280,7 +280,7 @@\n if isinstance(specification.type, type):\n type_names = specification.type.__name__\n else:\n- type_names = ', '.join(imap(lambda t: t.__name__, specification.type))\n+ type_names = ', '.join(map(lambda t: t.__name__, specification.type))\n raise ValueError('Expected {} value, not {}={}'.format(type_names, name, repr(value)))\n if specification.constraint and not specification.constraint(value):\n raise ValueError('Illegal value: {}={}'.format(name, repr(value)))",
"@@ -593,7 +593,7 @@\n \n if fieldnames is None:\n self._fieldnames = fieldnames = list(record.keys())\n- value_list = imap(lambda fn: (str(fn), str('__mv_') + str(fn)), fieldnames)\n+ value_list = map(lambda fn: (str(fn), str('__mv_') + str(fn)), fieldnames)\n self._writerow(list(chain.from_iterable(value_list)))\n \n get_value = record.get"
],
"result":"warning",
"message_line":null,
"dismissed":0,
"message":"@@ -280,7 +280,7 @@\n if isinstance(specification.type, type):\n type_names = specification.type.__name__\n else:\n- type_names = ', '.join(imap(lambda t: t.__name__, specification.type))\n+ type_names = ', '.join(map(lambda t: t.__name__, specification.type))\n raise ValueError('Expected {} value, not {}={}'.format(type_names, name, repr(value)))\n if specification.constraint and not specification.constraint(value):\n raise ValueError('Illegal value: {}={}'.format(name, repr(value)))\n@@ -593,7 +593,7 @@\n \n if fieldnames is None:\n self._fieldnames = fieldnames = list(record.keys())\n- value_list = imap(lambda fn: (str(fn), str('__mv_') + str(fn)), fieldnames)\n+ value_list = map(lambda fn: (str(fn), str('__mv_') + str(fn)), fieldnames)\n self._writerow(list(chain.from_iterable(value_list)))\n \n get_value = record.get\nFile: /opt/splunk/etc/apps/SplunkAdmins/bin/lib/splunklib/searchcommands/internals.py"
}
],
"required_action":"Update these Python scripts to be dual-compatible with Python 2 and 3."
},
{
"description":"Splunk Python SDK Check",
"name":"Splunk Python SDK Check",
"result":"PASSED",
"messages":[
],
"required_action":"None"
}
],
"details":"This app is not compatible with Python 3.",
"required_action":"Update this app or uninstall it. If you do nothing, the app will fail."
}
],
"scan_id":"user_1626349240"
}
gjanders commented
Juan commented
:) I stand corrected.