(self, sampler, wmi_obj, tag_query)
return target_class, target_property, [{link_target_class_property: link_source_property}]
Format `tag_query` or raise on incorrect parameters.
Format `tag_query` or raise on incorrect parameters.
Format tag_query or raise on incorrect parameters .
def _format_tag_query(self, sampler, wmi_obj, tag_query):
        # type: (WMISampler, WMIObject, TagQuery) -> Tuple[str, str, List[Dict]]
        """
        Format `tag_query` or raise on incorrect parameters.
        """
        try:
            link_source_property = int(wmi_obj[tag_query[0]])
            target_class = tag_query[1]
            link_target_class_property = tag_query[2]
            target_property = tag_query[3]
        except IndexError:
            self.log.error(
                u"Wrong `tag_queries` parameter format. " "Please refer to the configuration file for more information."
            )
            raise
        except TypeError:
            wmi_property = tag_query[0]
            wmi_class = sampler.class_name
            self.log.error(
                u"Incorrect 'link source property' in `tag_queries` parameter: `%s` is not a property of `%s`",
                wmi_property,
                wmi_class,
            )
            raise

        return target_class, target_property, [{link_target_class_property: link_source_property}]
def _format_tag_query ( self , sampler , wmi_obj , tag_query ) : # type: (WMISampler, WMIObject, TagQuery) -> Tuple[str, str, List[Dict]] try : link_source_property = int ( wmi_obj [ tag_query [ 0 ] ] ) target_class = tag_query [ 1 ] link_target_class_property = tag_query [ 2 ] target_property = tag_query [ 3 ] except IndexError : self . log . error ( u"Wrong `tag_queries` parameter format. " "Please refer to the configuration file for more information." ) raise except TypeError : wmi_property = tag_query [ 0 ] wmi_class = sampler . class_name self . log . error ( u"Incorrect 'link source property' in `tag_queries` parameter: `%s` is not a property of `%s`" , wmi_property , wmi_class , ) raise return target_class , target_property , [ { link_target_class_property : link_source_property } ]