winrt-Windows.Devices.Enumeration.Pnp 2.0.1__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/PKG-INFO +6 -6
  2. winrt_windows_devices_enumeration_pnp-2.2.0/all-requirements.txt +5 -0
  3. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/py.Windows.Devices.Enumeration.Pnp.cpp +433 -243
  4. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/pyproject.toml +3 -2
  5. winrt_windows_devices_enumeration_pnp-2.2.0/pywinrt-version.txt +1 -0
  6. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/requirements.txt +2 -2
  7. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/winrt/_winrt_windows_devices_enumeration_pnp.pyi +22 -22
  8. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/winrt/windows/devices/enumeration/pnp/__init__.py +1 -1
  9. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/winrt_Windows.Devices.Enumeration.Pnp.egg-info/PKG-INFO +6 -6
  10. winrt_windows_devices_enumeration_pnp-2.2.0/winrt_Windows.Devices.Enumeration.Pnp.egg-info/requires.txt +6 -0
  11. winrt_windows_devices_enumeration_pnp-2.0.1/all-requirements.txt +0 -5
  12. winrt_windows_devices_enumeration_pnp-2.0.1/pywinrt-version.txt +0 -1
  13. winrt_windows_devices_enumeration_pnp-2.0.1/winrt_Windows.Devices.Enumeration.Pnp.egg-info/requires.txt +0 -6
  14. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/README.md +0 -0
  15. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/setup.cfg +0 -0
  16. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/setup.py +0 -0
  17. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/winrt/windows/devices/enumeration/pnp/py.typed +0 -0
  18. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/winrt_Windows.Devices.Enumeration.Pnp.egg-info/SOURCES.txt +0 -0
  19. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/winrt_Windows.Devices.Enumeration.Pnp.egg-info/dependency_links.txt +0 -0
  20. {winrt_windows_devices_enumeration_pnp-2.0.1 → winrt_windows_devices_enumeration_pnp-2.2.0}/winrt_Windows.Devices.Enumeration.Pnp.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: winrt-Windows.Devices.Enumeration.Pnp
3
- Version: 2.0.1
3
+ Version: 2.2.0
4
4
  Summary: Python projection of Windows Runtime (WinRT) APIs
5
5
  License: MIT
6
6
  Project-URL: Documentation, https://pywinrt.readthedocs.io
@@ -10,13 +10,13 @@ Classifier: Operating System :: Microsoft :: Windows
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: Implementation :: CPython
12
12
  Classifier: Intended Audience :: Developers
13
- Requires-Python: <3.13,>=3.9
13
+ Requires-Python: <3.14,>=3.9
14
14
  Description-Content-Type: text/markdown
15
- Requires-Dist: winrt-runtime==2.0.1
15
+ Requires-Dist: winrt-runtime==2.2.0
16
16
  Provides-Extra: all
17
- Requires-Dist: winrt-Windows.Devices.Enumeration[all]==2.0.1; extra == "all"
18
- Requires-Dist: winrt-Windows.Foundation[all]==2.0.1; extra == "all"
19
- Requires-Dist: winrt-Windows.Foundation.Collections[all]==2.0.1; extra == "all"
17
+ Requires-Dist: winrt-Windows.Devices.Enumeration[all]==2.2.0; extra == "all"
18
+ Requires-Dist: winrt-Windows.Foundation[all]==2.2.0; extra == "all"
19
+ Requires-Dist: winrt-Windows.Foundation.Collections[all]==2.2.0; extra == "all"
20
20
 
21
21
  <!-- warning: Please don't edit this file. It was automatically generated. -->
22
22
 
@@ -0,0 +1,5 @@
1
+ # WARNING: Please don't edit this file. It was generated by Python/WinRT v2.2.0
2
+
3
+ winrt-Windows.Devices.Enumeration[all]==2.2.0
4
+ winrt-Windows.Foundation[all]==2.2.0
5
+ winrt-Windows.Foundation.Collections[all]==2.2.0
@@ -1,8 +1,7 @@
1
- // WARNING: Please don't edit this file. It was generated by Python/WinRT v2.0.1
1
+ // WARNING: Please don't edit this file. It was generated by Python/WinRT v2.2.0
2
2
 
3
3
  #include "py.Windows.Devices.Enumeration.Pnp.h"
4
4
 
5
-
6
5
  namespace py::cpp::Windows::Devices::Enumeration::Pnp
7
6
  {
8
7
  // ----- PnpObject class --------------------
@@ -28,14 +27,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
28
27
 
29
28
  if (arg_count == 3)
30
29
  {
31
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"CreateFromIdAsync", 3))
32
- {
33
- py::set_arg_count_version_error(3);
34
- return nullptr;
35
- }
36
-
37
30
  try
38
31
  {
32
+ static std::optional<bool> is_overload_present{};
33
+
34
+ if (!is_overload_present.has_value())
35
+ {
36
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"CreateFromIdAsync", 3);
37
+ }
38
+
39
+ if (!is_overload_present.value())
40
+ {
41
+ py::set_arg_count_version_error(3);
42
+ return nullptr;
43
+ }
44
+
39
45
  auto param0 = py::convert_to<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectType>(args, 0);
40
46
  auto param1 = py::convert_to<winrt::hstring>(args, 1);
41
47
  auto param2 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 2);
@@ -61,14 +67,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
61
67
 
62
68
  if (arg_count == 2)
63
69
  {
64
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"CreateWatcher", 2))
65
- {
66
- py::set_arg_count_version_error(2);
67
- return nullptr;
68
- }
69
-
70
70
  try
71
71
  {
72
+ static std::optional<bool> is_overload_present{};
73
+
74
+ if (!is_overload_present.has_value())
75
+ {
76
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"CreateWatcher", 2);
77
+ }
78
+
79
+ if (!is_overload_present.value())
80
+ {
81
+ py::set_arg_count_version_error(2);
82
+ return nullptr;
83
+ }
84
+
72
85
  auto param0 = py::convert_to<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectType>(args, 0);
73
86
  auto param1 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 1);
74
87
 
@@ -82,14 +95,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
82
95
  }
83
96
  else if (arg_count == 3)
84
97
  {
85
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"CreateWatcher", 3))
86
- {
87
- py::set_arg_count_version_error(3);
88
- return nullptr;
89
- }
90
-
91
98
  try
