(self)
return results
Query WMI using WMI Query Language (WQL) & parse the results.

        Returns: List of WMI objects or `TimeoutException`.
Query WMI using WMI Query Language (WQL) & parse the results.
Query WMI using WMI Query Language ( WQL ) & parse the results .
def _query(self):  # pylint: disable=E0202
        """
        Query WMI using WMI Query Language (WQL) & parse the results.

        Returns: List of WMI objects or `TimeoutException`.
        """
        try:
            formated_property_names = ",".join(self.property_names)
            wql = "Select {property_names} from {class_name}{filters}".format(
                property_names=formated_property_names, class_name=self.class_name, filters=self.formatted_filters
            )
            self.logger.debug(u"Querying WMI: %s", wql)
        except Exception as e:
            self.logger.error(str(e))
            return []

        try:
            # From: https://msdn.microsoft.com/en-us/library/aa393866(v=vs.85).aspx
            flag_return_immediately = 0x10  # Default flag.
            flag_forward_only = 0x20
            flag_use_amended_qualifiers = 0x20000

            query_flags = flag_return_immediately | flag_forward_only

            # For the first query, cache the qualifiers to determine each
            # propertie's "CounterType"
            includes_qualifiers = self.is_raw_perf_class and self._property_counter_types is None
            if includes_qualifiers:
                self._property_counter_types = CaseInsensitiveDict()
                query_flags |= flag_use_amended_qualifiers

            raw_results = self.get_connection().ExecQuery(wql, "WQL", query_flags)

            results = self._parse_results(raw_results, includes_qualifiers=includes_qualifiers)

        except pywintypes.com_error:
            self.logger.warning(u"Failed to execute WMI query (%s)", wql, exc_info=True)
            results = []

        return results
def _query ( self ) : # pylint: disable=E0202 try : formated_property_names = "," . join ( self . property_names ) wql = "Select {property_names} from {class_name}{filters}" . format ( property_names = formated_property_names , class_name = self . class_name , filters = self . formatted_filters ) self . logger . debug ( u"Querying WMI: %s" , wql ) except Exception as e : self . logger . error ( str ( e ) ) return [ ] try : # From: https://msdn.microsoft.com/en-us/library/aa393866(v=vs.85).aspx flag_return_immediately = 0x10 # Default flag. flag_forward_only = 0x20 flag_use_amended_qualifiers = 0x20000 query_flags = flag_return_immediately | flag_forward_only # For the first query, cache the qualifiers to determine each # propertie's "CounterType" includes_qualifiers = self . is_raw_perf_class and self . _property_counter_types is None if includes_qualifiers : self . _property_counter_types = CaseInsensitiveDict ( ) query_flags |= flag_use_amended_qualifiers raw_results = self . get_connection ( ) . ExecQuery ( wql , "WQL" , query_flags ) results = self . _parse_results ( raw_results , includes_qualifiers = includes_qualifiers ) except pywintypes . com_error : self . logger . warning ( u"Failed to execute WMI query (%s)" , wql , exc_info = True ) results = [ ] return results