File: device_server.py

package info (click to toggle)
pytango 10.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,216 kB
  • sloc: python: 28,206; cpp: 16,380; sql: 255; sh: 82; makefile: 43
file content (4388 lines) | stat: -rw-r--r-- 121,820 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
# SPDX-FileCopyrightText: All Contributors to the PyTango project
# SPDX-License-Identifier: LGPL-3.0-or-later

"""
This is an internal PyTango module.
"""


import copy
import functools
import inspect
import os
import sys
import types
import warnings

from tango._tango import (
    DeviceImpl,
    Device_3Impl,
    Device_4Impl,
    Device_5Impl,
    Device_6Impl,
    DevFailed,
    Attribute,
    WAttribute,
    AttrWriteType,
    MultiAttribute,
    MultiClassAttribute,
    Attr,
    Logger,
    AttrDataFormat,
    DispLevel,
    UserDefaultAttrProp,
    StdStringVector,
    Except,
    constants,
)
from tango.pyutil import Util
from tango.release import Release
from tango.utils import document_method as __document_method
from tango.utils import (
    copy_doc,
    get_latest_device_class,
    set_complex_value,
    is_pure_str,
    parse_type_hint,
    get_attribute_type_format,
    _force_tracing,
    _forcefully_traced_method,
    _get_non_tango_source_location,
    PyTangoUserWarning,
)
from tango.green import get_executor
from tango.attr_data import AttrData

from tango.log4tango import TangoStream

__docformat__ = "restructuredtext"

__all__ = (
    "ChangeEventProp",
    "PeriodicEventProp",
    "ArchiveEventProp",
    "AttributeAlarm",
    "EventProperties",
    "AttributeConfig",
    "AttributeConfig_2",
    "AttributeConfig_3",
    "AttributeConfig_5",
    "MultiAttrProp",
    "device_server_init",
)

# Worker access

_WORKER = get_executor()


def set_worker(worker):
    global _WORKER
    _WORKER = worker


def get_worker():
    return _WORKER


# patcher for methods
def run_in_executor(fn):
    if not hasattr(fn, "wrapped_with_executor"):

        @functools.wraps(fn)
        def wrapper(*args, **kwargs):
            return get_worker().execute(fn, *args, **kwargs)

        # to avoid double wrapping we add an empty field, and then use it to check, whether function is already wrapped
        wrapper.wrapped_with_executor = True
        return wrapper
    else:
        return fn


def get_source_location(source=None):
    """Helper function that provides source location for logging functions.
    :param source:
        (optional) Method or function, which will be unwrapped of decorated wrappers
        and inspected for location. If not provided - current stack will be used to deduce the location.
    :type source: Callable

    :return:
        Tuple (filename, lineno)
    :rtype :tuple:
    """
    location = _get_non_tango_source_location(source)
    filename = os.path.basename(location.filepath)
    return filename, location.lineno


class _InterfaceDefinedByIDL:
    _initialized = False

    def __setattr__(self, name, value):
        if name not in self.__dict__ and self._initialized:
            warnings.warn(
                f"Attribute {repr(name)} is not supported by Tango IDL "
                f"struct {self.__class__.__name__} - it will be ignored.",
                category=PyTangoUserWarning,
            )

        return super().__setattr__(name, value)


# Note: the inheritance below doesn't call get_latest_device_class(),
#       because such dynamic inheritance breaks auto-completion in IDEs.
#       Instead, we manually provide the correct class here, and verify
#       that the inheritance is correct via a unit test, in test_server.py.
class LatestDeviceImpl(Device_6Impl):
    __doc__ = f"""\
    Latest implementation of the TANGO device base class (alias for {get_latest_device_class().__name__}).

    It inherits from CORBA classes where all the network layer is implemented.
    """

    def __init__(self, *args):
        super().__init__(*args)
        # Set up python related versions for DevInfo
        self.add_version_info("PyTango", Release.version_long)
        self.add_version_info("Build.PyTango.Python", constants.Compile.PY_VERSION)
        self.add_version_info("Build.PyTango.cppTango", constants.Compile.TANGO_VERSION)
        self.add_version_info("Build.PyTango.NumPy", constants.Compile.NUMPY_VERSION)
        self.add_version_info("Build.PyTango.Boost", constants.Compile.BOOST_VERSION)
        self.add_version_info("Python", constants.Runtime.PY_VERSION)
        self.add_version_info("NumPy", constants.Runtime.NUMPY_VERSION)