92
99
  {
100
+ static std::optional<bool> is_overload_present{};
101
+
102
+ if (!is_overload_present.has_value())
103
+ {
104
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"CreateWatcher", 3);
105
+ }
106
+
107
+ if (!is_overload_present.value())
108
+ {
109
+ py::set_arg_count_version_error(3);
110
+ return nullptr;
111
+ }
112
+
93
113
  auto param0 = py::convert_to<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectType>(args, 0);
94
114
  auto param1 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 1);
95
115
  auto param2 = py::convert_to<winrt::hstring>(args, 2);
@@ -115,14 +135,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
115
135
 
116
136
  if (arg_count == 2)
117
137
  {
118
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"FindAllAsync", 2))
119
- {
120
- py::set_arg_count_version_error(2);
121
- return nullptr;
122
- }
123
-
124
138
  try
125
139
  {
140
+ static std::optional<bool> is_overload_present{};
141
+
142
+ if (!is_overload_present.has_value())
143
+ {
144
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"FindAllAsync", 2);
145
+ }
146
+
147
+ if (!is_overload_present.value())
148
+ {
149
+ py::set_arg_count_version_error(2);
150
+ return nullptr;
151
+ }
152
+
126
153
  auto param0 = py::convert_to<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectType>(args, 0);
127
154
  auto param1 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 1);
128
155
 
@@ -136,14 +163,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
136
163
  }
137
164
  else if (arg_count == 3)
138
165
  {
139
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"FindAllAsync", 3))
140
- {
141
- py::set_arg_count_version_error(3);
142
- return nullptr;
143
- }
144
-
145
166
  try
146
167
  {
168
+ static std::optional<bool> is_overload_present{};
169
+
170
+ if (!is_overload_present.has_value())
171
+ {
172
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"FindAllAsync", 3);
173
+ }
174
+
175
+ if (!is_overload_present.value())
176
+ {
177
+ py::set_arg_count_version_error(3);
178
+ return nullptr;
179
+ }
180
+
147
181
  auto param0 = py::convert_to<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectType>(args, 0);
148
182
  auto param1 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 1);
149
183
  auto param2 = py::convert_to<winrt::hstring>(args, 2);
@@ -169,14 +203,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
169
203
 
170
204
  if (arg_count == 1)
171
205
  {
172
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"Update", 1))
173
- {
174
- py::set_arg_count_version_error(1);
175
- return nullptr;
176
- }
177
-
178
206
  try
179
207
  {
208
+ static std::optional<bool> is_overload_present{};
209
+
210
+ if (!is_overload_present.has_value())
211
+ {
212
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"Update", 1);
213
+ }
214
+
215
+ if (!is_overload_present.value())
216
+ {
217
+ py::set_arg_count_version_error(1);
218
+ return nullptr;
219
+ }
220
+
180
221
  auto param0 = py::convert_to<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectUpdate>(args, 0);
181
222
 
182
223
  self->obj.Update(param0);
@@ -197,14 +238,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
197
238
 
198
239
  static PyObject* PnpObject_get_Id(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObject* self, void* /*unused*/) noexcept
199
240
  {
200
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"Id"))
201
- {
202
- PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
203
- return nullptr;
204
- }
205
-
206
241
  try
207
242
  {
243
+ static std::optional<bool> is_property_present{};
244
+
245
+ if (!is_property_present.has_value())
246
+ {
247
+ is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"Id");
248
+ }
249
+
250
+ if (!is_property_present.value())
251
+ {
252
+ PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
253
+ return nullptr;
254
+ }
255
+
208
256
  return py::convert(self->obj.Id());
209
257
  }
210
258
  catch (...)
@@ -216,14 +264,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
216
264
 
217
265
  static PyObject* PnpObject_get_Properties(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObject* self, void* /*unused*/) noexcept
218
266
  {
219
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"Properties"))
220
- {
221
- PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
222
- return nullptr;
223
- }
224
-
225
267
  try
226
268
  {
269
+ static std::optional<bool> is_property_present{};
270
+
271
+ if (!is_property_present.has_value())
272
+ {
273
+ is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"Properties");
274
+ }
275
+
276
+ if (!is_property_present.value())
277
+ {
278
+ PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
279
+ return nullptr;
280
+ }
281
+
227
282
  return py::convert(self->obj.Properties());
228
283
  }
229
284
  catch (...)
@@ -235,14 +290,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
235
290
 
236
291
  static PyObject* PnpObject_get_Type(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObject* self, void* /*unused*/) noexcept
237
292
  {
238
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"Type"))
239
- {
240
- PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
241
- return nullptr;
242
- }
243
-
244
293
  try
245
294
  {
295
+ static std::optional<bool> is_property_present{};
296
+
297
+ if (!is_property_present.has_value())
298
+ {
299
+ is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObject", L"Type");
300
+ }
301
+
302
+ if (!is_property_present.value())
303
+ {
304
+ PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
305
+ return nullptr;
306
+ }
307
+
246
308
  return py::convert(self->obj.Type());
247
309
  }
248
310
  catch (...)
@@ -290,23 +352,20 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
290
352
  { }
291
353
  };
292
354
 
293
- static PyType_Slot _type_slots_PnpObject[] =
294
- {
355
+ static PyType_Slot _type_slots_PnpObject[] = {
295
356
  { Py_tp_new, reinterpret_cast<void*>(_new_PnpObject) },
296
357
  { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PnpObject) },
297
358
  { Py_tp_methods, reinterpret_cast<void*>(_methods_PnpObject) },
298
359
  { Py_tp_getset, reinterpret_cast<void*>(_getset_PnpObject) },
299
- { },
360
+ { }
300
361
  };
301
362
 
302
- static PyType_Spec type_spec_PnpObject =
303
- {
363
+ static PyType_Spec type_spec_PnpObject = {
304
364
  "winrt._winrt_windows_devices_enumeration_pnp.PnpObject",
305
365
  sizeof(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObject),
306
366
  0,
307
367
  Py_TPFLAGS_DEFAULT,
308
- _type_slots_PnpObject
309
- };
368
+ _type_slots_PnpObject};
310
369
 
311
370
  static PyGetSetDef getset_PnpObject_Static[] = {
312
371
  { }
@@ -359,14 +418,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
359
418
 
360
419
  if (arg_count == 0)
361
420
  {
362
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"First", 0))
363
- {
364
- py::set_arg_count_version_error(0);
365
- return nullptr;
366
- }
367
-
368
421
  try
369
422
  {
423
+ static std::optional<bool> is_overload_present{};
424
+
425
+ if (!is_overload_present.has_value())
426
+ {
427
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"First", 0);
428
+ }
429
+
430
+ if (!is_overload_present.value())
431
+ {
432
+ py::set_arg_count_version_error(0);
433
+ return nullptr;
434
+ }
435
+
370
436
  return py::convert(self->obj.First());
