Exec method named on ``object`` with ``inparam``. :params obj: The :class:`WmiObject` or path of the object the call apply to :params method: The name of the method to call on the object :params inparam: The :class:`WmiObject` representing the input parameters and r
(self, obj, method, inparam, flags=0)
| 396 | return self.DeleteInstance(instance, flags, None, None) |
| 397 | |
| 398 | def exec_method(self, obj, method, inparam, flags=0): |
| 399 | """Exec method named on ``object`` with ``inparam``. |
| 400 | |
| 401 | :params obj: The :class:`WmiObject` or path of the object the call apply to |
| 402 | :params method: The name of the method to call on the object |
| 403 | :params inparam: The :class:`WmiObject` representing the input parameters and retrieve using :func:`WmiObject.get_method` |
| 404 | |
| 405 | :returns: :class:`WmiCallResult` ``(object)`` if flag `WBEM_FLAG_RETURN_IMMEDIATELY` was passed |
| 406 | :returns: :class:`WmiObject` the outparam object if flag `WBEM_FLAG_RETURN_IMMEDIATELY` was NOT passed |
| 407 | |
| 408 | .. note:: |
| 409 | |
| 410 | This API will lakely change to better wrap with WmiObject/inparam/Dict & co |
| 411 | """ |
| 412 | if flags & gdef.WBEM_FLAG_RETURN_IMMEDIATELY: |
| 413 | # semisynchronous call -> WmiCallResult |
| 414 | result = WmiCallResult(result_type="object") |
| 415 | outparam = None |
| 416 | else: |
| 417 | # Synchronous call -> WmiObject (outparam) |
| 418 | result = None |
| 419 | outparam = WmiObject() |
| 420 | if isinstance(obj, gdef.IWbemClassObject): |
| 421 | obj = obj.get("__Path") |
| 422 | # Flags 0 -> synchronous call |
| 423 | # No WmiCallResult result is directly in outparam |
| 424 | self.ExecMethod(obj, method, 0, None, inparam, outparam, result) |
| 425 | return outparam or result |
| 426 | |
| 427 | def __repr__(self): |
| 428 | null = "" if self else " (NULL)" |
nothing calls this directly
no test coverage detected