class AttributeAlarm(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    AttributeAlarm."""

    def __init__(self):
        self.min_alarm = ""
        self.max_alarm = ""
        self.min_warning = ""
        self.max_warning = ""
        self.delta_t = ""
        self.delta_val = ""
        self.extensions = []
        self._initialized = True


class ChangeEventProp(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    ChangeEventProp."""

    def __init__(self):
        self.rel_change = ""
        self.abs_change = ""
        self.extensions = []
        self._initialized = True


class PeriodicEventProp(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    PeriodicEventProp."""

    def __init__(self):
        self.period = ""
        self.extensions = []
        self._initialized = True


class ArchiveEventProp(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    ArchiveEventProp."""

    def __init__(self):
        self.rel_change = ""
        self.abs_change = ""
        self.period = ""
        self.extensions = []
        self._initialized = True


class EventProperties(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    EventProperties."""

    def __init__(self):
        self.ch_event = ChangeEventProp()
        self.per_event = PeriodicEventProp()
        self.arch_event = ArchiveEventProp()
        self._initialized = True


class MultiAttrProp(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    MultiAttrProp."""

    def __init__(self):
        self.label = ""
        self.description = ""
        self.unit = ""
        self.standard_unit = ""
        self.display_unit = ""
        self.format = ""
        self.min_value = ""
        self.max_value = ""
        self.min_alarm = ""
        self.max_alarm = ""
        self.min_warning = ""
        self.max_warning = ""
        self.delta_t = ""
        self.delta_val = ""
        self.event_period = ""
        self.archive_period = ""
        self.rel_change = ""
        self.abs_change = ""
        self.archive_rel_change = ""
        self.archive_abs_change = ""
        self._initialized = True


def _init_attr_config(attr_cfg):
    """Helper function to initialize attribute config objects"""
    attr_cfg.name = ""
    attr_cfg.writable = AttrWriteType.READ
    attr_cfg.data_format = AttrDataFormat.SCALAR
    attr_cfg.data_type = 0
    attr_cfg.max_dim_x = 0
    attr_cfg.max_dim_y = 0
    attr_cfg.description = ""
    attr_cfg.label = ""
    attr_cfg.unit = ""
    attr_cfg.standard_unit = ""
    attr_cfg.display_unit = ""
    attr_cfg.format = ""
    attr_cfg.min_value = ""
    attr_cfg.max_value = ""
    attr_cfg.writable_attr_name = ""
    attr_cfg.extensions = []


class AttributeConfig(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    AttributeConfig."""

    def __init__(self):
        _init_attr_config(self)
        self.min_alarm = ""
        self.max_alarm = ""
        self._initialized = True


class AttributeConfig_2(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    AttributeConfig_2."""

    def __init__(self):
        _init_attr_config(self)
        self.level = DispLevel.OPERATOR
        self.min_alarm = ""
        self.max_alarm = ""
        self._initialized = True


class AttributeConfig_3(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    AttributeConfig_3."""

    def __init__(self):
        _init_attr_config(self)
        self.level = -1
        self.att_alarm = AttributeAlarm()
        self.event_prop = EventProperties()
        self.sys_extensions = []
        self._initialized = True


class AttributeConfig_5(_InterfaceDefinedByIDL):
    """This class represents the python interface for the Tango IDL object
    AttributeConfig_5."""

    def __init__(self):
        _init_attr_config(self)
        self.memorized = False
        self.mem_init = False
        self.level = -1
        self.root_attr_name = ""
        self.enum_labels = []
        self.att_alarm = AttributeAlarm()
        self.event_prop = EventProperties()
        self.sys_extensions = []
        self._initialized = True


def __Attribute__get_properties(self, attr_cfg=None):
    """
    get_properties(self, attr_cfg = None) -> AttributeConfig

        Get attribute properties.

        :param conf: the config object to be filled with
                     the attribute configuration. Default is None meaning the
                     method will create internally a new AttributeConfig_5
                     and return it.
                     Can be AttributeConfig, AttributeConfig_2,
                     AttributeConfig_3, AttributeConfig_5 or
                     MultiAttrProp

        :returns: the config object filled with attribute configuration information
        :rtype: AttributeConfig

        New in PyTango 7.1.4
    """

    if attr_cfg is None:
        attr_cfg = MultiAttrProp()
    if not isinstance(attr_cfg, MultiAttrProp):
        raise TypeError("attr_cfg must be an instance of MultiAttrProp")
    return self._get_properties_multi_attr_prop(attr_cfg)


def __Attribute__set_properties(self, attr_cfg, dev=None):
    """
    set_properties(self, attr_cfg, dev)

        Set attribute properties.

        This method sets the attribute properties value with the content
        of the fields in the AttributeConfig/ AttributeConfig_3 object

        :param conf: the config object.
        :type conf: AttributeConfig or AttributeConfig_3
        :param dev: the device (not used, maintained
                    for backward compatibility)
        :type dev: DeviceImpl

        New in PyTango 7.1.4
    """

    if not isinstance(attr_cfg, MultiAttrProp):
        raise TypeError("attr_cfg must be an instance of MultiAttrProp")
    return self._set_properties_multi_attr_prop(attr_cfg)


def __Attribute__str(self):
    return f"{self.__class__.__name__}({self.get_name()})"


def __Attribute__set_value(self, *args):
    """
    .. function:: set_value(self, data)
                  set_value(self, str_data, data)
                  DEPRECATED:  set_value(self, data, dim_x = 1, dim_y = 0)
        :noindex:

    Set internal attribute value.

    This method stores the attribute read value inside the object.
    This method also stores the date when it is called and initializes the
    attribute quality factor.

    :param data: the data to be set. Data must be compatible with the attribute type and format.
                 In the DEPRECATED form for SPECTRUM and IMAGE attributes, data
                 can be any type of FLAT sequence of elements compatible with the
                 attribute type.
                 In the new form (without dim_x or dim_y) data should be any
                 sequence for SPECTRUM and a SEQUENCE of equal-length SEQUENCES
                 for IMAGE attributes.
                 The recommended sequence is a C continuous and aligned numpy
                 array, as it can be optimized.
    :param str_data: special variation for DevEncoded data type. In this case 'data' must
                     be a str or an object with the buffer interface.
    :type str_data: str
    :param dim_x: [DEPRECATED] the attribute x length. Default value is 1
    :type dim_x: int
    :param dim_y: [DEPRECATED] the attribute y length. Default value is 0
    :type dim_y: int
    """

    if not len(args):
        raise TypeError("set_value method must be called with at least one argument!")

    for arg in args:
        if arg is None:
            raise TypeError("set_value method cannot be called with None!")

    self._set_value(*args)


def __Attribute__set_value_date_quality(self, *args):
    """
    .. function::   set_value_date_quality(self, data, time_stamp, quality)
                    set_value_date_quality(self, str_data, data, time_stamp, quality)
                    DEPRECATED:  set_value_date_quality(self, data, time_stamp, quality, dim_x = 1, dim_y = 0)
        :noindex:

    Set internal attribute value, date and quality factor.

    This method stores the attribute read value, the date and the attribute quality
    factor inside the object.

    :param data: the data to be set. Data must be compatible with the attribute type and format.
                 In the DEPRECATED form for SPECTRUM and IMAGE attributes, data
                 can be any type of FLAT sequence of elements compatible with the
                 attribute type.
                 In the new form (without dim_x or dim_y) data should be any
                 sequence for SPECTRUM and a SEQUENCE of equal-length SEQUENCES
                 for IMAGE attributes.
                 The recommended sequence is a C continuous and aligned numpy
                 array, as it can be optimized.
    :param str_data: special variation for DevEncoded data type. In this case 'data' must
                     be a str or an object with the buffer interface.
    :type str_data: str
    :param time_stamp: the time stamp
    :type time_stamp: double
    :param quality: the attribute quality factor
    :type quality: AttrQuality
    :param dim_x: [DEPRECATED] the attribute x length. Default value is 1
    :type dim_x: int
    :param dim_y: [DEPRECATED] the attribute y length. Default value is 0
    :type dim_y: int
    """

    if len(args) < 3:
        raise TypeError(
            "set_value_date_quality method must be called with at least three arguments!"
        )

    for arg in args:
        if arg is None:
            raise TypeError("set_value_date_quality method cannot be called with None!")

    self._set_value_date_quality(*args)


def __init_Attribute():
    Attribute.__str__ = __Attribute__str
    Attribute.__repr__ = __Attribute__str
    Attribute.get_properties = __Attribute__get_properties
    Attribute.set_properties = __Attribute__set_properties

    Attribute.set_value = __Attribute__set_value
    Attribute.set_value_date_quality = __Attribute__set_value_date_quality


def __DeviceImpl__get_device_class(self):
    """
    get_device_class(self)

        Get device class singleton.

        :returns: the device class singleton (device_class field)
        :rtype: DeviceClass

    """
    try:
        return self._device_class_instance
    except AttributeError:
        return None


def __DeviceImpl__get_device_properties(self, ds_class=None):
    """
    get_device_properties(self, ds_class = None)

        Utility method that fetches all the device properties from the database
        and converts them into members of this DeviceImpl.

        :param ds_class: the DeviceClass object. Optional. Default value is
                         None meaning that the corresponding DeviceClass object for this
                         DeviceImpl will be used
        :type ds_class: DeviceClass

        :raises DevFailed:
    """
    if ds_class is None:
        try:
            # Call this method in a try/except in case this is called during the DS shutdown sequence
            ds_class = self.get_device_class()
        except Exception:
            return
    try:
        pu = self.prop_util = ds_class.prop_util
        self.device_property_list = copy.deepcopy(ds_class.device_property_list)
        class_prop = ds_class.class_property_list
        pu.get_device_properties(self, class_prop, self.device_property_list)
        for prop_name in class_prop:
            setattr(self, prop_name, pu.get_property_values(prop_name, class_prop))
        for prop_name in self.device_property_list:
            setattr(
                self,
                prop_name,
                self.prop_util.get_property_values(
                    prop_name, self.device_property_list
                ),
            )
    except DevFailed as df:
        print(80 * "-")
        print(df)
        raise df


def __DeviceImpl__add_attribute(
    self, attr, r_meth=None, w_meth=None, is_allo_meth=None
):
    """
    add_attribute(self, attr, r_meth=None, w_meth=None, is_allo_meth=None) -> Attr

        Add a new attribute to the device attribute list.

        Please, note that if you add
        an attribute to a device at device creation time, this attribute will be added
        to the device class attribute list. Therefore, all devices belonging to the
        same class created after this attribute addition will also have this attribute.

        If you pass a reference to unbound method for read, write or is_allowed method
        (e.g. DeviceClass.read_function or self.__class__.read_function),
        during execution the corresponding bound method (self.read_function) will be used.

        Note: Calling the synchronous add_attribute method from a coroutine function in
        an asyncio server may cause a deadlock.
        Use ``await`` :meth:`async_add_attribute` instead.
        However, if overriding the synchronous method ``initialize_dynamic_attributes``,
        then the synchronous add_attribute method must be used, even in asyncio servers.

        :param attr: the new attribute to be added to the list.
        :type attr: server.attribute or Attr or AttrData
        :param r_meth: the read method to be called on a read request
                       (if attr is of type server.attribute, then use the
                       fget field in the attr object instead)
        :type r_meth: callable
        :param w_meth: the write method to be called on a write request
                       (if attr is writable)
                       (if attr is of type server.attribute, then use the
                       fset field in the attr object instead)
        :type w_meth: callable
        :param is_allo_meth: the method that is called to check if it
                             is possible to access the attribute or not
                             (if attr is of type server.attribute, then use the
                             fisallowed field in the attr object instead)
        :type is_allo_meth: callable

        :returns: the newly created attribute.
        :rtype: Attr

        :raises DevFailed:
    """

    return __DeviceImpl__add_attribute_realization(
        self, attr, r_meth, w_meth, is_allo_meth
    )


async def __DeviceImpl__async_add_attribute(
    self, attr, r_meth=None, w_meth=None, is_allo_meth=None
):
    """
    async_add_attribute(self, attr, r_meth=None, w_meth=None, is_allo_meth=None) -> Attr

        Add a new attribute to the device attribute list.

        Please, note that if you add
        an attribute to a device at device creation time, this attribute will be added
        to the device class attribute list. Therefore, all devices belonging to the
        same class created after this attribute addition will also have this attribute.

        If you pass a reference to unbound method for read, write or is_allowed method
        (e.g. DeviceClass.read_function or self.__class__.read_function),
        during execution the corresponding bound method (self.read_function) will be used.

        :param attr: the new attribute to be added to the list.
        :type attr: server.attribute or Attr or AttrData
        :param r_meth: the read method to be called on a read request
                       (if attr is of type server.attribute, then use the
                       fget field in the attr object instead)
        :type r_meth: callable
        :param w_meth: the write method to be called on a write request
                       (if attr is writable)
                       (if attr is of type server.attribute, then use the
                       fset field in the attr object instead)
        :type w_meth: callable
        :param is_allo_meth: the method that is called to check if it
                             is possible to access the attribute or not
                             (if attr is of type server.attribute, then use the
                             fisallowed field in the attr object instead)
        :type is_allo_meth: callable

        :returns: the newly created attribute.
        :rtype: Attr

        :raises DevFailed:

        .. versionadded:: 10.0.0
    """

    return await get_worker().delegate(
        __DeviceImpl__add_attribute_realization,
        self,
        attr,
        r_meth,
        w_meth,
        is_allo_meth,
    )


def __DeviceImpl__add_attribute_realization(self, attr, r_meth, w_meth, is_allo_meth):
    attr_data = None
    type_hint = None

    if isinstance(attr, AttrData):
        attr_data = attr
        attr = attr.to_attr()

    att_name = attr.get_name()

    # get read method and its name
    r_name = f"read_{att_name}"
    if r_meth is None:
        if attr_data is not None:
            r_name = attr_data.read_method_name
        if hasattr(attr_data, "fget"):
            r_meth = attr_data.fget
        elif hasattr(self, r_name):
            r_meth = getattr(self, r_name)
    else:
        r_name = r_meth.__name__

    # patch it if attribute is readable
    if attr.get_writable() in (
        AttrWriteType.READ,
        AttrWriteType.READ_WRITE,
        AttrWriteType.READ_WITH_WRITE,
    ):
        type_hint = dict(r_meth.__annotations__).get("return", None)
        r_name = f"__wrapped_read_{att_name}_{r_name}__"
        r_meth_green_mode = getattr(attr_data, "read_green_mode", True)
        __patch_device_with_dynamic_attribute_read_method(
            self, r_name, r_meth, r_meth_green_mode
        )

    # get write method and its name
    w_name = f"write_{att_name}"
    if w_meth is None:
        if attr_data is not None:
            w_name = attr_data.write_method_name
        if hasattr(attr_data, "fset"):
            w_meth = attr_data.fset
        elif hasattr(self, w_name):
            w_meth = getattr(self, w_name)
    else:
        w_name = w_meth.__name__

    # patch it if attribute is writable
    if attr.get_writable() in (
        AttrWriteType.WRITE,
        AttrWriteType.READ_WRITE,
        AttrWriteType.READ_WITH_WRITE,
    ):
        type_hints = dict(w_meth.__annotations__)
        if type_hint is None and type_hints:
            type_hint = list(type_hints.values())[-1]

        w_name = f"__wrapped_write_{att_name}_{w_name}__"
        w_meth_green_mode = getattr(attr_data, "write_green_mode", True)
        __patch_device_with_dynamic_attribute_write_method(
            self, w_name, w_meth, w_meth_green_mode
        )

    # get is allowed method and its name
    ia_name = f"is_{att_name}_allowed"
    if is_allo_meth is None:
        if attr_data is not None:
            ia_name = attr_data.is_allowed_name
        if hasattr(attr_data, "fisallowed"):
            is_allo_meth = attr_data.fisallowed
        elif hasattr(self, ia_name):
            is_allo_meth = getattr(self, ia_name)
    else:
        ia_name = is_allo_meth.__name__

    # patch it if exists
    if is_allo_meth is not None:
        ia_name = f"__wrapped_is_allowed_{att_name}_{ia_name}__"
        ia_meth_green_mode = getattr(attr_data, "isallowed_green_mode", True)
        __patch_device_with_dynamic_attribute_is_allowed_method(
            self, ia_name, is_allo_meth, ia_meth_green_mode
        )

    if attr_data and type_hint:
        if not attr_data.has_dtype_kword:
            dtype, dformat, max_x, max_y = parse_type_hint(
                type_hint, caller="attribute"
            )
            if dformat is None:
                if attr_data.attr_format not in [
                    AttrDataFormat.IMAGE,
                    AttrDataFormat.SPECTRUM,
                ]:
                    raise RuntimeError(
                        "For numpy.ndarrays AttrDataFormat has to be specified"
                    )
                dformat = attr_data.attr_format

            dtype, dformat, enum_labels = get_attribute_type_format(
                dtype, dformat, None
            )
            attr_data.attr_type = dtype
            attr_data.attr_format = dformat
            if enum_labels:
                attr_data.set_enum_labels_to_attr_prop(enum_labels)
            if not attr_data.has_size_kword:
                if max_x:
                    attr_data.dim_x = max_x
                if max_y:
                    attr_data.dim_y = max_y

            attr = attr_data.to_attr()

    self._add_attribute(attr, r_name, w_name, ia_name)
    return attr


def __patch_device_with_dynamic_attribute_read_method(
    device, name, r_meth, r_meth_green_mode
):
    if __is_device_method(device, r_meth):
        if r_meth_green_mode:

            @functools.wraps(r_meth)
            def read_attr(device, attr):
                worker = get_worker()
                # already bound to device, so exclude device arg
                ret = worker.execute(r_meth, attr)
                if not attr.get_value_flag() and ret is not None:
                    set_complex_value(attr, ret)
                return ret

        else:

            @functools.wraps(r_meth)
            def read_attr(device, attr):
                ret = r_meth(attr)
                if not attr.get_value_flag() and ret is not None:
                    set_complex_value(attr, ret)
                return ret

    else:
        if r_meth_green_mode:

            @functools.wraps(r_meth)
            def read_attr(device, attr):
                worker = get_worker()
                # unbound function or not on device object, so include device arg
                ret = worker.execute(r_meth, device, attr)
                if not attr.get_value_flag() and ret is not None:
                    set_complex_value(attr, ret)
                return ret

        else:

            @functools.wraps(r_meth)
            def read_attr(device, attr):
                ret = r_meth(device, attr)
                if not attr.get_value_flag() and ret is not None:
                    set_complex_value(attr, ret)
                return ret

    if _force_tracing:
        read_attr = _forcefully_traced_method(read_attr)

    bound_method = types.MethodType(read_attr, device)
    setattr(device, name, bound_method)


def __patch_device_with_dynamic_attribute_write_method(
    device, name, w_meth, w_meth_green_mode
):
    if __is_device_method(device, w_meth):
        if w_meth_green_mode:

            @functools.wraps(w_meth)
            def write_attr(device, attr):
                worker = get_worker()
                # already bound to device, so exclude device arg
                return worker.execute(w_meth, attr)

        else:

            @functools.wraps(w_meth)
            def write_attr(device, attr):
                return w_meth(attr)

    else:
        if w_meth_green_mode:

            @functools.wraps(w_meth)
            def write_attr(device, attr):
                worker = get_worker()
                # unbound function or not on device object, so include device arg
                return worker.execute(w_meth, device, attr)

        else:
            write_attr = w_meth

    if _force_tracing:
        write_attr = _forcefully_traced_method(write_attr)

    bound_method = types.MethodType(write_attr, device)
    setattr(device, name, bound_method)


def __patch_device_with_dynamic_attribute_is_allowed_method(
    device, name, is_allo_meth, ia_meth_green_mode
):
    if __is_device_method(device, is_allo_meth):
        if ia_meth_green_mode:

            @functools.wraps(is_allo_meth)
            def is_allowed_attr(device, request_type):
                worker = get_worker()
                # already bound to device, so exclude device arg
                return worker.execute(is_allo_meth, request_type)

        else:

            @functools.wraps(is_allo_meth)
            def is_allowed_attr(device, request_type):
                return is_allo_meth(request_type)

    else:
        if ia_meth_green_mode:

            @functools.wraps(is_allo_meth)
            def is_allowed_attr(device, request_type):
                worker = get_worker()
                # unbound function or not on device object, so include device arg
                return worker.execute(is_allo_meth, device, request_type)

        else:
            is_allowed_attr = is_allo_meth

    if _force_tracing:
        is_allowed_attr = _forcefully_traced_method(is_allowed_attr)

    bound_method = types.MethodType(is_allowed_attr, device)
    setattr(device, name, bound_method)


def __is_device_method(device, func):
    """Return True if func is bound to device object (i.e., a method)"""
    return inspect.ismethod(func) and func.__self__ is device


def __DeviceImpl__remove_attribute(self, attr_name, free_it=False, clean_db=True):
    """
    remove_attribute(self, attr_name)

        Remove one attribute from the device attribute list.

        Note: Call of synchronous remove_attribute method from a coroutine function in
        an asyncio server may cause a deadlock.
        Use ``await`` :meth:`async_remove_attribute` instead.
        However, if overriding the synchronous method ``initialize_dynamic_attributes``,
        then the synchronous remove_attribute method must be used, even in asyncio servers.

        :param attr_name: attribute name
        :type attr_name: str

        :param free_it: free Attr object flag. Default False
        :type free_it: bool

        :param clean_db: clean attribute related info in db. Default True
        :type clean_db: bool

        :raises DevFailed:

        .. versionadded:: 9.5.0
            *free_it* parameter.
            *clean_db* parameter.

    """

    self._remove_attribute(attr_name, free_it, clean_db)


async def __DeviceImpl__async_remove_attribute(
    self, attr_name, free_it=False, clean_db=True
):
    """

    async_remove_attribute(self, attr_name, free_it=False, clean_db=True)

        Remove one attribute from the device attribute list.

        :param attr_name: attribute name
        :type attr_name: str

        :param free_it: free Attr object flag. Default False
        :type free_it: bool

        :param clean_db: clean attribute related info in db. Default True
        :type clean_db: bool

        :raises DevFailed:

        .. versionadded:: 10.0.0

    """

    await get_worker().delegate(self._remove_attribute, attr_name, free_it, clean_db)


def __DeviceImpl__add_command(self, cmd, device_level=True):
    """
    add_command(self, cmd, device_level=True) -> cmd

        Add a new command to the device command list.

        :param cmd: the new command to be added to the list
        :param device_level: Set this flag to true if the command must be added
                             for only this device

        :returns: The command to add
        :rtype: Command

        :raises DevFailed:
    """
    config = dict(cmd.__tango_command__[1][2])
    disp_level = DispLevel.OPERATOR

    cmd_name = cmd.__name__

    # default values
    fisallowed = "is_{0}_allowed".format(cmd_name)
    fisallowed_green_mode = True

    if config:
        if "Display level" in config:
            disp_level = config["Display level"]

        if "Is allowed" in config:
            fisallowed = config["Is allowed"]

        fisallowed_green_mode = config["Is allowed green_mode"]

    if is_pure_str(fisallowed):
        fisallowed = getattr(self, fisallowed, None)

    if fisallowed is not None:
        fisallowed_name = (
            f"__wrapped_{getattr(fisallowed, '__name__', f'is_{cmd_name}_allowed')}__"
        )
        __patch_device_with_dynamic_command_is_allowed_method(
            self, fisallowed_name, fisallowed, fisallowed_green_mode
        )
    else:
        fisallowed_name = ""

    setattr(self, cmd_name, cmd)

    self._add_command(
        cmd_name, cmd.__tango_command__[1], fisallowed_name, disp_level, device_level
    )
    return cmd


def __patch_device_with_dynamic_command_method(device, name, method):
    if __is_device_method(device, method):

        @functools.wraps(method)
        def wrapped_command_method(device, *args):
            worker = get_worker()
            # already bound to device, so exclude device arg
            return worker.execute(method, *args)

    else:

        @functools.wraps(method)
        def wrapped_command_method(device, *args):
            worker = get_worker()
            # unbound function or not on device object, so include device arg
            return worker.execute(method, device, *args)

    bound_method = types.MethodType(wrapped_command_method, device)
    setattr(device, name, bound_method)


def __patch_device_with_dynamic_command_is_allowed_method(
    device, name, is_allo_meth, green_mode
):
    if __is_device_method(device, is_allo_meth):
        if green_mode:

            @functools.wraps(is_allo_meth)
            def is_allowed_cmd(device):
                worker = get_worker()
                # already bound to device, so exclude device arg
                return worker.execute(is_allo_meth)

        else:
            is_allowed_cmd = is_allo_meth

    else:
        if green_mode:

            @functools.wraps(is_allo_meth)
            def is_allowed_cmd(device):
                worker = get_worker()
                # unbound function or not on device object, so include device arg
                return worker.execute(is_allo_meth, device)

        else:

            @functools.wraps(is_allo_meth)
            def is_allowed_cmd(device):
                # unbound function or not on device object, so include device arg
                return is_allo_meth(device)

    if _force_tracing:
        is_allowed_cmd = _forcefully_traced_method(is_allowed_cmd)

    bound_method = types.MethodType(is_allowed_cmd, device)
    setattr(device, name, bound_method)


def __DeviceImpl__remove_command(self, cmd_name, free_it=False, clean_db=True):
    """
    remove_command(self, cmd_name, free_it=False, clean_db=True)

        Remove one command from the device command list.

        :param cmd_name: command name to be removed from the list
        :type cmd_name: str
        :param free_it: set to true if the command object must be freed.
        :type free_it: bool
        :param clean_db: Clean command related information (included polling info
                         if the command is polled) from database.

        :raises DevFailed:
    """
    self._remove_command(cmd_name, free_it, clean_db)


def __DeviceImpl__debug_stream(self, msg, *args, source=None):
    """
    debug_stream(self, msg, *args, source=None)

        Sends the given message to the tango debug stream.

        Since PyTango 7.1.3, the same can be achieved with::

            print(msg, file=self.log_debug)

        :param msg: the message to be sent to the debug stream
        :type msg: str

        :param \\*args: Arguments to format a message string.

        :param source: Function that will be inspected for filename and lineno in the log message.
        :type source: Callable

        .. versionadded:: 9.4.2
            added *source* parameter
    """
    filename, line = get_source_location(source)
    if args:
        msg = msg % args
    self.__debug_stream(filename, line, msg)


def __DeviceImpl__info_stream(self, msg, *args, source=None):
    """
    info_stream(self, msg, *args, source=None)

        Sends the given message to the tango info stream.

        Since PyTango 7.1.3, the same can be achieved with::

            print(msg, file=self.log_info)

        :param msg: the message to be sent to the info stream
        :type msg: str

        :param \\*args: Arguments to format a message string.

        :param source: Function that will be inspected for filename and lineno in the log message.
        :type source: Callable

        .. versionadded:: 9.4.2
            added *source* parameter
    """
    filename, line = get_source_location(source)
    if args:
        msg = msg % args
    self.__info_stream(filename, line, msg)


def __DeviceImpl__warn_stream(self, msg, *args, source=None):
    """
    warn_stream(self, msg, *args, source=None)

        Sends the given message to the tango warn stream.

        Since PyTango 7.1.3, the same can be achieved with::

            print(msg, file=self.log_warn)

        :param msg: the message to be sent to the warn stream
        :type msg: str

        :param \\*args: Arguments to format a message string.

        :param source: Function that will be inspected for filename and lineno in the log message.
        :type source: Callable

        .. versionadded:: 9.4.2
            added *source* parameter
    """
    filename, line = get_source_location(source)
    if args:
        msg = msg % args
    self.__warn_stream(filename, line, msg)


def __DeviceImpl__error_stream(self, msg, *args, source=None):
    """
    error_stream(self, msg, *args, source=None)

        Sends the given message to the tango error stream.

        Since PyTango 7.1.3, the same can be achieved with::

            print(msg, file=self.log_error)

        :param msg: the message to be sent to the error stream
        :type msg: str

        :param \\*args: Arguments to format a message string.

        :param source: Function that will be inspected for filename and lineno in the log message.
        :type source: Callable

        .. versionadded:: 9.4.2
            added *source* parameter
    """
    filename, line = get_source_location(source)
    if args:
        msg = msg % args
    self.__error_stream(filename, line, msg)


def __DeviceImpl__fatal_stream(self, msg, *args, source=None):
    """
    fatal_stream(self, msg, *args, source=None)

        Sends the given message to the tango fatal stream.

        Since PyTango 7.1.3, the same can be achieved with::

            print(msg, file=self.log_fatal)

        :param msg: the message to be sent to the fatal stream
        :type msg: str

        :param \\*args: Arguments to format a message string.

        :param source: Function that will be inspected for filename and lineno in the log message.
        :type source: Callable

        .. versionadded:: 9.4.2
            added *source* parameter
    """
    filename, line = get_source_location(source)
    if args:
        msg = msg % args
    self.__fatal_stream(filename, line, msg)


@property
def __DeviceImpl__debug(self):
    if not hasattr(self, "_debug_s"):
        self._debug_s = TangoStream(self.debug_stream)
    return self._debug_s


@property
def __DeviceImpl__info(self):
    if not hasattr(self, "_info_s"):
        self._info_s = TangoStream(self.info_stream)
    return self._info_s


@property
def __DeviceImpl__warn(self):
    if not hasattr(self, "_warn_s"):
        self._warn_s = TangoStream(self.warn_stream)
    return self._warn_s


@property
def __DeviceImpl__error(self):
    if not hasattr(self, "_error_s"):
        self._error_s = TangoStream(self.error_stream)
    return self._error_s


@property
def __DeviceImpl__fatal(self):
    if not hasattr(self, "_fatal_s"):
        self._fatal_s = TangoStream(self.fatal_stream)
    return self._fatal_s


def __DeviceImpl__str(self):
    dev_name = "unknown"
    try:
        util = Util.instance(False)
        if not util.is_svr_starting() and not util.is_svr_shutting_down():
            dev_name = self.get_name()
    except DevFailed:
        pass  # Util singleton hasn't been initialised yet
    return f"{self.__class__.__name__}({dev_name})"


def __event_exception_converter(*args, **kwargs):
    args = list(args)
    exception = None

    if len(args) and isinstance(args[0], Exception):
        exception = args[0]
    elif "except" in kwargs:
        exception = kwargs.pop("except")

    # if user managed to create DevFailed, we do not need ot convert it
    if exception and not isinstance(exception, DevFailed):
        if exception.__traceback__ is None:
            # to generate DevFailed we need traceback
            # if user does not provide one (Exception.with_traceback), we generate our
            try:
                raise Exception()
            except Exception:
                # to get to the frame, where user called push_event
                traceback = sys.exc_info()[2]
                try:
                    user_frame = traceback.tb_frame.f_back.f_back
                    exception.__traceback__ = types.TracebackType(
                        None, user_frame, user_frame.f_lasti, user_frame.f_lineno
                    )
                except Exception:
                    # if fails, use what we have
                    exception.__traceback__ = traceback
        args[0] = Except.to_dev_failed(
            exception.__class__, exception, exception.__traceback__
        )
    return args, kwargs


def __DeviceImpl__push_change_event(self, attr_name, *args, **kwargs):
    """
    .. function:: push_change_event(self, attr_name, except)
                  push_change_event(self, attr_name, data, dim_x = 1, dim_y = 0)
                  push_change_event(self, attr_name, str_data, data)
                  push_change_event(self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0)
                  push_change_event(self, attr_name, str_data, data, time_stamp, quality)
        :noindex:

    Push a change event for the given attribute name.

    :param attr_name: attribute name
    :type attr_name: str
    :param data: the data to be sent as attribute event data. Data must be compatible with the
                 attribute type and format.
                 for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements
                 compatible with the attribute type
    :param str_data: special variation for DevEncoded data type. In this case 'data' must
                     be a str or an object with the buffer interface.
    :type str_data: str
    :param except: Instead of data, you may want to send an exception.
    :type except: DevFailed
    :param dim_x: the attribute x length. Default value is 1
    :type dim_x: int
    :param dim_y: the attribute y length. Default value is 0
    :type dim_y: int
    :param time_stamp: the time stamp
    :type time_stamp: double
    :param quality: the attribute quality factor
    :type quality: AttrQuality

    :raises DevFailed: If the attribute data type is not coherent.
    """
    args, kwargs = __event_exception_converter(*args, **kwargs)
    self.__push_change_event(attr_name, *args, **kwargs)


def __DeviceImpl__push_alarm_event(self, attr_name, *args, **kwargs):
    """
    .. function:: push_alarm_event(self, attr_name, except)
                  push_alarm_event(self, attr_name, data, dim_x = 1, dim_y = 0)
                  push_alarm_event(self, attr_name, str_data, data)
                  push_alarm_event(self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0)
                  push_alarm_event(self, attr_name, str_data, data, time_stamp, quality)
        :noindex:

    Push an alarm event for the given attribute name.

    :param attr_name: attribute name
    :type attr_name: str
    :param data: the data to be sent as attribute event data. Data must be compatible with the
                 attribute type and format.
                 for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements
                 compatible with the attribute type
    :param str_data: special variation for DevEncoded data type. In this case 'data' must
                     be a str or an object with the buffer interface.
    :type str_data: str
    :param except: Instead of data, you may want to send an exception.
    :type except: DevFailed
    :param dim_x: the attribute x length. Default value is 1
    :type dim_x: int
    :param dim_y: the attribute y length. Default value is 0
    :type dim_y: int
    :param time_stamp: the time stamp
    :type time_stamp: double
    :param quality: the attribute quality factor
    :type quality: AttrQuality

    :raises DevFailed: If the attribute data type is not coherent.
    """
    args, kwargs = __event_exception_converter(*args, **kwargs)
    self.__push_alarm_event(attr_name, *args, **kwargs)


def __DeviceImpl__push_archive_event(self, attr_name, *args, **kwargs):
    """
    .. function:: push_archive_event(self, attr_name, except)
                  push_archive_event(self, attr_name, data, dim_x = 1, dim_y = 0)
                  push_archive_event(self, attr_name, str_data, data)
                  push_archive_event(self, attr_name, data, time_stamp, quality, dim_x = 1, dim_y = 0)
                  push_archive_event(self, attr_name, str_data, data, time_stamp, quality)
        :noindex:

    Push an archive event for the given attribute name.

    :param attr_name: attribute name
    :type attr_name: str
    :param data: the data to be sent as attribute event data. Data must be compatible with the
                 attribute type and format.
                 for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements
                 compatible with the attribute type
    :param str_data: special variation for DevEncoded data type. In this case 'data' must
                     be a str or an object with the buffer interface.
    :type str_data: str
    :param except: Instead of data, you may want to send an exception.
    :type except: DevFailed
    :param dim_x: the attribute x length. Default value is 1
    :type dim_x: int
    :param dim_y: the attribute y length. Default value is 0
    :type dim_y: int
    :param time_stamp: the time stamp
    :type time_stamp: double
    :param quality: the attribute quality factor
    :type quality: AttrQuality

    :raises DevFailed: If the attribute data type is not coherent.
    """
    args, kwargs = __event_exception_converter(*args, **kwargs)
    self.__push_archive_event(attr_name, *args, **kwargs)


def __DeviceImpl__push_event(self, attr_name, filt_names, filt_vals, *args, **kwargs):
    """
    .. function:: push_event(self, attr_name, filt_names, filt_vals, except)
                  push_event(self, attr_name, filt_names, filt_vals, data, dim_x = 1, dim_y = 0)
                  push_event(self, attr_name, filt_names, filt_vals, str_data, data)
                  push_event(self, attr_name, filt_names, filt_vals, data, time_stamp, quality, dim_x = 1, dim_y = 0)
                  push_event(self, attr_name, filt_names, filt_vals, str_data, data, time_stamp, quality)
        :noindex:

    Push a user event for the given attribute name.

    :param attr_name: attribute name
    :type attr_name: str
    :param filt_names: unused (kept for backwards compatibility) - pass an empty list.
    :type filt_names: Sequence[str]
    :param filt_vals: unused (kept for backwards compatibility) - pass an empty list.
    :type filt_vals: Sequence[double]
    :param data: the data to be sent as attribute event data. Data must be compatible with the
                 attribute type and format.
                 for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements
                 compatible with the attribute type
    :param str_data: special variation for DevEncoded data type. In this case 'data' must
                     be a str or an object with the buffer interface.
    :type str_data: str
    :param dim_x: the attribute x length. Default value is 1
    :type dim_x: int
    :param dim_y: the attribute y length. Default value is 0
    :type dim_y: int
    :param time_stamp: the time stamp
    :type time_stamp: double
    :param quality: the attribute quality factor
    :type quality: AttrQuality

    :raises DevFailed: If the attribute data type is not coherent.
    """
    args, kwargs = __event_exception_converter(*args, **kwargs)
    self.__push_event(attr_name, filt_names, filt_vals, *args, **kwargs)


def __DeviceImpl__set_telemetry_enabled(self, enabled: bool):
    """
    set_telemetry_enabled(self, enabled) -> None

        Enable or disable the device's telemetry interface.

        This is a no-op if telemetry support isn't compiled into cppTango.

        :param enabled: True to enable telemetry tracing
        :type enabled: bool

        .. versionadded:: 10.0.0
    """
    if enabled:
        self._enable_telemetry()
    else:
        self._disable_telemetry()


def __DeviceImpl__set_kernel_tracing_enabled(self, enabled: bool):
    """
    set_kernel_tracing_enabled(self, enabled) -> None

        Enable or disable telemetry tracing of cppTango kernel methods, and
        for high-level PyTango devices, tracing of the PyTango kernel (BaseDevice)
        methods.

        This is a no-op if telemetry support isn't compiled into cppTango.

        :param enabled: True to enable kernel tracing
        :type enabled: bool

        .. versionadded:: 10.0.0
    """
    if enabled:
        self._enable_kernel_traces()
    else:
        self._disable_kernel_traces()


def __init_DeviceImpl():
    DeviceImpl._device_class_instance = None
    DeviceImpl.get_device_class = __DeviceImpl__get_device_class
    DeviceImpl.get_device_properties = __DeviceImpl__get_device_properties
    DeviceImpl.add_attribute = __DeviceImpl__add_attribute
    DeviceImpl.remove_attribute = __DeviceImpl__remove_attribute
    DeviceImpl.add_command = __DeviceImpl__add_command
    DeviceImpl.remove_command = __DeviceImpl__remove_command
    DeviceImpl.async_add_attribute = __DeviceImpl__async_add_attribute
    DeviceImpl.async_remove_attribute = __DeviceImpl__async_remove_attribute
    DeviceImpl.__str__ = __DeviceImpl__str
    DeviceImpl.__repr__ = __DeviceImpl__str
    DeviceImpl.debug_stream = __DeviceImpl__debug_stream
    DeviceImpl.info_stream = __DeviceImpl__info_stream
    DeviceImpl.warn_stream = __DeviceImpl__warn_stream
    DeviceImpl.error_stream = __DeviceImpl__error_stream
    DeviceImpl.fatal_stream = __DeviceImpl__fatal_stream
    DeviceImpl.log_debug = __DeviceImpl__debug
    DeviceImpl.log_info = __DeviceImpl__info
    DeviceImpl.log_warn = __DeviceImpl__warn
    DeviceImpl.log_error = __DeviceImpl__error
    DeviceImpl.log_fatal = __DeviceImpl__fatal
    DeviceImpl.push_change_event = __DeviceImpl__push_change_event
    DeviceImpl.push_alarm_event = __DeviceImpl__push_alarm_event
    DeviceImpl.push_archive_event = __DeviceImpl__push_archive_event
    DeviceImpl.push_event = __DeviceImpl__push_event
    DeviceImpl.set_telemetry_enabled = __DeviceImpl__set_telemetry_enabled
    DeviceImpl.set_kernel_tracing_enabled = __DeviceImpl__set_kernel_tracing_enabled


def __Logger__log(self, level, msg, *args):
    """
    log(self, level, msg, *args)

        Sends the given message to the tango the selected stream.

        :param level: Log level
        :type level: Level.LevelLevel
        :param msg: the message to be sent to the stream
        :type msg: str
        :param args: list of optional message arguments
        :type args: Sequence[str]
    """
    filename, line = get_source_location()
    if args:
        msg = msg % args
    self.__log(filename, line, level, msg)


def __Logger__log_unconditionally(self, level, msg, *args):
    """
    log_unconditionally(self, level, msg, *args)

        Sends the given message to the tango the selected stream,
        without checking the level.

        :param level: Log level
        :type level: Level.LevelLevel
        :param msg: the message to be sent to the stream
        :type msg: str
        :param args: list of optional message arguments
        :type args: Sequence[str]
    """
    filename, line = get_source_location()
    if args:
        msg = msg % args
    self.__log_unconditionally(filename, line, level, msg)


def __Logger__debug(self, msg, *args):
    """
    debug(self, msg, *args)

        Sends the given message to the tango debug stream.

        :param msg: the message to be sent to the debug stream
        :type msg: str
        :param args: list of optional message arguments
        :type args: Sequence[str]
    """
    filename, line = get_source_location()
    if args:
        msg = msg % args
    self.__debug(filename, line, msg)


def __Logger__info(self, msg, *args):
    """
    info(self, msg, *args)

        Sends the given message to the tango info stream.

        :param msg: the message to be sent to the info stream
        :type msg: str
        :param args: list of optional message arguments
        :type args: Sequence[str]
    """
    filename, line = get_source_location()
    if args:
        msg = msg % args
    self.__info(filename, line, msg)


def __Logger__warn(self, msg, *args):
    """
    warn(self, msg, *args)

        Sends the given message to the tango warn stream.

        :param msg: the message to be sent to the warn stream
        :type msg: str
        :param args: list of optional message arguments
        :type args: Sequence[str]
    """
    filename, line = get_source_location()
    if args:
        msg = msg % args
    self.__warn(filename, line, msg)


def __Logger__error(self, msg, *args):
    """
    error(self, msg, *args)

        Sends the given message to the tango error stream.

        :param msg: the message to be sent to the error stream
        :type msg: str
        :param args: list of optional message arguments
        :type args: Sequence[str]
    """
    filename, line = get_source_location()
    if args:
        msg = msg % args
    self.__error(filename, line, msg)


def __Logger__fatal(self, msg, *args):
    """
    fatal(self, msg, *args)

        Sends the given message to the tango fatal stream.

        :param msg: the message to be sent to the fatal stream
        :type msg: str
        :param args: list of optional message arguments
        :type args: Sequence[str]
    """
    filename, line = get_source_location()
    if args:
        msg = msg % args
    self.__fatal(filename, line, msg)


def __UserDefaultAttrProp_set_enum_labels(self, enum_labels):
    """
    set_enum_labels(self, enum_labels)

        Set default enumeration labels.

        :param enum_labels: list of enumeration labels
        :type enum_labels: Sequence[str]

        New in PyTango 9.2.0
    """
    elbls = StdStringVector()
    for enu in enum_labels:
        elbls.append(enu)
    return self._set_enum_labels(elbls)


def __Attr__str(self):
    return f"{self.__class__.__name__}({self.get_name()})"


def __init_Attr():
    Attr.__str__ = __Attr__str
    Attr.__repr__ = __Attr__str


def __init_UserDefaultAttrProp():
    UserDefaultAttrProp.set_enum_labels = __UserDefaultAttrProp_set_enum_labels


def __init_Logger():
    Logger.log = __Logger__log
    Logger.log_unconditionally = __Logger__log_unconditionally
    Logger.debug = __Logger__debug
    Logger.info = __Logger__info
    Logger.warning = __Logger__warn
    Logger.error = __Logger__error
    Logger.fatal = __Logger__fatal

    # kept for backward compatibility
    Logger.warn = __Logger__warn


def __doc_DeviceImpl():
    def document_method(method_name, desc, append=True):
        return __document_method(DeviceImpl, method_name, desc, append)

    DeviceImpl.__doc__ = """
    Base class for all TANGO device.

    This class inherits from CORBA classes where all the network layer is implemented.
    """

    document_method(
        "init_device",
        """
    init_device(self)

        Code to handle device initialisation.

        This method is called automatically when the device starts,
        but before it is available to clients (i.e., before it is "exported").
        It also gets called if the device is re-initialised by a call to the
        ``Init`` command (after :meth:`~tango.LatestDeviceImpl.delete_device`).
    """,
    )

    document_method(
        "set_state",
        """
    set_state(self, new_state)

        Set device state.

        :param new_state: the new device state
        :type new_state: DevState
    """,
    )

    document_method(
        "get_state",
        """
    get_state(self) -> DevState

        Get a COPY of the device state.

        :returns: Current device state
        :rtype: DevState
    """,
    )

    document_method(
        "get_prev_state",
        """
    get_prev_state(self) -> DevState

        Get a COPY of the device's previous state.

        :returns: the device's previous state
        :rtype: DevState
    """,
    )

    document_method(
        "get_name",
        """
    get_name(self) -> (str)

        Get a COPY of the device name.

        :returns: the device name
        :rtype: str
    """,
    )

    document_method(
        "get_device_attr",
        """
    get_device_attr(self) -> MultiAttribute

        Get device multi attribute object.

        :returns: the device's MultiAttribute object
        :rtype: MultiAttribute
    """,
    )

    document_method(
        "register_signal",
        """
    register_signal(self, signo)

        Register a signal.

        Register this device as device to be informed when signal signo
        is sent to to the device server process

        :param signo: signal identifier
        :type signo: int
    """,
    )

    document_method(
        "unregister_signal",
        """
    unregister_signal(self, signo)

        Unregister a signal.

        Unregister this device as device to be informed when signal signo
        is sent to to the device server process

        :param signo: signal identifier
        :type signo: int
    """,
    )

    document_method(
        "get_status",
        """
    get_status(self, ) -> str

        Get a COPY of the device status.

        :returns: the device status
        :rtype: str
    """,
    )

    document_method(
        "set_status",
        """
    set_status(self, new_status)

        Set device status.

        :param new_status: the new device status
        :type new_status: str
    """,
    )

    document_method(
        "append_status",
        """
    append_status(self, status, new_line=False)

        Appends a string to the device status.

        :param status: the string to be appened to the device status
        :type status: str
        :param new_line: If true, appends a new line character before the string. Default is False
        :type new_line: bool
    """,
    )

    document_method(
        "dev_state",
        """
    dev_state(self) -> DevState

        Get device state.

        Default method to get device state. The behaviour of this method depends
        on the device state. If the device state is ON or ALARM, it reads the
        attribute(s) with an alarm level defined, check if the read value is
        above/below the alarm and eventually change the state to ALARM, return
        the device state. For all th other device state, this method simply
        returns the state This method can be redefined in sub-classes in case
        of the default behaviour does not fullfill the needs.

        :returns: the device state
        :rtype: DevState

        :raises DevFailed: If it is necessary to read attribute(s) and a problem occurs during the reading
    """,
    )

    document_method(
        "dev_status",
        """
    dev_status(self) -> str

        Get device status.

        Default method to get device status. It returns the contents of the device
        dev_status field. If the device state is ALARM, alarm messages are added
        to the device status. This method can be redefined in sub-classes in case
        of the default behaviour does not fullfill the needs.

        :returns: the device status
        :rtype: str

        :raises DevFailed: If it is necessary to read attribute(s) and a problem occurs during the reading
    """,
    )

    document_method(
        "set_change_event",
        """
    set_change_event(self, attr_name, implemented, detect=True)

        Set an implemented flag for the attribute to indicate that the server fires
        change events manually, without the polling to be started.

        If the detect parameter is set to true, the criteria specified for the
        change event are verified and the event is only pushed if they are fullfilled.
        If detect is set to false the event is fired without any value checking!

        :param attr_name: attribute name
        :type attr_name: str
        :param implemented: True when the server fires change events manually.
        :type implemented: bool
        :param detect: Triggers the verification of the change event properties
                       when set to true. Default value is true.
        :type detect: bool
    """,
    )

    document_method(
        "set_archive_event",
        """
    set_archive_event(self, attr_name, implemented, detect=True)

        Set an implemented flag for the attribute to indicate that the server fires
        archive events manually, without the polling to be started.

        If the detect parameter is set to true, the criteria specified for the
        archive event are verified and the event is only pushed if they are fullfilled.
        If detect is set to false the event is fired without any value checking!

        :param attr_name: attribute name
        :type attr_name: str
        :param implemented: True when the server fires change events manually.
        :type implemented: bool
        :param detect: Triggers the verification of the change event properties
                       when set to true. Default value is true.
        :type detect: bool
    """,
    )

    document_method(
        "set_data_ready_event",
        """
    set_data_ready_event(self, attr_name, implemented)

        Set an implemented flag for the attribute to indicate that the server fires
        data ready events manually.

        :param attr_name: attribute name
        :type attr_name: str
        :param implemented: True when the server fires change events manually.
        :type implemented: bool
    """,
    )

    document_method(
        "push_data_ready_event",
        """
    push_data_ready_event(self, attr_name, counter)

        Push a data ready event for the given attribute name.

        The method needs the attribute name and a
        "counter" which will be passed within the event

        :param attr_name: attribute name
        :type attr_name: str
        :param counter: the user counter
        :type counter: int

        :raises DevFailed: If the attribute name is unknown.
    """,
    )

    document_method(
        "push_pipe_event",
        """
    push_pipe_event(self, pipe_name, except)

        .. function:: push_pipe_event(self, pipe_name, blob, reuse_it)
                      push_pipe_event(self, pipe_name, blob, timeval, reuse_it)
            :noindex:

        Push a pipe event for the given blob.

        :param pipe_name: pipe name
        :type pipe_name: str
        :param blob: the blob data
        :type blob: DevicePipeBlob

        :raises DevFailed: If the pipe name is unknown.

        New in PyTango 9.2.2
    """,
    )

    document_method(
        "get_logger",
        """
    get_logger(self) -> Logger

        Returns the Logger object for this device

        :returns: the Logger object for this device
        :rtype: Logger
    """,
    )

    document_method(
        "init_logger",
        """
    init_logger(self) -> None

        Setups logger for the device.  Called automatically when device starts.
    """,
    )

    document_method(
        "start_logging",
        """
    start_logging(self) -> None

        Starts logging
    """,
    )

    document_method(
        "stop_logging",
        """
    stop_logging(self) -> None

        Stops logging
    """,
    )

    document_method(
        "is_telemetry_enabled",
        """
    is_telemetry_enabled(self) -> bool

        Indicates if telemetry tracing is enabled for the device.

        Always False if telemetry support isn't compiled into cppTango.

        :returns: if device telemetry tracing is enabled
        :rtype: bool

        .. versionadded:: 10.0.0
    """,
    )

    document_method(
        "is_kernel_tracing_enabled",
        """
    is_kernel_tracing_enabled(self) -> bool

        Indicates if telemetry tracing of the cppTango kernel API is enabled.

        Always False if telemetry support isn't compiled into cppTango.

        :returns: if kernel tracing is enabled
        :rtype: bool

        .. versionadded:: 10.0.0
    """,
    )

    document_method(
        "get_exported_flag",
        """
    get_exported_flag(self) -> bool

        Returns the state of the exported flag

        :returns: the state of the exported flag
        :rtype: bool

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "is_attribute_polled",
        """
    is_attribute_polled(self, attr_name) -> bool

        True if the attribute is polled.

        :param str attr_name: attribute name

        :return: True if the attribute is polled
        :rtype: bool
    """,
    )

    document_method(
        "is_command_polled",
        """
    is_command_polled(self, cmd_name) -> bool

        True if the command is polled.

        :param str cmd_name: attribute name

        :return: True if the command is polled
        :rtype: bool
    """,
    )

    document_method(
        "poll_attribute",
        """
    poll_attribute(self, attr_name, period) -> None

        Add an attribute to the list of polled attributes.

        :param str attr_name: attribute name

        :param int period: polling period in milliseconds

        :return: None
        :rtype: None
    """,
    )

    document_method(
        "poll_command",
        """
    poll_command(self, cmd_name, period) -> None

        Add a command to the list of polled commands.

        :param str cmd_name: attribute name

        :param int period: polling period in milliseconds

        :return: None
        :rtype: None
    """,
    )

    document_method(
        "stop_poll_attribute",
        """
    stop_poll_attribute(self, attr_name) -> None

        Remove an attribute from the list of polled attributes.

        :param str attr_name: attribute name

        :return: None
        :rtype: None
    """,
    )

    document_method(
        "stop_poll_command",
        """
    stop_poll_command(self, cmd_name) -> None

        Remove a command from the list of polled commands.

        :param str cmd_name: cmd_name name

        :return: None
        :rtype: None
    """,
    )

    document_method(
        "get_poll_ring_depth",
        """
    get_poll_ring_depth(self) -> int

        Returns the poll ring depth

        :returns: the poll ring depth
        :rtype: int

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_poll_old_factor",
        """
    get_poll_old_factor(self) -> int

        Returns the poll old factor

        :returns: the poll old factor
        :rtype: int

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "is_polled",
        """
    is_polled(self) -> bool

        Returns if it is polled

        :returns: True if it is polled or False otherwise
        :rtype: bool

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_polled_cmd",
        """
    get_polled_cmd(self) -> Sequence[str]

        Returns a COPY of the list of polled commands

        :returns: a COPY of the list of polled commands
        :rtype: Sequence[str]

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_polled_attr",
        """
    get_polled_attr(self) -> Sequence[str]

        Returns a COPY of the list of polled attributes

        :returns: a COPY of the list of polled attributes
        :rtype: Sequence[str]

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_non_auto_polled_cmd",
        """
    get_non_auto_polled_cmd(self) -> Sequence[str]

        Returns a COPY of the list of non automatic polled commands

        :returns: a COPY of the list of non automatic polled commands
        :rtype: Sequence[str]

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_non_auto_polled_attr",
        """
    get_non_auto_polled_attr(self) -> Sequence[str]

        Returns a COPY of the list of non automatic polled attributes

        :returns: a COPY of the list of non automatic polled attributes
        :rtype: Sequence[str]

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "stop_polling",
        """
    stop_polling(self)

        .. function:: stop_polling(self, with_db_upd)
            :noindex:

        Stop all polling for a device. if the device is polled, call this
        method before deleting it.

        :param with_db_upd: Is it necessary to update db?
        :type with_db_upd: bool

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_attribute_poll_period",
        """
    get_attribute_poll_period(self, attr_name) -> int

        Returns the attribute polling period (ms) or 0 if the attribute
        is not polled.

        :param attr_name: attribute name
        :type attr_name: str

        :returns: attribute polling period (ms) or 0 if it is not polled
        :rtype: int

        New in PyTango 8.0.0
    """,
    )

    document_method(
        "get_attribute_config",
        """
    get_attribute_config(self, attr_names) -> list[DeviceAttributeConfig]

        Returns the list of AttributeConfig for the requested names

        :param attr_names: sequence of str with attribute names
        :type attr_names: list[str]

        :returns: :class:`tango.DeviceAttributeConfig` for each requested attribute name
        :rtype: list[:class:`tango.DeviceAttributeConfig`]
    """,
    )

    document_method(
        "get_command_poll_period",
        """
    get_command_poll_period(self, cmd_name) -> int

        Returns the command polling period (ms) or 0 if the command
        is not polled.

        :param cmd_name: command name
        :type cmd_name: str

        :returns: command polling period (ms) or 0 if it is not polled
        :rtype: int

        New in PyTango 8.0.0
    """,
    )

    document_method(
        "check_command_exists",
        """
    check_command_exists(self)

        Check that a command is supported by the device and
        does not need input value.

        The method throws an exception if the
        command is not defined or needs an input value.

        :param cmd_name: the command name
        :type cmd_name: str

        :raises DevFailed:
        :raises API_IncompatibleCmdArgumentType:
        :raises API_CommandNotFound:

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_dev_idl_version",
        """
    get_dev_idl_version(self) -> int

        Returns the IDL version.

        :returns: the IDL version
        :rtype: int

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_cmd_poll_ring_depth",
        """
    get_cmd_poll_ring_depth(self, cmd_name) -> int

        Returns the command poll ring depth.

        :param cmd_name: the command name
        :type cmd_name: str

        :returns: the command poll ring depth
        :rtype: int

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_attr_poll_ring_depth",
        """
    get_attr_poll_ring_depth(self, attr_name) -> int

        Returns the attribute poll ring depth.

        :param attr_name: the attribute name
        :type attr_name: str

        :returns: the attribute poll ring depth
        :rtype: int

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "is_device_locked",
        """
    is_device_locked(self) -> bool

        Returns if this device is locked by a client.

        :returns: True if it is locked or False otherwise
        :rtype: bool

        New in PyTango 7.1.2
    """,
    )

    document_method(
        "get_min_poll_period",
        """
    get_min_poll_period(self) -> int

        Returns the min poll period.

        :returns: the min poll period
        :rtype: int

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "get_cmd_min_poll_period",
        """
    get_cmd_min_poll_period(self) -> Sequence[str]

        Returns the min command poll period.

        :returns: the min command poll period
        :rtype: Sequence[str]

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "get_attr_min_poll_period",
        """
    get_attr_min_poll_period(self) -> Sequence[str]

        Returns the min attribute poll period

        :returns: the min attribute poll period
        :rtype: Sequence[str]

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "push_att_conf_event",
        """
    push_att_conf_event(self, attr)

        Push an attribute configuration event.

        :param attr: the attribute for which the configuration event
                     will be sent.
        :type attr: Attribute

        New in PyTango 7.2.1
    """,
    )

    document_method(
        "push_pipe_event",
        """
    push_pipe_event(self, blob)

        Push an pipe event.

        :param blob: the blob which pipe event will be send.

        New in PyTango 9.2.2
    """,
    )

    document_method(
        "is_there_subscriber",
        """
    is_there_subscriber(self, att_name, event_type) -> bool

        Check if there is subscriber(s) listening for the event.

        This method returns a boolean set to true if there are some
        subscriber(s) listening on the event specified by the two method
        arguments. Be aware that there is some delay (up to 600 sec)
        between this method returning false and the last subscriber
        unsubscription or crash...

        The device interface change event is not supported by this method.

        :param att_name: the attribute name
        :type att_name: str
        :param event_type: the event type
        :type event_type: EventType

        :returns: True if there is at least one listener or False otherwise
        :rtype: bool
    """,
    )

    document_method(
        "get_version_info",
        """
    get_version_info(self) -> dict

        Returns a dict with versioning of different modules related to the
        pytango device.

        Example:
            {
                "Build.PyTango.Boost": "1.84.0",
                "Build.PyTango.NumPy": "1.26.4",
                "Build.PyTango.Python": "3.12.2",
                "Build.PyTango.cppTango":"10.0.0",
                "NumPy": "1.26.4",
                "PyTango": "10.0.0.dev0",
                "Python": "3.12.2",
                "cppTango": "10.0.0",
                "omniORB": "4.3.2",
                "zmq": "4.3.5"
            }


        :returns: modules version dict
        :rtype: dict

        .. versionadded:: 10.0.0
    """,
    )

    document_method(
        "add_version_info",
        """
    add_version_info(self, key, value) -> dict

        Method to add information about the module version a device is using

        :param key: Module name
        :type key: str

        :param value: Module version, or other relevant information.
        :type value: str

        .. versionadded:: 10.0.0
    """,
    )


def __doc_extra_DeviceImpl(cls):
    def document_method(method_name, desc, append=True):
        return __document_method(cls, method_name, desc, append)

    document_method(
        "delete_device",
        """
    delete_device(self)

        Code to handle device clean-up.

        This method is called automatically when the device is shut down gracefully.
        It also gets called if the device is re-initialised by a call to the ``Init``
        command (before a new call to :meth:`~tango.LatestDeviceImpl.init_device`).
    """,
    )

    document_method(
        "always_executed_hook",
        """
    always_executed_hook(self)

        Hook method.

        Default method to implement an action necessary on a device before
        any command is executed. This method can be redefined in sub-classes
        in case of the default behaviour does not fullfill the needs

        :raises DevFailed: This method does not throw exception but a redefined method can.
    """,
    )

    document_method(
        "server_init_hook",
        """
    server_init_hook(self)

        Hook method.

        This method is called once the device server admin device is exported.
        This allows for instance for the different devices to subscribe
        to events at server startup on attributes from other devices
        of the same device server with stateless parameter set to false.

        This method can be redefined in sub-classes in case of the default
        behaviour does not fullfill the needs

        .. versionadded:: 9.4.2
    """,
    )

    document_method(
        "read_attr_hardware",
        """
    read_attr_hardware(self, attr_list)

        Read the hardware to return attribute value(s).

        Default method to implement an action necessary on a device to read
        the hardware involved in a read attribute CORBA call. This method
        must be redefined in sub-classes in order to support attribute reading

        :param attr_list: list of indices in the device object attribute vector
                          of an attribute to be read.
        :type attr_list: Sequence[int]

        :raises DevFailed: This method does not throw exception but a redefined method can.
    """,
    )

    document_method(
        "write_attr_hardware",
        """
    write_attr_hardware(self)

        Write the hardware for attributes.

        Default method to implement an action necessary on a device to write
        the hardware involved in a write attribute. This method must be
        redefined in sub-classes in order to support writable attribute

        :param attr_list: list of indices in the device object attribute vector
                          of an attribute to be written.
        :type attr_list: Sequence[int]

        :raises DevFailed: This method does not throw exception but a redefined method can.
    """,
    )

    document_method(
        "signal_handler",
        """
    signal_handler(self, signo)

        Signal handler.

        The method executed when the signal arrived in the device server process.
        This method is defined as virtual and then, can be redefined following
        device needs.

        :param signo: the signal number
        :type signo: int

        :raises DevFailed: This method does not throw exception but a redefined method can.
    """,
    )

    document_method(
        "get_attribute_config_2",
        """
    get_attribute_config_2(self, attr_names) -> list[AttributeConfig_2]

        Returns the list of AttributeConfig_2 for the requested names

        :param attr_names: sequence of str with attribute names
        :type attr_names: list[str]

        :returns: list of :class:`tango.AttributeConfig_2` for each requested attribute name
        :rtype: list[:class:`tango.AttributeConfig_2`]
    """,
    )

    document_method(
        "get_attribute_config_3",
        """
    get_attribute_config_3(self, attr_name) -> list[AttributeConfig_3]

        Returns the list of AttributeConfig_3 for the requested names

        :param attr_names: sequence of str with attribute names
        :type attr_names: list[str]

        :returns: list of :class:`tango.AttributeConfig_3` for each requested attribute name
        :rtype: list[:class:`tango.AttributeConfig_3`]
    """,
    )

    document_method(
        "set_attribute_config",
        """
    set_attribute_config(self, new_conf) -> None

        Sets attribute configuration locally and in the Tango database

        :param new_conf: The new attribute(s) configuration. One AttributeConfig structure is needed for each attribute to update
        :type new_conf: list[:class:`tango.AttributeConfig`]

        :returns: None
        :rtype: None

        .. versionadded:: 10.0.0
    """,
    )

    document_method(
        "set_attribute_config_3",
        """
    set_attribute_config_3(self, new_conf) -> None

        Sets attribute configuration locally and in the Tango database

        :param new_conf: The new attribute(s) configuration. One AttributeConfig structure is needed for each attribute to update
        :type new_conf: list[:class:`tango.AttributeConfig_3`]

        :returns: None
        :rtype: None
    """,
    )

    copy_doc(cls, "dev_state")
    copy_doc(cls, "dev_status")


def __doc_Attribute():
    def document_method(method_name, desc, append=True):
        return __document_method(Attribute, method_name, desc, append)

    Attribute.__doc__ = """
    This class represents a Tango attribute.
    """

    document_method(
        "is_write_associated",
        """
    is_write_associated(self) -> bool

        Check if the attribute has an associated writable attribute.

        :returns: True if there is an associated writable attribute
        :rtype: bool
    """,
    )

    document_method(
        "is_min_alarm",
        """
    is_min_alarm(self) -> bool

        Check if the attribute is in minimum alarm condition.

        :returns: true if the attribute is in alarm condition (read value below the min. alarm).
        :rtype: bool
    """,
    )

    document_method(
        "is_max_alarm",
        """
    is_max_alarm(self) -> bool

        Check if the attribute is in maximum alarm condition.

        :returns: true if the attribute is in alarm condition (read value above the max. alarm).
        :rtype: bool
    """,
    )

    document_method(
        "is_min_warning",
        """
    is_min_warning(self) -> bool

        Check if the attribute is in minimum warning condition.

        :returns: true if the attribute is in warning condition (read value below the min. warning).
        :rtype: bool
    """,
    )

    document_method(
        "is_max_warning",
        """
    is_max_warning(self) -> bool

        Check if the attribute is in maximum warning condition.

        :returns: true if the attribute is in warning condition (read value above the max. warning).
        :rtype: bool
    """,
    )

    document_method(
        "is_rds_alarm",
        """
    is_rds_alarm(self) -> bool

        Check if the attribute is in RDS alarm condition.

        :returns: true if the attribute is in RDS condition (Read Different than Set).
        :rtype: bool
    """,
    )

    document_method(
        "is_polled",
        """
    is_polled(self) -> bool

        Check if the attribute is polled.

        :returns: true if the attribute is polled.
        :rtype: bool
    """,
    )

    document_method(
        "check_alarm",
        """
    check_alarm(self) -> bool

        Check if the attribute read value is below/above the alarm level.

        :returns: true if the attribute is in alarm condition.
        :rtype: bool

        :raises DevFailed: If no alarm level is defined.
    """,
    )

    document_method(
        "get_writable",
        """
    get_writable(self) -> AttrWriteType

        Get the attribute writable type (RO/WO/RW).

        :returns: The attribute write type.
        :rtype: AttrWriteType
    """,
    )

    document_method(
        "get_name",
        """
    get_name(self) -> str

        Get attribute name.

        :returns: The attribute name
        :rtype: str
    """,
    )

    document_method(
        "get_data_type",
        """
    get_data_type(self) -> int

        Get attribute data type.

        :returns: the attribute data type
        :rtype: int
    """,
    )

    document_method(
        "get_data_format",
        """
    get_data_format(self) -> AttrDataFormat

        Get attribute data format.

        :returns: the attribute data format
        :rtype: AttrDataFormat
    """,
    )

    document_method(
        "get_assoc_name",
        """
    get_assoc_name(self) -> str

        Get name of the associated writable attribute.

        :returns: the associated writable attribute name
        :rtype: str
    """,
    )

    document_method(
        "get_assoc_ind",
        """
    get_assoc_ind(self) -> int

        Get index of the associated writable attribute.

        :returns: the index in the main attribute vector of the associated writable attribute
        :rtype: int
    """,
    )

    document_method(
        "set_assoc_ind",
        """
    set_assoc_ind(self, index)

        Set index of the associated writable attribute.

        :param index: The new index in the main attribute vector of the associated writable attribute
        :type index: int
    """,
    )

    document_method(
        "get_date",
        """
    get_date(self) -> TimeVal

        Get a COPY of the attribute date.

        :returns: the attribute date
        :rtype: TimeVal
    """,
    )

    document_method(
        "set_date",
        """
    set_date(self, new_date)

        Set attribute date.

        :param new_date: the attribute date
        :type new_date: TimeVal
    """,
    )

    document_method(
        "get_label",
        """
    get_label(self, ) -> str

        Get attribute label property.

        :returns: the attribute label
        :rtype: str
    """,
    )

    document_method(
        "get_quality",
        """
    get_quality(self) -> AttrQuality

        Get a COPY of the attribute data quality.

        :returns: the attribute data quality
        :rtype: AttrQuality
    """,
    )

    document_method(
        "set_quality",
        """
    set_quality(self, quality, send_event=False)

        Set attribute data quality.

        :param quality: the new attribute data quality
        :type quality: AttrQuality
        :param send_event: true if a change event should be sent. Default is false.
        :type send_event: bool
    """,
    )

    document_method(
        "get_data_size",
        """
    get_data_size(self)

        Get attribute data size.

        :returns: the attribute data size
        :rtype: int
    """,
    )

    document_method(
        "get_x",
        """
    get_x(self) -> int

        Get attribute data size in x dimension.

        :returns: the attribute data size in x dimension. Set to 1 for scalar attribute
        :rtype: int
    """,
    )

    document_method(
        "get_max_dim_x",
        """
    get_max_dim_x(self) -> int

        Get attribute maximum data size in x dimension.

        :returns: the attribute maximum data size in x dimension. Set to 1 for scalar attribute
        :rtype: int
    """,
    )

    document_method(
        "get_y",
        """
    get_y(self) -> int

        Get attribute data size in y dimension.

        :returns: the attribute data size in y dimension. Set to 0 for scalar attribute
        :rtype: int
    """,
    )

    document_method(
        "get_max_dim_y",
        """
    get_max_dim_y(self) -> int

        Get attribute maximum data size in y dimension.

        :returns: the attribute maximum data size in y dimension. Set to 0 for scalar attribute
        :rtype: int
    """,
    )

    document_method(
        "get_polling_period",
        """
    get_polling_period(self) -> int

        Get attribute polling period.

        :returns: The attribute polling period in mS. Set to 0 when the attribute is not polled
        :rtype: int
    """,
    )

    document_method(
        "set_attr_serial_model",
        """
    set_attr_serial_model(self, ser_model) -> void

        Set attribute serialization model.

        This method allows the user to choose the attribute serialization model.

        :param ser_model: The new serialisation model. The
                          serialization model must be one of ATTR_BY_KERNEL,
                          ATTR_BY_USER or ATTR_NO_SYNC
        :type ser_model: AttrSerialModel

        New in PyTango 7.1.0
    """,
    )

    document_method(
        "get_attr_serial_model",
        """
    get_attr_serial_model(self) -> AttrSerialModel

        Get attribute serialization model.

        :returns: The attribute serialization model
        :rtype: AttrSerialModel

        New in PyTango 7.1.0
    """,
    )

    document_method(
        "set_change_event",
        """
    set_change_event(self, implemented, detect = True)

        Set a flag to indicate that the server fires change events manually,
        without the polling to be started for the attribute.

        If the detect parameter is set to true, the criteria specified for
        the change event are verified and the event is only pushed if they
        are fullfilled. If detect is set to false the event is fired without
        any value checking!

        :param implemented: True when the server fires change events manually.
        :type implemented: bool
        :param detect: (optional, default is True) Triggers the verification of
                       the change event properties when set to true.
        :type detect: bool

        New in PyTango 7.1.0
    """,
    )

    document_method(
        "set_archive_event",
        """
    set_archive_event(self, implemented, detect = True)

        Set a flag to indicate that the server fires archive events manually,
        without the polling to be started for the attribute.

        If the detect parameter
        is set to true, the criteria specified for the archive event are verified
        and the event is only pushed if they are fullfilled.

        :param implemented: True when the server fires archive events manually.
        :type implemented: bool
        :param detect: (optional, default is True) Triggers the verification of
                       the archive event properties when set to true.
        :type detect: bool

        New in PyTango 7.1.0
    """,
    )

    document_method(
        "is_change_event",
        """
    is_change_event(self) -> bool

        Check if the change event is fired manually (without polling) for this attribute.

        :returns: True if a manual fire change event is implemented.
        :rtype: bool

        New in PyTango 7.1.0
    """,
    )

    document_method(
        "is_check_change_criteria",
        """
    is_check_change_criteria(self) -> bool

        Check if the change event criteria should be checked when firing the
        event manually.

        :returns: True if a change event criteria will be checked.
        :rtype: bool

        New in PyTango 7.1.0
    """,
    )

    document_method(
        "is_archive_event",
        """
    is_archive_event(self) -> bool

        Check if the archive event is fired manually (without polling) for this attribute.

        :returns: True if a manual fire archive event is implemented.
        :rtype: bool

        New in PyTango 7.1.0
    """,
    )

    document_method(
        "is_check_archive_criteria",
        """
    is_check_archive_criteria(self) -> bool

        Check if the archive event criteria should be checked when firing the
        event manually.

        :returns: True if a archive event criteria will be checked.
        :rtype: bool

        New in PyTango 7.1.0
    """,
    )

    document_method(
        "set_data_ready_event",
        """
    set_data_ready_event(self, implemented)

        Set a flag to indicate that the server fires data ready events.

        :param implemented: True when the server fires data ready events manually.
        :type implemented: bool

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "is_data_ready_event",
        """
    is_data_ready_event(self) -> bool

        Check if the data ready event is fired manually (without polling)
        for this attribute.

        :returns: True if a manual fire data ready event is implemented.
        :rtype: bool

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "remove_configuration",
        """
    remove_configuration(self)

        Remove the attribute configuration from the database.

        This method can be used to clean-up all the configuration of an
        attribute to come back to its default values or the remove all
        configuration of a dynamic attribute before deleting it.

        The method removes all configured attribute properties and removes
        the attribute from the list of polled attributes.

        New in PyTango 7.1.0
    """,
    )


def __doc_WAttribute():
    def document_method(method_name, desc, append=True):
        return __document_method(WAttribute, method_name, desc, append)

    WAttribute.__doc__ = """
    This class represents a Tango writable attribute.
    """

    document_method(
        "get_min_value",
        """
    get_min_value(self) -> obj

        Get attribute minimum value or throws an exception if the
        attribute does not have a minimum value.

        :returns: an object with the python minimum value
        :rtype: obj
    """,
    )

    document_method(
        "get_max_value",
        """
    get_max_value(self) -> obj

        Get attribute maximum value or throws an exception if the
        attribute does not have a maximum value.

        :returns: an object with the python maximum value
        :rtype: obj
    """,
    )

    document_method(
        "set_min_value",
        """
    set_min_value(self, data)

        Set attribute minimum value.

        :param data: the attribute minimum value. python data type must be compatible
                     with the attribute data format and type.
    """,
    )

    document_method(
        "set_max_value",
        """
    set_max_value(self, data)

        Set attribute maximum value.

        :param data: the attribute maximum value. python data type must be compatible
                     with the attribute data format and type.
    """,
    )

    document_method(
        "is_min_value",
        """
    is_min_value(self) -> bool

        Check if the attribute has a minimum value.

        :returns: true if the attribute has a minimum value defined
        :rtype: bool
    """,
    )

    document_method(
        "is_max_value",
        """
    is_max_value(self, ) -> bool

        Check if the attribute has a maximum value.

        :returns: true if the attribute has a maximum value defined
        :rtype: bool
    """,
    )

    document_method(
        "get_write_value_length",
        """
    get_write_value_length(self) -> int

        Retrieve the new value length (data number) for writable attribute.

        :returns: the new value data length
        :rtype: int
    """,
    )

    document_method(
        "set_write_value",
        """
    set_write_value(self, data, dim_x = 1, dim_y = 0)

       Set the writable attribute value.

       :param data: the data to be set. Data must be compatible with the attribute type and format.
                    for SPECTRUM and IMAGE attributes, data can be any type of sequence of elements
                    compatible with the attribute type
       :param dim_x: optional, the attribute set value x length
       :type dim_x: int
       :param dim_y: optional, the attribute set value y length
       :type dim_y: int
    """,
    )

    document_method(
        "get_write_value",
        """
    get_write_value(self, extract_as=ExtractAs.Numpy) -> obj

        Retrieve the new value for writable attribute.

        :param extract_as: defaults to ExtractAs.Numpy
        :type extract_as: ExtractAs

        :returns: the attribute write value.
        :rtype: obj
    """,
    )


def __doc_MultiClassAttribute():
    def document_method(method_name, desc, append=True):
        return __document_method(MultiClassAttribute, method_name, desc, append)

    MultiClassAttribute.__doc__ = """
    There is one instance of this class for each device class.

    This class is mainly an aggregate of :class:`~tango.Attr` objects.
    It eases management of multiple attributes

    New in PyTango 7.2.1"""

    document_method(
        "get_attr",
        """
    get_attr(self, attr_name) -> Attr

        Get the :class:`~tango.Attr` object for the attribute with
        name passed as parameter.

        :param attr_name: attribute name
        :type attr_name: str

        :returns: the attribute object
        :rtype: Attr

        :raises DevFailed: If the attribute is not defined.

        New in PyTango 7.2.1
    """,
    )

    document_method(
        "remove_attr",
        """
    remove_attr(self, attr_name, cl_name)

        Remove the :class:`~tango.Attr` object for the attribute with
        name passed as parameter.

        Does nothing if the attribute does not exist.

        :param attr_name: attribute name
        :type attr_name: str
        :param cl_name: the attribute class name
        :type cl_name: str

        New in PyTango 7.2.1
    """,
    )

    document_method(
        "get_attr_list",
        """
    get_attr_list(self) -> Sequence[Attr]

        Get the list of :class:`~tango.Attr` for this device class.

        :returns: the list of attribute objects
        :rtype: Sequence[Attr]

        New in PyTango 7.2.1
    """,
    )


def __doc_MultiAttribute():
    def document_method(method_name, desc, append=True):
        return __document_method(MultiAttribute, method_name, desc, append)

    MultiAttribute.__doc__ = """
    There is one instance of this class for each device.
    This class is mainly an aggregate of :class:`~tango.Attribute` or
    :class:`~tango.WAttribute` objects. It eases management of multiple
    attributes"""

    document_method(
        "get_attr_by_name",
        """
    get_attr_by_name(self, attr_name) -> Attribute

        Get :class:`~tango.Attribute` object from its name.

        This method returns an :class:`~tango.Attribute` object with a
        name passed as parameter. The equality on attribute name is case
        independant.

        :param attr_name: attribute name
        :type attr_name: str

        :returns: the attribute object
        :rtype: Attribute

        :raises DevFailed: If the attribute is not defined.
    """,
    )

    document_method(
        "get_attr_by_ind",
        """
    get_attr_by_ind(self, ind) -> Attribute

        Get :class:`~tango.Attribute` object from its index.

        This method returns an :class:`~tango.Attribute` object from the
        index in the main attribute vector.

        :param ind: the attribute index
        :type ind: int

        :returns: the attribute object
        :rtype: Attribute
    """,
    )

    document_method(
        "get_w_attr_by_name",
        """
    get_w_attr_by_name(self, attr_name) -> WAttribute

        Get a writable attribute object from its name.

        This method returns an :class:`~tango.WAttribute` object with a
        name passed as parameter. The equality on attribute name is case
        independant.

        :param attr_name: attribute name
        :type attr_name: str

        :returns: the attribute object
        :rtype: WAttribute

        :raises DevFailed: If the attribute is not defined.
    """,
    )

    document_method(
        "get_w_attr_by_ind",
        """
    get_w_attr_by_ind(self, ind) -> WAttribute

        Get a writable attribute object from its index.

        This method returns an :class:`~tango.WAttribute` object from the
        index in the main attribute vector.

        :param ind: the attribute index
        :type ind: int

        :returns: the attribute object
        :rtype: WAttribute
    """,
    )

    document_method(
        "get_attr_ind_by_name",
        """
    get_attr_ind_by_name(self, attr_name) -> int

        Get Attribute index into the main attribute vector from its name.

        This method returns the index in the Attribute vector (stored in the
        :class:`~tango.MultiAttribute` object) of an attribute with a
        given name. The name equality is case independant.

        :param attr_name: attribute name
        :type attr_name: str

        :returns: the attribute index
        :rtype: int

        :raises DevFailed: If the attribute is not found in the vector.

        New in PyTango 7.0.0
    """,
    )

    document_method(
        "get_attr_nb",
        """
    get_attr_nb(self) -> int

        Get attribute number.

        :returns: the number of attributes
        :rtype: int

        New in PyTango 7.0.0
    """,
    )

    document_method(
        "check_alarm",
        """
    check_alarm(self) -> bool

        .. function:: check_alarm(self, attr_name) -> bool
                      check_alarm(self, ind) -> bool
            :noindex:

        Checks an alarm.

        - The 1st version of the method checks alarm on all attribute(s) with an alarm defined.
        - The 2nd version of the method checks alarm for one attribute with a given name.
        - The 3rd version of the method checks alarm for one attribute from its index in the main attributes vector.

        :param attr_name: attribute name
        :type attr_name: str
        :param ind: the attribute index
        :type ind: int

        :returns: True if at least one attribute is in alarm condition
        :rtype: bool

        :raises DevFailed: If at least one attribute does not have any alarm level defined

        New in PyTango 7.0.0
    """,
    )

    document_method(
        "read_alarm",
        """
    read_alarm(self, status)

        Add alarm message to device status.

        This method add alarm mesage to the string passed as parameter.
        A message is added for each attribute which is in alarm condition

        :param status: a string (should be the device status)
        :type status: str

        New in PyTango 7.0.0
    """,
    )

    document_method(
        "get_attribute_list",
        """
    get_attribute_list(self) -> Sequence[Attribute]

        Get the list of attribute objects.

        :returns: list of attribute objects
        :rtype: Sequence[Attribute]

        New in PyTango 7.2.1
    """,
    )


def __doc_Attr():
    def document_method(method_name, desc, append=True):
        return __document_method(Attr, method_name, desc, append)

    Attr.__doc__ = """
    This class represents a Tango writable attribute.
    """

    document_method(
        "check_type",
        """
    check_type(self)

        This method checks data type and throws an exception in case of unsupported data type

        :raises: :class:`DevFailed`: If the data type is unsupported.
    """,
    )

    document_method(
        "is_allowed",
        """
    is_allowed(self, device, request_type) -> bool

        Returns whether the request_type is allowed for the specified device

        :param device: instance of Device
        :type device: :class:`tango.server.Device`

        :param request_type: AttReqType.READ_REQ for read request or AttReqType.WRITE_REQ for write request
        :type request_type: :const:`AttReqType`

        :returns: True if request_type is allowed for the specified device
        :rtype: bool
    """,
    )

    # TODO finish description
    # document_method("read", """
    # read(self, device, attribute)
    #
    #     TODO: Check description
    #
    #     Default read empty method. For readable attribute, it is necessary to overwrite it
    #
    #     :param device: instance of Device
    #     :type device: Device
    # """)

    # TODO finish description
    # document_method("write", """
    # write(self, device, attribute)
    #
    #     TODO: Check description
    #
    #     Default write empty method. For writable attribute, it is necessary to overwrite it
    #
    #     :param device: instance of Device
    #     :type device: Device
    # """)

    document_method(
        "set_default_properties",
        """
    set_default_properties(self, attr_prop)

        Set default attribute properties.

        :param attr_prop: the user default property class
        :type attr_prop: UserDefaultAttrProp
    """,
    )

    document_method(
        "set_disp_level",
        """
    set_disp_level(self, disp_level)

        Set the attribute display level.

        :param disp_level: the new display level
        :type disp_level: DispLevel
    """,
    )

    document_method(
        "set_polling_period",
        """
    set_polling_period(self, period)

        Set the attribute polling update period.

        :param period: the attribute polling period (in mS)
        :type period: int
    """,
    )

    document_method(
        "set_memorized",
        """
    set_memorized(self)

        Set the attribute as memorized in database (only for scalar
        and writable attribute).

        By default the setpoint will be written to the attribute during initialisation!
        Use method set_memorized_init() with False as argument if you don't
        want this feature.
    """,
    )

    document_method(
        "set_memorized_init",
        """
    set_memorized_init(self, write_on_init)

        Set the initialisation flag for memorized attributes.

        - true = the setpoint value will be written to the attribute on initialisation
        - false = only the attribute setpoint is initialised.

        No action is taken on the attribute

        :param write_on_init: if true the setpoint value will be written
                              to the attribute on initialisation
        :type write_on_init: bool
    """,
    )

    document_method(
        "set_change_event",
        """
    set_change_event(self, implemented, detect)

        Set a flag to indicate that the server fires change events manually
        without the polling to be started for the attribute.

        If the detect parameter is set to true, the criteria specified for
        the change event are verified and the event is only pushed if they
        are fullfilled.

        If detect is set to false the event is fired without checking!

        :param implemented: True when the server fires change events manually.
        :type implemented: bool
        :param detect: Triggers the verification of the change event properties
                       when set to true.
        :type detect: bool
    """,
    )

    document_method(
        "is_change_event",
        """
    is_change_event(self) -> bool

        Check if the change event is fired manually for this attribute.

        :returns: true if a manual fire change event is implemented.
        :rtype: bool
    """,
    )

    document_method(
        "is_check_change_criteria",
        """
    is_check_change_criteria(self) -> bool

        Check if the change event criteria should be checked when firing the event manually.

        :returns: true if a change event criteria will be checked.
        :rtype: bool
    """,
    )

    document_method(
        "set_archive_event",
        """
    set_archive_event(self)

        Set a flag to indicate that the server fires archive events manually
        without the polling to be started for the attribute.

        If the detect
        parameter is set to true, the criteria specified for the archive
        event are verified and the event is only pushed if they are fullfilled.

        If detect is set to false the event is fired without checking!

        :param implemented: True when the server fires change events manually.
        :type implemented: bool
        :param detect: Triggers the verification of the archive event properties
                       when set to true.
        :type detect: bool
    """,
    )

    document_method(
        "is_archive_event",
        """
    is_archive_event(self) -> bool

        Check if the archive event is fired manually for this attribute.

        :returns: true if a manual fire archive event is implemented.
        :rtype: bool
    """,
    )

    document_method(
        "is_check_archive_criteria",
        """
    is_check_archive_criteria(self) -> bool

        Check if the archive event criteria should be checked when firing the event manually.

        :returns: true if a archive event criteria will be checked.
        :rtype: bool
    """,
    )

    document_method(
        "set_data_ready_event",
        """
    set_data_ready_event(self, implemented)

        Set a flag to indicate that the server fires data ready events.

        :param implemented: True when the server fires data ready events
        :type implemented: bool

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "is_data_ready_event",
        """
    is_data_ready_event(self) -> bool

        Check if the data ready event is fired for this attribute.

        :returns: true if firing data ready event is implemented.
        :rtype: bool

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "get_name",
        """
    get_name(self) -> str

        Get the attribute name.

        :returns: the attribute name
        :rtype: str
    """,
    )

    document_method(
        "get_format",
        """
    get_format(self) -> AttrDataFormat

        Get the attribute format.

        :returns: the attribute format
        :rtype: AttrDataFormat
    """,
    )

    document_method(
        "get_writable",
        """
    get_writable(self) -> AttrWriteType

        Get the attribute write type.

        :returns: the attribute write type
        :rtype: AttrWriteType
    """,
    )

    document_method(
        "get_type",
        """
    get_type(self) -> int

        Get the attribute data type.

        :returns: the attribute data type
        :rtype: int
    """,
    )

    document_method(
        "get_disp_level",
        """
    get_disp_level(self) -> DispLevel

        Get the attribute display level.

        :returns: the attribute display level
        :rtype: DispLevel
    """,
    )

    document_method(
        "get_polling_period",
        """
    get_polling_period(self) -> int

        Get the polling period (mS).

        :returns: the polling period (mS)
        :rtype: int
    """,
    )

    document_method(
        "get_memorized",
        """
    get_memorized(self) -> bool

        Determine if the attribute is memorized or not.

        :returns: True if the attribute is memorized
        :rtype: bool
    """,
    )

    document_method(
        "get_memorized_init",
        """
    get_memorized_init(self) -> bool

        Determine if the attribute is written at startup from the memorized
        value if it is memorized.

        :returns: True if initialized with memorized value or not
        :rtype: bool
    """,
    )

    document_method(
        "get_assoc",
        """
    get_assoc(self) -> str

        Get the associated name.

        :returns: the associated name
        :rtype: bool
    """,
    )

    document_method(
        "is_assoc",
        """
    is_assoc(self) -> bool

        Determine if it is assoc.

        :returns: if it is assoc
        :rtype: bool
    """,
    )

    document_method(
        "get_cl_name",
        """
    get_cl_name(self) -> str

        Returns the class name.

        :returns: the class name
        :rtype: str

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "set_cl_name",
        """
    set_cl_name(self, cl)

        Sets the class name.

        :param cl: new class name
        :type cl: str

        New in PyTango 7.2.0
    """,
    )

    document_method(
        "get_class_properties",
        """
    get_class_properties(self) -> Sequence[AttrProperty]

        Get the class level attribute properties.

        :returns: the class attribute properties
        :rtype: Sequence[AttrProperty]
    """,
    )

    document_method(
        "get_user_default_properties",
        """
    get_user_default_properties(self) -> Sequence[AttrProperty]

        Get the user default attribute properties.

        :returns: the user default attribute properties
        :rtype: Sequence[AttrProperty]
    """,
    )

    document_method(
        "set_class_properties",
        """
    set_class_properties(self, props)

        Set the class level attribute properties.

        :param props: new class level attribute properties
        :type props: StdAttrPropertyVector
    """,
    )


def __doc_UserDefaultAttrProp():
    def document_method(method_name, desc, append=True):
        return __document_method(UserDefaultAttrProp, method_name, desc, append)

    UserDefaultAttrProp.__doc__ = """
    User class to set attribute default properties.

    This class is used to set attribute default properties.
    Three levels of attributes properties setting are implemented within Tango.
    The highest property setting level is the database.
    Then the user default (set using this UserDefaultAttrProp class) and finally
    a Tango library default value.
    """

    document_method(
        "set_label",
        """
    set_label(self, def_label)

        Set default label property.

        :param def_label: the user default label property
        :type def_label: str
    """,
    )

    document_method(
        "set_description",
        """
    set_description(self, def_description)

        Set default description property.

        :param def_description: the user default description property
        :type def_description: str
    """,
    )

    document_method(
        "set_format",
        """
    set_format(self, def_format)

        Set default format property.

        :param def_format: the user default format property
        :type def_format: str
    """,
    )

    document_method(
        "set_unit",
        """
    set_unit(self, def_unit)

        Set default unit property.

        :param def_unit: te user default unit property
        :type def_unit: str
    """,
    )

    document_method(
        "set_standard_unit",
        """
    set_standard_unit(self, def_standard_unit)

        Set default standard unit property.

        :param def_standard_unit: the user default standard unit property
        :type def_standard_unit: str
    """,
    )

    document_method(
        "set_display_unit",
        """
    set_display_unit(self, def_display_unit)

        Set default display unit property.

        :param def_display_unit: the user default display unit property
        :type def_display_unit: str
    """,
    )

    document_method(
        "set_min_value",
        """
    set_min_value(self, def_min_value)

        Set default min_value property.

        :param def_min_value: the user default min_value property
        :type def_min_value: str
    """,
    )

    document_method(
        "set_max_value",
        """
    set_max_value(self, def_max_value)

        Set default max_value property.

        :param def_max_value: the user default max_value property
        :type def_max_value: str
    """,
    )

    document_method(
        "set_min_alarm",
        """
    set_min_alarm(self, def_min_alarm)

        Set default min_alarm property.

        :param def_min_alarm: the user default min_alarm property
        :type def_min_alarm: str
    """,
    )

    document_method(
        "set_max_alarm",
        """
    set_max_alarm(self, def_max_alarm)

        Set default max_alarm property.

        :param def_max_alarm: the user default max_alarm property
        :type def_max_alarm: str
    """,
    )

    document_method(
        "set_min_warning",
        """
    set_min_warning(self, def_min_warning)

        Set default min_warning property.

        :param def_min_warning: the user default min_warning property
        :type def_min_warning: str
    """,
    )

    document_method(
        "set_max_warning",
        """
    set_max_warning(self, def_max_warning)

        Set default max_warning property.

        :param def_max_warning: the user default max_warning property
        :type def_max_warning: str
    """,
    )

    document_method(
        "set_delta_t",
        """
    set_delta_t(self, def_delta_t)

        Set default RDS alarm delta_t property.

        :param def_delta_t: the user default RDS alarm delta_t property
        :type def_delta_t: str
    """,
    )

    document_method(
        "set_delta_val",
        """
    set_delta_val(self, def_delta_val)

        Set default RDS alarm delta_val property.

        :param def_delta_val: the user default RDS alarm delta_val property
        :type def_delta_val: str
    """,
    )

    document_method(
        "set_abs_change",
        """
    set_abs_change(self, def_abs_change) <= DEPRECATED

        Set default change event abs_change property.

        :param def_abs_change: the user default change event abs_change property
        :type def_abs_change: str

        Deprecated since PyTango 8.0. Please use set_event_abs_change instead.
    """,
    )

    document_method(
        "set_event_abs_change",
        """
    set_event_abs_change(self, def_abs_change)

        Set default change event abs_change property.

        :param def_abs_change: the user default change event abs_change property
        :type def_abs_change: str

        New in PyTango 8.0
    """,
    )

    document_method(
        "set_rel_change",
        """
    set_rel_change(self, def_rel_change) <= DEPRECATED

        Set default change event rel_change property.

        :param def_rel_change: the user default change event rel_change property
        :type def_rel_change: str

        Deprecated since PyTango 8.0. Please use set_event_rel_change instead.
    """,
    )

    document_method(
        "set_event_rel_change",
        """
    set_event_rel_change(self, def_rel_change)

        Set default change event rel_change property.

        :param def_rel_change: the user default change event rel_change property
        :type def_rel_change: str

        New in PyTango 8.0
    """,
    )

    document_method(
        "set_period",
        """
    set_period(self, def_period) <= DEPRECATED

        Set default periodic event period property.

        :param def_period: the user default periodic event period property
        :type def_period: str

        Deprecated since PyTango 8.0. Please use set_event_period instead.
    """,
    )

    document_method(
        "set_event_period",
        """
    set_event_period(self, def_period)

        Set default periodic event period property.

        :param def_period: the user default periodic event period property
        :type def_period: str

        New in PyTango 8.0
    """,
    )

    document_method(
        "set_archive_abs_change",
        """
    set_archive_abs_change(self, def_archive_abs_change) <= DEPRECATED

        Set default archive event abs_change property.

        :param def_archive_abs_change: the user default archive event abs_change property
        :type def_archive_abs_change: str

        Deprecated since PyTango 8.0. Please use set_archive_event_abs_change instead.
    """,
    )

    document_method(
        "set_archive_event_abs_change",
        """
    set_archive_event_abs_change(self, def_archive_abs_change)

        Set default archive event abs_change property.

        :param def_archive_abs_change: the user default archive event abs_change property
        :type def_archive_abs_change: str

        New in PyTango 8.0
    """,
    )

    document_method(
        "set_archive_rel_change",
        """
    set_archive_rel_change(self, def_archive_rel_change) <= DEPRECATED

        Set default archive event rel_change property.

        :param def_archive_rel_change: the user default archive event rel_change property
        :type def_archive_rel_change: str

        Deprecated since PyTango 8.0. Please use set_archive_event_rel_change instead.
    """,
    )

    document_method(
        "set_archive_event_rel_change",
        """
    set_archive_event_rel_change(self, def_archive_rel_change)

        Set default archive event rel_change property.

        :param def_archive_rel_change: the user default archive event rel_change property
        :type def_archive_rel_change: str

        New in PyTango 8.0
    """,
    )

    document_method(
        "set_archive_period",
        """
    set_archive_period(self, def_archive_period) <= DEPRECATED

        Set default archive event period property.

        :param def_archive_period: t
        :type def_archive_period: str

        Deprecated since PyTango 8.0. Please use set_archive_event_period instead.
    """,
    )

    document_method(
        "set_archive_event_period",
        """
    set_archive_event_period(self, def_archive_period)

        Set default archive event period property.

        :param def_archive_period: t
        :type def_archive_period: str

        New in PyTango 8.0
    """,
    )


def device_server_init(doc=True):
    __init_DeviceImpl()
    __init_Attribute()
    __init_Attr()
    __init_UserDefaultAttrProp()
    __init_Logger()
    if doc:
        __doc_DeviceImpl()
        __doc_extra_DeviceImpl(Device_3Impl)
        __doc_extra_DeviceImpl(Device_4Impl)
        __doc_extra_DeviceImpl(Device_5Impl)
        __doc_extra_DeviceImpl(Device_6Impl)
        __doc_Attribute()
        __doc_WAttribute()
        __doc_MultiAttribute()
        __doc_MultiClassAttribute()
        __doc_UserDefaultAttrProp()
        __doc_Attr()