371
437
  }
372
438
  catch (...)
@@ -388,14 +454,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
388
454
 
389
455
  if (arg_count == 1)
390
456
  {
391
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"GetAt", 1))
392
- {
393
- py::set_arg_count_version_error(1);
394
- return nullptr;
395
- }
396
-
397
457
  try
398
458
  {
459
+ static std::optional<bool> is_overload_present{};
460
+
461
+ if (!is_overload_present.has_value())
462
+ {
463
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"GetAt", 1);
464
+ }
465
+
466
+ if (!is_overload_present.value())
467
+ {
468
+ py::set_arg_count_version_error(1);
469
+ return nullptr;
470
+ }
471
+
399
472
  auto param0 = py::convert_to<uint32_t>(args, 0);
400
473
 
401
474
  return py::convert(self->obj.GetAt(param0));
@@ -419,14 +492,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
419
492
 
420
493
  if (arg_count == 2)
421
494
  {
422
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"GetMany", 1))
423
- {
424
- py::set_arg_count_version_error(1);
425
- return nullptr;
426
- }
427
-
428
495
  try
429
496
  {
497
+ static std::optional<bool> is_overload_present{};
498
+
499
+ if (!is_overload_present.has_value())
500
+ {
501
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"GetMany", 1);
502
+ }
503
+
504
+ if (!is_overload_present.value())
505
+ {
506
+ py::set_arg_count_version_error(1);
507
+ return nullptr;
508
+ }
509
+
430
510
  auto param0 = py::convert_to<uint32_t>(args, 0);
431
511
  auto param1 = py::convert_to<py::pybuf_view<winrt::Windows::Devices::Enumeration::Pnp::PnpObject, true>>(args, 1);
432
512
 
@@ -451,16 +531,23 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
451
531
 
452
532
  if (arg_count == 1)
453
533
  {
454
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"IndexOf", 1))
455
- {
456
- py::set_arg_count_version_error(1);
457
- return nullptr;
458
- }
459
-
460
534
  try
461
535
  {
536
+ static std::optional<bool> is_overload_present{};
537
+
538
+ if (!is_overload_present.has_value())
539
+ {
540
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"IndexOf", 1);
541
+ }
542
+
543
+ if (!is_overload_present.value())
544
+ {
545
+ py::set_arg_count_version_error(1);
546
+ return nullptr;
547
+ }
548
+
462
549
  auto param0 = py::convert_to<winrt::Windows::Devices::Enumeration::Pnp::PnpObject>(args, 0);
463
- uint32_t param1 { };
550
+ uint32_t param1{};
464
551
 
465
552
  auto return_value = self->obj.IndexOf(param0, param1);
466
553
 
@@ -491,14 +578,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
491
578
 
492
579
  static PyObject* PnpObjectCollection_get_Size(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectCollection* self, void* /*unused*/) noexcept
493
580
  {
494
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"Size"))
495
- {
496
- PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
497
- return nullptr;
498
- }
499
-
500
581
  try
501
582
  {
583
+ static std::optional<bool> is_property_present{};
584
+
585
+ if (!is_property_present.has_value())
586
+ {
587
+ is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectCollection", L"Size");
588
+ }
589
+
590
+ if (!is_property_present.value())
591
+ {
592
+ PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
593
+ return nullptr;
594
+ }
595
+
502
596
  return py::convert(self->obj.Size());
503
597
  }
504
598
  catch (...)
@@ -596,26 +690,19 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
596
690
 
597
691
  if (!PySlice_Check(slice))
598
692
  {
599
- PyErr_Format(
600
- PyExc_TypeError,
601
- "indicies must be integers, not '%s'",
602
- Py_TYPE(slice)->tp_name);
693
+ PyErr_Format(PyExc_TypeError, "indices must be integers, not '%s'", Py_TYPE(slice)->tp_name);
603
694
  }
604
695
 
605
696
  Py_ssize_t start, stop, step, length;
606
697
 
607
- if (PySlice_GetIndicesEx(
608
- slice, self->obj.Size(), &start, &stop, &step, &length)
609
- < 0)
698
+ if (PySlice_GetIndicesEx(slice, self->obj.Size(), &start, &stop, &step, &length) < 0)
610
699
  {
611
700
  return nullptr;
612
701
  }
613
702
 
614
703
  if (step != 1)
615
704
  {
616
- PyErr_SetString(
617
- PyExc_NotImplementedError,
618
- "slices with step other than 1 are not implemented");
705
+ PyErr_SetString(PyExc_NotImplementedError, "slices with step other than 1 are not implemented");
619
706
  return nullptr;
620
707
  }
621
708
 
@@ -625,15 +712,12 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
625
712
 
626
713
  if (count != static_cast<uint32_t>(length))
627
714
  {
628
- PyErr_Format(
629
- PyExc_RuntimeError,
630
- "returned count %d did not match requested length %zd",
631
- count,
632
- length);
715
+ PyErr_Format(PyExc_RuntimeError, "returned count %d did not match requested length %zd", count, length);
633
716
  return nullptr;
634
717
  }
635
718
 
636
- return convert(items);}
719
+ return convert(items);
720
+ }
637
721
  catch (...)
638
722
  {
639
723
  py::to_PyErr();
@@ -656,8 +740,7 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
656
740
  { }
657
741
  };
658
742
 
659
- static PyType_Slot _type_slots_PnpObjectCollection[] =
660
- {
743
+ static PyType_Slot _type_slots_PnpObjectCollection[] = {
661
744
  { Py_tp_new, reinterpret_cast<void*>(_new_PnpObjectCollection) },
662
745
  { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PnpObjectCollection) },
663
746
  { Py_tp_methods, reinterpret_cast<void*>(_methods_PnpObjectCollection) },
@@ -666,17 +749,15 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
666
749
  { Py_sq_length, reinterpret_cast<void*>(_seq_length_PnpObjectCollection) },
667
750
  { Py_sq_item, reinterpret_cast<void*>(_seq_item_PnpObjectCollection) },
668
751
  { Py_mp_subscript, reinterpret_cast<void*>(_seq_subscript_PnpObjectCollection) },
669
- { },
752
+ { }
670
753
  };
671
754
 
