MCPcopy Index your code
hub / github.com/python/cpython / _wmi_query

Function _wmi_query

Lib/platform.py:335–353  ·  view source on GitHub ↗
(table, *keys)

Source from the content-addressed store, hash-verified

333
334
335def _wmi_query(table, *keys):
336 global _wmi
337 if not _wmi:
338 raise OSError("not supported")
339 table = {
340 "OS": "Win32_OperatingSystem",
341 "CPU": "Win32_Processor",
342 }[table]
343 try:
344 data = _wmi.exec_query("SELECT {} FROM {}".format(
345 ",".join(keys),
346 table,
347 )).split("\0")
348 except OSError:
349 _wmi = None
350 raise OSError("not supported")
351 split_data = (i.partition("=") for i in data)
352 dict_data = {i[0]: i[2] for i in split_data}
353 return (dict_data[k] for k in keys)
354
355
356_WIN32_CLIENT_RELEASES = [

Callers 3

_win32_verFunction · 0.85
_get_machine_win32Function · 0.85
get_win32Method · 0.85

Calls 4

splitMethod · 0.45
formatMethod · 0.45
joinMethod · 0.45
partitionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…