From d92197d9dcf68e57106cdcbe3a94b14000f01f28 Mon Sep 17 00:00:00 2001 From: Nicholas Muesch Date: Fri, 25 Jan 2019 17:22:59 -0500 Subject: [PATCH] Support Python 3 Base WMI (#3036) --- .../datadog_checks/base/checks/win/wmi/__init__.py | 2 +- .../datadog_checks/base/checks/win/wmi/sampler.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/datadog_checks_base/datadog_checks/base/checks/win/wmi/__init__.py b/datadog_checks_base/datadog_checks/base/checks/win/wmi/__init__.py index 4f9a803508301..e320c268a750e 100644 --- a/datadog_checks_base/datadog_checks/base/checks/win/wmi/__init__.py +++ b/datadog_checks_base/datadog_checks/base/checks/win/wmi/__init__.py @@ -254,7 +254,7 @@ def _get_wmi_sampler(self, instance_key, wmi_class, properties, tag_by="", **kwa """ Create and cache a WMISampler for the given (class, properties) """ - properties = properties + [tag_by] if tag_by else properties + properties = list(properties) + [tag_by] if tag_by else list(properties) if instance_key not in self.wmi_samplers: wmi_sampler = WMISampler(self.log, wmi_class, properties, **kwargs) diff --git a/datadog_checks_base/datadog_checks/base/checks/win/wmi/sampler.py b/datadog_checks_base/datadog_checks/base/checks/win/wmi/sampler.py index 7c3d4cd72bb5d..829c3886f354e 100644 --- a/datadog_checks_base/datadog_checks/base/checks/win/wmi/sampler.py +++ b/datadog_checks_base/datadog_checks/base/checks/win/wmi/sampler.py @@ -27,7 +27,7 @@ import pythoncom import pywintypes -from six import iteritems, string_types +from six import iteritems, string_types, with_metaclass from six.moves import zip from win32com.client import Dispatch @@ -60,12 +60,10 @@ def __contains__(cls, provider): return provider in cls._AVAILABLE_PROVIDER_ARCHITECTURES -class ProviderArchitecture(object): +class ProviderArchitecture(with_metaclass(ProviderArchitectureMeta, object)): """ Enumerate WMI Provider Architectures. """ - __metaclass__ = ProviderArchitectureMeta - # Available Provider Architecture(s) DEFAULT = 0 _32BIT = 32