672
- static PyType_Spec type_spec_PnpObjectCollection =
673
- {
755
+ static PyType_Spec type_spec_PnpObjectCollection = {
674
756
  "winrt._winrt_windows_devices_enumeration_pnp.PnpObjectCollection",
675
757
  sizeof(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectCollection),
676
758
  0,
677
759
  Py_TPFLAGS_DEFAULT,
678
- _type_slots_PnpObjectCollection
679
- };
760
+ _type_slots_PnpObjectCollection};
680
761
 
681
762
  // ----- PnpObjectUpdate class --------------------
682
763
 
@@ -697,14 +778,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
697
778
 
698
779
  static PyObject* PnpObjectUpdate_get_Id(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectUpdate* self, void* /*unused*/) noexcept
699
780
  {
700
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectUpdate", L"Id"))
701
- {
702
- PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
703
- return nullptr;
704
- }
705
-
706
781
  try
707
782
  {
783
+ static std::optional<bool> is_property_present{};
784
+
785
+ if (!is_property_present.has_value())
786
+ {
787
+ is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectUpdate", L"Id");
788
+ }
789
+
790
+ if (!is_property_present.value())
791
+ {
792
+ PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
793
+ return nullptr;
794
+ }
795
+
708
796
  return py::convert(self->obj.Id());
709
797
  }
710
798
  catch (...)
@@ -716,14 +804,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
716
804
 
717
805
  static PyObject* PnpObjectUpdate_get_Properties(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectUpdate* self, void* /*unused*/) noexcept
718
806
  {
719
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectUpdate", L"Properties"))
720
- {
721
- PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
722
- return nullptr;
723
- }
724
-
725
807
  try
726
808
  {
809
+ static std::optional<bool> is_property_present{};
810
+
811
+ if (!is_property_present.has_value())
812
+ {
813
+ is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectUpdate", L"Properties");
814
+ }
815
+
816
+ if (!is_property_present.value())
817
+ {
818
+ PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
819
+ return nullptr;
820
+ }
821
+
727
822
  return py::convert(self->obj.Properties());
728
823
  }
729
824
  catch (...)
@@ -735,14 +830,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
735
830
 
736
831
  static PyObject* PnpObjectUpdate_get_Type(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectUpdate* self, void* /*unused*/) noexcept
737
832
  {
738
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectUpdate", L"Type"))
739
- {
740
- PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
741
- return nullptr;
742
- }
743
-
744
833
  try
745
834
  {
835
+ static std::optional<bool> is_property_present{};
836
+
837
+ if (!is_property_present.has_value())
838
+ {
839
+ is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectUpdate", L"Type");
840
+ }
841
+
842
+ if (!is_property_present.value())
843
+ {
844
+ PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
845
+ return nullptr;
846
+ }
847
+
746
848
  return py::convert(self->obj.Type());
747
849
  }
748
850
  catch (...)
@@ -789,23 +891,20 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
789
891
  { }
790
892
  };
791
893
 
792
- static PyType_Slot _type_slots_PnpObjectUpdate[] =
793
- {
894
+ static PyType_Slot _type_slots_PnpObjectUpdate[] = {
794
895
  { Py_tp_new, reinterpret_cast<void*>(_new_PnpObjectUpdate) },
795
896
  { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PnpObjectUpdate) },
796
897
  { Py_tp_methods, reinterpret_cast<void*>(_methods_PnpObjectUpdate) },
797
898
  { Py_tp_getset, reinterpret_cast<void*>(_getset_PnpObjectUpdate) },
798
- { },
899
+ { }
799
900
  };
800
901
 
801
- static PyType_Spec type_spec_PnpObjectUpdate =
802
- {
902
+ static PyType_Spec type_spec_PnpObjectUpdate = {
803
903
  "winrt._winrt_windows_devices_enumeration_pnp.PnpObjectUpdate",
804
904
  sizeof(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectUpdate),
805
905
  0,
806
906
  Py_TPFLAGS_DEFAULT,
807
- _type_slots_PnpObjectUpdate
808
- };
907
+ _type_slots_PnpObjectUpdate};
809
908
 
810
909
  // ----- PnpObjectWatcher class --------------------
811
910
 
@@ -830,14 +929,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
830
929
 
831
930
  if (arg_count == 0)
832
931
  {
833
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Start", 0))
834
- {
835
- py::set_arg_count_version_error(0);
836
- return nullptr;
837
- }
838
-
839
932
  try
840
933
  {
934
+ static std::optional<bool> is_overload_present{};
935
+
936
+ if (!is_overload_present.has_value())
937
+ {
938
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Start", 0);
939
+ }
940
+
941
+ if (!is_overload_present.value())
942
+ {
943
+ py::set_arg_count_version_error(0);
944
+ return nullptr;
945
+ }
946
+
841
947
  self->obj.Start();
842
948
  Py_RETURN_NONE;
843
949
  }
@@ -860,14 +966,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
860
966
 
861
967
  if (arg_count == 0)
862
968
  {
863
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Stop", 0))
864
- {
865
- py::set_arg_count_version_error(0);
866
- return nullptr;
867
- }
868
-
869
969
  try
870
970
  {
971
+ static std::optional<bool> is_overload_present{};
972
+
973
+ if (!is_overload_present.has_value())
974
+ {
975
+ is_overload_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Stop", 0);
976
+ }
977
+
978
+ if (!is_overload_present.value())
979
+ {
980
+ py::set_arg_count_version_error(0);
981
+ return nullptr;
982
+ }
983
+
871
984
  self->obj.Stop();
872
985
  Py_RETURN_NONE;
873
986
  }
@@ -886,14 +999,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
886
999
 
887
1000
  static PyObject* PnpObjectWatcher_get_Status(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, void* /*unused*/) noexcept
888
1001
  {
889
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Status"))
890
- {
891
- PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
892
- return nullptr;
893
- }
894
-
895
1002
  try
896
1003
  {
1004
+ static std::optional<bool> is_property_present{};
1005
+
1006
+ if (!is_property_present.has_value())
1007
+ {
1008
+ is_property_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Status");
1009
+ }
1010
+
1011
+ if (!is_property_present.value())
1012
+ {
1013
+ PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
1014
+ return nullptr;
1015
+ }
1016
+
897
1017
  return py::convert(self->obj.Status());
898
1018
  }
899
1019
  catch (...)
@@ -905,14 +1025,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
905
1025
 
906
1026
  static PyObject* PnpObjectWatcher_add_Added(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
907
1027
  {
908
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Added"))
909
- {
910
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
911
- return nullptr;
912
- }
913
-
914
1028
  try
915
1029
  {
1030
+ static std::optional<bool> is_event_present{};
1031
+
1032
+ if (!is_event_present.has_value())
1033
+ {
1034
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Added");
1035
+ }
1036
+
1037
+ if (!is_event_present.value())
1038
+ {
1039
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1040
+ return nullptr;
1041
+ }
1042
+
916
1043
  auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher, winrt::Windows::Devices::Enumeration::Pnp::PnpObject>>(arg);
917
1044
 
918
1045
  return py::convert(self->obj.Added(param0));
@@ -926,14 +1053,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
926
1053
 
927
1054
  static PyObject* PnpObjectWatcher_remove_Added(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
928
1055
  {
929
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Added"))
930
- {
931
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
932
- return nullptr;
933
- }
934
-
935
1056
  try
936
1057
  {
1058
+ static std::optional<bool> is_event_present{};
1059
+
1060
+ if (!is_event_present.has_value())
1061
+ {
1062
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Added");
1063
+ }
1064
+
1065
+ if (!is_event_present.value())
1066
+ {
1067
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1068
+ return nullptr;
1069
+ }
1070
+
937
1071
  auto param0 = py::convert_to<winrt::event_token>(arg);
938
1072
 
939
1073
  self->obj.Added(param0);
@@ -948,14 +1082,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
948
1082
 
949
1083
  static PyObject* PnpObjectWatcher_add_EnumerationCompleted(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
950
1084
  {
951
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"EnumerationCompleted"))
952
- {
953
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
954
- return nullptr;
955
- }
956
-
957
1085
  try
958
1086
  {
1087
+ static std::optional<bool> is_event_present{};
1088
+
1089
+ if (!is_event_present.has_value())
1090
+ {
1091
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"EnumerationCompleted");
1092
+ }
1093
+
1094
+ if (!is_event_present.value())
1095
+ {
1096
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1097
+ return nullptr;
1098
+ }
1099
+
959
1100
  auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher, winrt::Windows::Foundation::IInspectable>>(arg);
960
1101
 
961
1102
  return py::convert(self->obj.EnumerationCompleted(param0));
@@ -969,14 +1110,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
969
1110
 
970
1111
  static PyObject* PnpObjectWatcher_remove_EnumerationCompleted(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
971
1112
  {
972
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"EnumerationCompleted"))
973
- {
974
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
975
- return nullptr;
976
- }
977
-
978
1113
  try
979
1114
  {
1115
+ static std::optional<bool> is_event_present{};
1116
+
1117
+ if (!is_event_present.has_value())
1118
+ {
1119
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"EnumerationCompleted");
1120
+ }
1121
+
1122
+ if (!is_event_present.value())
1123
+ {
1124
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1125
+ return nullptr;
1126
+ }
1127
+
980
1128
  auto param0 = py::convert_to<winrt::event_token>(arg);
981
1129
 
982
1130
  self->obj.EnumerationCompleted(param0);
@@ -991,14 +1139,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
991
1139
 
992
1140
  static PyObject* PnpObjectWatcher_add_Removed(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
993
1141
  {
994
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Removed"))
995
- {
996
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
997
- return nullptr;
998
- }
999
-
1000
1142
  try
1001
1143
  {
1144
+ static std::optional<bool> is_event_present{};
1145
+
1146
+ if (!is_event_present.has_value())
1147
+ {
1148
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Removed");
1149
+ }
1150
+
1151
+ if (!is_event_present.value())
1152
+ {
1153
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1154
+ return nullptr;
1155
+ }
1156
+
1002
1157
  auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher, winrt::Windows::Devices::Enumeration::Pnp::PnpObjectUpdate>>(arg);
1003
1158
 
1004
1159
  return py::convert(self->obj.Removed(param0));
@@ -1012,14 +1167,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
1012
1167
 
1013
1168
  static PyObject* PnpObjectWatcher_remove_Removed(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
1014
1169
  {
1015
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Removed"))
1016
- {
1017
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1018
- return nullptr;
1019
- }
1020
-
1021
1170
  try
1022
1171
  {
1172
+ static std::optional<bool> is_event_present{};
1173
+
1174
+ if (!is_event_present.has_value())
1175
+ {
1176
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Removed");
1177
+ }
1178
+
1179
+ if (!is_event_present.value())
1180
+ {
1181
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1182
+ return nullptr;
1183
+ }
1184
+
1023
1185
  auto param0 = py::convert_to<winrt::event_token>(arg);
1024
1186
 
1025
1187
  self->obj.Removed(param0);
@@ -1034,14 +1196,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
1034
1196
 
1035
1197
  static PyObject* PnpObjectWatcher_add_Stopped(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
1036
1198
  {
1037
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Stopped"))
1038
- {
1039
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1040
- return nullptr;
1041
- }
1042
-
1043
1199
  try
1044
1200
  {
1201
+ static std::optional<bool> is_event_present{};
1202
+
1203
+ if (!is_event_present.has_value())
1204
+ {
1205
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Stopped");
1206
+ }
1207
+
1208
+ if (!is_event_present.value())
1209
+ {
1210
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1211
+ return nullptr;
1212
+ }
1213
+
1045
1214
  auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher, winrt::Windows::Foundation::IInspectable>>(arg);
1046
1215
 
1047
1216
  return py::convert(self->obj.Stopped(param0));
@@ -1055,14 +1224,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
1055
1224
 
1056
1225
  static PyObject* PnpObjectWatcher_remove_Stopped(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
1057
1226
  {
1058
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Stopped"))
1059
- {
1060
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1061
- return nullptr;
1062
- }
1063
-
1064
1227
  try
1065
1228
  {
1229
+ static std::optional<bool> is_event_present{};
1230
+
1231
+ if (!is_event_present.has_value())
1232
+ {
1233
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Stopped");
1234
+ }
1235
+
1236
+ if (!is_event_present.value())
1237
+ {
1238
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1239
+ return nullptr;
1240
+ }
1241
+
1066
1242
  auto param0 = py::convert_to<winrt::event_token>(arg);
1067
1243
 
1068
1244
  self->obj.Stopped(param0);
@@ -1077,14 +1253,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
1077
1253
 
1078
1254
  static PyObject* PnpObjectWatcher_add_Updated(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
1079
1255
  {
1080
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Updated"))
1081
- {
1082
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1083
- return nullptr;
1084
- }
1085
-
1086
1256
  try
1087
1257
  {
1258
+ static std::optional<bool> is_event_present{};
1259
+
1260
+ if (!is_event_present.has_value())
1261
+ {
1262
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Updated");
1263
+ }
1264
+
1265
+ if (!is_event_present.value())
1266
+ {
1267
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1268
+ return nullptr;
1269
+ }
1270
+
1088
1271
  auto param0 = py::convert_to<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher, winrt::Windows::Devices::Enumeration::Pnp::PnpObjectUpdate>>(arg);
1089
1272
 
1090
1273
  return py::convert(self->obj.Updated(param0));
@@ -1098,14 +1281,21 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
1098
1281
 
1099
1282
  static PyObject* PnpObjectWatcher_remove_Updated(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher* self, PyObject* arg) noexcept
1100
1283
  {
1101
- if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Updated"))
1102
- {
1103
- PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1104
- return nullptr;
1105
- }
1106
-
1107
1284
  try
1108
1285
  {
1286
+ static std::optional<bool> is_event_present{};
1287
+
1288
+ if (!is_event_present.has_value())
1289
+ {
1290
+ is_event_present = winrt::Windows::Foundation::Metadata::ApiInformation::IsEventPresent(L"Windows.Devices.Enumeration.Pnp.PnpObjectWatcher", L"Updated");
1291
+ }
1292
+
1293
+ if (!is_event_present.value())
1294
+ {
1295
+ PyErr_SetString(PyExc_AttributeError, "event is not available in this version of Windows");
1296
+ return nullptr;
1297
+ }
1298
+
1109
1299
  auto param0 = py::convert_to<winrt::event_token>(arg);
1110
1300
 
1111
1301
  self->obj.Updated(param0);
@@ -1165,39 +1355,35 @@ namespace py::cpp::Windows::Devices::Enumeration::Pnp
1165
1355
  { }
1166
1356
  };
1167
1357
 
1168
- static PyType_Slot _type_slots_PnpObjectWatcher[] =
1169
- {
1358
+ static PyType_Slot _type_slots_PnpObjectWatcher[] = {
1170
1359
  { Py_tp_new, reinterpret_cast<void*>(_new_PnpObjectWatcher) },
1171
1360
  { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_PnpObjectWatcher) },
1172
1361
  { Py_tp_methods, reinterpret_cast<void*>(_methods_PnpObjectWatcher) },
1173
1362
  { Py_tp_getset, reinterpret_cast<void*>(_getset_PnpObjectWatcher) },
1174
- { },
1363
+ { }
1175
1364
  };
1176
1365
 
1177
- static PyType_Spec type_spec_PnpObjectWatcher =
1178
- {
1366
+ static PyType_Spec type_spec_PnpObjectWatcher = {
1179
1367
  "winrt._winrt_windows_devices_enumeration_pnp.PnpObjectWatcher",
1180
1368
  sizeof(py::wrapper::Windows::Devices::Enumeration::Pnp::PnpObjectWatcher),
1181
1369
  0,
1182
1370
  Py_TPFLAGS_DEFAULT,
1183
- _type_slots_PnpObjectWatcher
1184
- };
1371
+ _type_slots_PnpObjectWatcher};
1185
1372
 
1186
1373
  // ----- Windows.Devices.Enumeration.Pnp Initialization --------------------
1187
- PyDoc_STRVAR(module_doc, "Windows::Devices::Enumeration::Pnp");
1188
1374
 
1375
+ PyDoc_STRVAR(module_doc, "Windows.Devices.Enumeration.Pnp");
1189
1376
 
1190
- static PyModuleDef module_def
1191
- = {PyModuleDef_HEAD_INIT,
1192
- "_winrt_windows_devices_enumeration_pnp",
1193
- module_doc,
1194
- 0,
1195
- nullptr,
1196
- nullptr,
1197
- nullptr,
1198
- nullptr,
1199
- nullptr};
1200
-
1377
+ static PyModuleDef module_def = {
1378
+ PyModuleDef_HEAD_INIT,
1379
+ "_winrt_windows_devices_enumeration_pnp",
1380
+ module_doc,
1381
+ 0,
1382
+ nullptr,
1383
+ nullptr,
1384
+ nullptr,
1385
+ nullptr,
1386
+ nullptr};
1201
1387
  } // py::cpp::Windows::Devices::Enumeration::Pnp
1202
1388
 
1203
1389
  PyMODINIT_FUNC PyInit__winrt_windows_devices_enumeration_pnp(void) noexcept
@@ -1235,22 +1421,26 @@ PyMODINIT_FUNC PyInit__winrt_windows_devices_enumeration_pnp(void) noexcept
1235
1421
  return nullptr;
1236
1422
  }
1237
1423
 
1238
- if (py::register_python_type(module.get(), &type_spec_PnpObject, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_PnpObject_Static.get())) == -1)
1424
+ py::pytype_handle PnpObject_type{py::register_python_type(module.get(), &type_spec_PnpObject, object_bases.get(), reinterpret_cast<PyTypeObject*>(type_PnpObject_Static.get()))};
1425
+ if (!PnpObject_type)
1239
1426
  {
1240
1427
  return nullptr;
1241
1428
  }
1242
1429
 
1243
- if (py::register_python_type(module.get(), &type_spec_PnpObjectCollection, object_bases.get(), nullptr) == -1)
1430
+ py::pytype_handle PnpObjectCollection_type{py::register_python_type(module.get(), &type_spec_PnpObjectCollection, object_bases.get(), nullptr)};
1431
+ if (!PnpObjectCollection_type)
1244
1432
  {
1245
1433
  return nullptr;
1246
1434
  }
1247
1435
 
1248
- if (py::register_python_type(module.get(), &type_spec_PnpObjectUpdate, object_bases.get(), nullptr) == -1)
1436
+ py::pytype_handle PnpObjectUpdate_type{py::register_python_type(module.get(), &type_spec_PnpObjectUpdate, object_bases.get(), nullptr)};
1437
+ if (!PnpObjectUpdate_type)
1249
1438
  {
1250
1439
  return nullptr;
1251
1440
  }
1252
1441
 
1253
- if (py::register_python_type(module.get(), &type_spec_PnpObjectWatcher, object_bases.get(), nullptr) == -1)
1442
+ py::pytype_handle PnpObjectWatcher_type{py::register_python_type(module.get(), &type_spec_PnpObjectWatcher, object_bases.get(), nullptr)};
1443
+ if (!PnpObjectWatcher_type)
1254
1444
  {
1255
1445
  return nullptr;
1256
1446
  }
@@ -16,7 +16,7 @@ classifiers = [
16
16
  "Intended Audience :: Developers",
17
17
  ]
18
18
  dynamic = ["version", "dependencies", "optional-dependencies"]
19
- requires-python = ">=3.9,<3.13"
19
+ requires-python = ">=3.9,<3.14"
20
20
 
21
21
  [project.urls]
22
22
  # Homepage = "https://github.com/pywinrt/pywinrt"
@@ -36,7 +36,8 @@ optional-dependencies.all = { file = "all-requirements.txt" }
36
36
  # use local winrt-sdk build dependency
37
37
  environment = { PYTHONPATH="../winrt-sdk/src" }
38
38
  # don't install winrt-sdk from PyPI
39
- build-frontend = { name = "build", args = ["--skip-dependency-check", "--no-isolation"] }
39
+ build-frontend = { name = "build[uv]", args = ["--skip-dependency-check", "--no-isolation"] }
40
+ before-build = "uv pip install setuptools"
40
41
  # don't build for PyPy
41
42
  skip = "pp*"
42
43
  # suppress warnings about ARM64 testing
@@ -1,3 +1,3 @@
1
- # WARNING: Please don't edit this file. It was generated by Python/WinRT v2.0.1
1
+ # WARNING: Please don't edit this file. It was generated by Python/WinRT v2.2.0
2
2
 
3
- winrt-runtime==2.0.1
3
+ winrt-runtime==2.2.0
@@ -1,4 +1,4 @@
1
- # WARNING: Please don't edit this file. It was generated by Python/WinRT v2.0.1
1
+ # WARNING: Please don't edit this file. It was generated by Python/WinRT v2.2.0
2
2
 
3
3
  import datetime
4
4
  import sys
@@ -9,9 +9,9 @@ from builtins import property as _property
9
9
 
10
10
  import winrt._winrt
11
11
  import winrt.system
12
- import winrt.windows.devices.enumeration
13
- import winrt.windows.foundation
14
- import winrt.windows.foundation.collections
12
+ import winrt.windows.devices.enumeration as windows_devices_enumeration
13
+ import winrt.windows.foundation as windows_foundation
14
+ import winrt.windows.foundation.collections as windows_foundation_collections
15
15
 
16
16
  from winrt.windows.devices.enumeration.pnp import PnpObjectType
17
17
 
@@ -19,15 +19,15 @@ Self = typing.TypeVar('Self')
19
19
 
20
20
  @typing.final
21
21
  class PnpObject_Static(type):
22
- def create_from_id_async(cls, type: PnpObjectType, id: str, requested_properties: typing.Iterable[str], /) -> winrt.windows.foundation.IAsyncOperation[PnpObject]: ...
22
+ def create_from_id_async(cls, type: PnpObjectType, id: str, requested_properties: typing.Iterable[str], /) -> windows_foundation.IAsyncOperation[PnpObject]: ...
23
23
  @typing.overload
24
24
  def create_watcher(cls, type: PnpObjectType, requested_properties: typing.Iterable[str], /) -> typing.Optional[PnpObjectWatcher]: ...
25
25
  @typing.overload
26
26
  def create_watcher(cls, type: PnpObjectType, requested_properties: typing.Iterable[str], aqs_filter: str, /) -> typing.Optional[PnpObjectWatcher]: ...
27
27
  @typing.overload
28
- def find_all_async(cls, type: PnpObjectType, requested_properties: typing.Iterable[str], /) -> winrt.windows.foundation.IAsyncOperation[PnpObjectCollection]: ...
28
+ def find_all_async(cls, type: PnpObjectType, requested_properties: typing.Iterable[str], /) -> windows_foundation.IAsyncOperation[PnpObjectCollection]: ...
29
29
  @typing.overload
30
- def find_all_async(cls, type: PnpObjectType, requested_properties: typing.Iterable[str], aqs_filter: str, /) -> winrt.windows.foundation.IAsyncOperation[PnpObjectCollection]: ...
30
+ def find_all_async(cls, type: PnpObjectType, requested_properties: typing.Iterable[str], aqs_filter: str, /) -> windows_foundation.IAsyncOperation[PnpObjectCollection]: ...
31
31
 
32
32
  @typing.final
33
33
  class PnpObject(winrt.system.Object, metaclass=PnpObject_Static):
@@ -37,21 +37,21 @@ class PnpObject(winrt.system.Object, metaclass=PnpObject_Static):
37
37
  @_property
38
38
  def id(self) -> str: ...
39
39
  @_property
40
- def properties(self) -> typing.Optional[winrt.windows.foundation.collections.IMapView[str, winrt.system.Object]]: ...
40
+ def properties(self) -> typing.Optional[windows_foundation_collections.IMapView[str, winrt.system.Object]]: ...
41
41
  @_property
42
42
  def type(self) -> PnpObjectType: ...
43
43
 
44
44
  @typing.final
45
45
  class PnpObjectCollection(winrt.system.Object, winrt._winrt.Sequence[PnpObject]):
46
46
  def __len__(self) -> int: ...
47
- def __iter__(self) -> winrt.windows.foundation.collections.IIterator[PnpObject]: ...
47
+ def __iter__(self) -> windows_foundation_collections.IIterator[PnpObject]: ...
48
48
  @typing.overload
49
49
  def __getitem__(self, index: typing.SupportsIndex) -> PnpObject: ...
50
50
  @typing.overload
51
51
  def __getitem__(self, index: slice) -> winrt.system.Array[PnpObject]: ...
52
52
  @staticmethod
53
53
  def _from(obj: winrt.system.Object, /) -> PnpObjectCollection: ...
54
- def first(self) -> typing.Optional[winrt.windows.foundation.collections.IIterator[PnpObject]]: ...
54
+ def first(self) -> typing.Optional[windows_foundation_collections.IIterator[PnpObject]]: ...
55
55
  def get_at(self, index: winrt.system.UInt32, /) -> typing.Optional[PnpObject]: ...
56
56
  def get_many(self, start_index: winrt.system.UInt32, items: winrt.system.Array[PnpObject], /) -> winrt.system.UInt32: ...
57
57
  def index_of(self, value: typing.Optional[PnpObject], /) -> typing.Tuple[bool, winrt.system.UInt32]: ...
@@ -65,7 +65,7 @@ class PnpObjectUpdate(winrt.system.Object):
65
65
  @_property
66
66
  def id(self) -> str: ...
67
67
  @_property
68
- def properties(self) -> typing.Optional[winrt.windows.foundation.collections.IMapView[str, winrt.system.Object]]: ...
68
+ def properties(self) -> typing.Optional[windows_foundation_collections.IMapView[str, winrt.system.Object]]: ...
69
69
  @_property
70
70
  def type(self) -> PnpObjectType: ...
71
71
 
@@ -75,16 +75,16 @@ class PnpObjectWatcher(winrt.system.Object):
75
75
  def _from(obj: winrt.system.Object, /) -> PnpObjectWatcher: ...
76
76
  def start(self) -> None: ...
77
77
  def stop(self) -> None: ...
78
- def add_added(self, handler: winrt.windows.foundation.TypedEventHandler[PnpObjectWatcher, PnpObject], /) -> winrt.windows.foundation.EventRegistrationToken: ...
79
- def remove_added(self, token: winrt.windows.foundation.EventRegistrationToken, /) -> None: ...
80
- def add_enumeration_completed(self, handler: winrt.windows.foundation.TypedEventHandler[PnpObjectWatcher, winrt.system.Object], /) -> winrt.windows.foundation.EventRegistrationToken: ...
81
- def remove_enumeration_completed(self, token: winrt.windows.foundation.EventRegistrationToken, /) -> None: ...
82
- def add_removed(self, handler: winrt.windows.foundation.TypedEventHandler[PnpObjectWatcher, PnpObjectUpdate], /) -> winrt.windows.foundation.EventRegistrationToken: ...
83
- def remove_removed(self, token: winrt.windows.foundation.EventRegistrationToken, /) -> None: ...
84
- def add_stopped(self, handler: winrt.windows.foundation.TypedEventHandler[PnpObjectWatcher, winrt.system.Object], /) -> winrt.windows.foundation.EventRegistrationToken: ...
85
- def remove_stopped(self, token: winrt.windows.foundation.EventRegistrationToken, /) -> None: ...
86
- def add_updated(self, handler: winrt.windows.foundation.TypedEventHandler[PnpObjectWatcher, PnpObjectUpdate], /) -> winrt.windows.foundation.EventRegistrationToken: ...
87
- def remove_updated(self, token: winrt.windows.foundation.EventRegistrationToken, /) -> None: ...
78
+ def add_added(self, handler: windows_foundation.TypedEventHandler[PnpObjectWatcher, PnpObject], /) -> windows_foundation.EventRegistrationToken: ...
79
+ def remove_added(self, token: windows_foundation.EventRegistrationToken, /) -> None: ...
80
+ def add_enumeration_completed(self, handler: windows_foundation.TypedEventHandler[PnpObjectWatcher, winrt.system.Object], /) -> windows_foundation.EventRegistrationToken: ...
81
+ def remove_enumeration_completed(self, token: windows_foundation.EventRegistrationToken, /) -> None: ...
82
+ def add_removed(self, handler: windows_foundation.TypedEventHandler[PnpObjectWatcher, PnpObjectUpdate], /) -> windows_foundation.EventRegistrationToken: ...
83
+ def remove_removed(self, token: windows_foundation.EventRegistrationToken, /) -> None: ...
84
+ def add_stopped(self, handler: windows_foundation.TypedEventHandler[PnpObjectWatcher, winrt.system.Object], /) -> windows_foundation.EventRegistrationToken: ...
85
+ def remove_stopped(self, token: windows_foundation.EventRegistrationToken, /) -> None: ...
86
+ def add_updated(self, handler: windows_foundation.TypedEventHandler[PnpObjectWatcher, PnpObjectUpdate], /) -> windows_foundation.EventRegistrationToken: ...
87
+ def remove_updated(self, token: windows_foundation.EventRegistrationToken, /) -> None: ...
88
88
  @_property
89
- def status(self) -> winrt.windows.devices.enumeration.DeviceWatcherStatus: ...
89
+ def status(self) -> windows_devices_enumeration.DeviceWatcherStatus: ...
90
90
 
@@ -1,4 +1,4 @@
1
- # WARNING: Please don't edit this file. It was generated by Python/WinRT v2.0.1
1
+ # WARNING: Please don't edit this file. It was generated by Python/WinRT v2.2.0
2
2
 
3
3
  import enum
4
4
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: winrt-Windows.Devices.Enumeration.Pnp
3
- Version: 2.0.1
3
+ Version: 2.2.0
4
4
  Summary: Python projection of Windows Runtime (WinRT) APIs
5
5
  License: MIT
6
6
  Project-URL: Documentation, https://pywinrt.readthedocs.io
@@ -10,13 +10,13 @@ Classifier: Operating System :: Microsoft :: Windows
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: Implementation :: CPython
12
12
  Classifier: Intended Audience :: Developers
13
- Requires-Python: <3.13,>=3.9
13
+ Requires-Python: <3.14,>=3.9
14
14
  Description-Content-Type: text/markdown
15
- Requires-Dist: winrt-runtime==2.0.1
15
+ Requires-Dist: winrt-runtime==2.2.0
16
16
  Provides-Extra: all
17
- Requires-Dist: winrt-Windows.Devices.Enumeration[all]==2.0.1; extra == "all"
18
- Requires-Dist: winrt-Windows.Foundation[all]==2.0.1; extra == "all"
19
- Requires-Dist: winrt-Windows.Foundation.Collections[all]==2.0.1; extra == "all"
17
+ Requires-Dist: winrt-Windows.Devices.Enumeration[all]==2.2.0; extra == "all"
18
+ Requires-Dist: winrt-Windows.Foundation[all]==2.2.0; extra == "all"
19
+ Requires-Dist: winrt-Windows.Foundation.Collections[all]==2.2.0; extra == "all"
20
20
 
21
21
  <!-- warning: Please don't edit this file. It was automatically generated. -->
22
22
 
@@ -0,0 +1,6 @@
1
+ winrt-runtime==2.2.0
2
+
3
+ [all]
4
+ winrt-Windows.Devices.Enumeration[all]==2.2.0
5
+ winrt-Windows.Foundation[all]==2.2.0
6
+ winrt-Windows.Foundation.Collections[all]==2.2.0
@@ -1,5 +0,0 @@
1
- # WARNING: Please don't edit this file. It was generated by Python/WinRT v2.0.1
2
-
3
- winrt-Windows.Devices.Enumeration[all]==2.0.1
4
- winrt-Windows.Foundation[all]==2.0.1
5
- winrt-Windows.Foundation.Collections[all]==2.0.1
@@ -1,6 +0,0 @@
1
- winrt-runtime==2.0.1
2
-
3
- [all]
4
- winrt-Windows.Devices.Enumeration[all]==2.0.1
5
- winrt-Windows.Foundation[all]==2.0.1
6
- winrt-Windows.Foundation.Collections[all]==2.0.1