This file is indexed.

/usr/share/pyshared/PyTango/base_types.py is in python-pytango 7.2.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
################################################################################
##
## This file is part of PyTango, a python binding for Tango
## 
## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
##
## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
## 
## PyTango is free software: you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## 
## PyTango is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU Lesser General Public License for more details.
## 
## You should have received a copy of the GNU Lesser General Public License
## along with PyTango.  If not, see <http://www.gnu.org/licenses/>.
##
################################################################################

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

__all__ = []

__docformat__ = "restructuredtext"

import operator

from _PyTango import (StdStringVector, StdLongVector, StdDoubleVector, \
    CommandInfoList, AttributeInfoList, AttributeInfoListEx, DbData, \
    DbDevInfos, DbDevExportInfos, DbDevImportInfos, DbHistoryList, \
    DeviceDataHistoryList, StdGroupReplyVector, \
    StdGroupCmdReplyVector, StdGroupAttrReplyVector, \
    ArchiveEventInfo, EventData, AttrConfEventData, AttributeAlarmInfo, \
    AttributeDimension, AttributeEventInfo, DeviceAttributeConfig, \
    AttributeInfo, AttributeInfoEx, ChangeEventInfo, PeriodicEventInfo, \
    DevCommandInfo, CommandInfo, DataReadyEventData, DeviceInfo, \
    LockerInfo, PollDevice, TimeVal)

from utils import document_method
from utils import document_enum as __document_enum

def __StdVector__add(self, seq):
    ret = seq.__class__(self)
    ret.extend(seq)
    return ret

def __StdVector__mul(self, n):
    ret = self.__class__()
    for _ in xrange(n):
        ret.extend(self)
    return ret

def __StdVector__imul(self, n):
    ret = self.__class__()
    for _ in xrange(n):
        ret.extend(self)
    return ret

def __StdVector__getitem(self, key):
    if operator.isNumberType(key) or key.step is None:
        return self.__original_getitem(key)
    
    res = self.__class__()
    nb = len(self)
    start = key.start or 0
    stop  = key.stop or nb
    if start >= nb:
        return res
    if stop > nb:
        stop = nb
    
    for i in xrange(start, stop, key.step or 1):
        res.append(self[i])
    
    return res

def __fillVectorClass(klass):
    klass.__add__ = __StdVector__add
    klass.__mul__ = __StdVector__mul
    klass.__imul__ = __StdVector__imul
    klass.__original_getitem = klass.__getitem__
    klass.__getitem__ = __StdVector__getitem
    
def __init_base_types():
    
    v_klasses = (StdStringVector,StdLongVector,StdDoubleVector,CommandInfoList, \
                 AttributeInfoList,AttributeInfoListEx,DbData,DbDevInfos, \
                 DbDevExportInfos,DbDevImportInfos,DbHistoryList, \
                 DeviceDataHistoryList, StdGroupReplyVector, \
                 StdGroupCmdReplyVector, StdGroupAttrReplyVector)

    for v_klass in v_klasses:
        __fillVectorClass(v_klass)

def __doc_base_types():
    
    def document_enum(enum_name, desc):
        import PyTango
        __document_enum(PyTango, enum_name, desc)

    document_enum("ExtractAs", """
    Defines what will go into value field of DeviceAttribute, or what will
    Attribute.get_write_value() return... Not all the possible values are valid
    in all the cases.

    Valid possible values are:
    
        - Numpy    : Value will be stored in [value, w_value]. If the
          attribute is an scalar, they will contain a value. If it's
          an SPECTRUM or IMAGE it will be exported as a numpy array.
        - Tuple    : Value will be stored in [value, w_value]. If the
          attribute is an scalar, they will contain a value. If it's
          an SPECTRUM or IMAGE it will be exported as a tuple or
          tuple of tuples.
        - List     : Value will be stored in [value, w_value]. If the
          attribute is an scalar, they will contain a value. If it's
          an SPECTRUM or IMAGE it will be exported as a list or list
          of lists
        - String   : The data will be stored 'as is', the binary data
          as it comes from TangoC++ in 'value'.
        - PyTango3 : Backward compatibility mode. If the attribute is
          an scalar, value and w_scalar_value will contain a value.
          If it's an SPECTRUM or IMAGE it will be exported as a flat
          list in value, were both the read and the write part are
          in value.
        - Nothing  : The value will not be extracted from DeviceAttribute
    """ )
    
    document_enum("CmdArgType", """
    An enumeration representing the command argument type.

        - DevVoid
        - DevBoolean
        - DevShort
        - DevLong
        - DevFloat
        - DevDouble
        - DevUShort
        - DevULong
        - DevString
        - DevVarCharArray
        - DevVarShortArray
        - DevVarLongArray
        - DevVarFloatArray
        - DevVarDoubleArray
        - DevVarUShortArray
        - DevVarULongArray
        - DevVarStringArray
        - DevVarLongStringArray
        - DevVarDoubleStringArray
        - DevState
        - ConstDevString
        - DevVarBooleanArray
        - DevUChar
        - DevLong64
        - DevULong64
        - DevVarLong64Array
        - DevVarULong64Array
        - DevInt
        - DevEncoded
    """ )

    document_enum("LockerLanguage", """
    An enumeration representing the programming language in which the
    client application who locked is written. 
    
        - CPP : C++/Python language
        - JAVA : Java language
    
    New in PyTango 7.0.0
    """ )

    document_enum("MessBoxType", """
    An enumeration representing the MessBoxType
    
        - STOP
        - INFO
    
    New in PyTango 7.0.0
    """ )

    document_enum("PollObjType", """
    An enumeration representing the PollObjType
        
        - POLL_CMD
        - POLL_ATTR
        - EVENT_HEARTBEAT
        - STORE_SUBDEV
    
    New in PyTango 7.0.0
    """ )

    document_enum("PollCmdCode", """
    An enumeration representing the PollCmdCode
    
        - POLL_ADD_OBJ
        - POLL_REM_OBJ
        - POLL_START
        - POLL_STOP
        - POLL_UPD_PERIOD
        - POLL_REM_DEV
        - POLL_EXIT
        - POLL_REM_EXT_TRIG_OBJ
        - POLL_ADD_HEARTBEAT
        - POLL_REM_HEARTBEAT
        
    New in PyTango 7.0.0
    """ )

    document_enum("SerialModel", """
    An enumeration representing the type of serialization performed by the device server
    
        - BY_DEVICE
        - BY_CLASS
        - BY_PROCESS
        - NO_SYNC
    """ )

    document_enum("AttReqType", """
    An enumeration representing the type of attribute request
    
        - READ_REQ
        - WRITE_REQ
    """ )

    document_enum("LockCmdCode", """
    An enumeration representing the LockCmdCode
    
        - LOCK_ADD_DEV
        - LOCK_REM_DEV
        - LOCK_UNLOCK_ALL_EXIT
        - LOCK_EXIT
        
    New in PyTango 7.0.0
    """ )

    document_enum("LogLevel", """
    An enumeration representing the LogLevel
    
        - LOG_OFF
        - LOG_FATAL
        - LOG_ERROR
        - LOG_WARN
        - LOG_INFO
        - LOG_DEBUG
        
    New in PyTango 7.0.0
    """ )

    document_enum("LogTarget", """
    An enumeration representing the LogTarget
    
        - LOG_CONSOLE
        - LOG_FILE
        - LOG_DEVICE
        
    New in PyTango 7.0.0
    """ )

    document_enum("EventType", """
    An enumeration representing event type
 
        - CHANGE_EVENT
        - QUALITY_EVENT
        - PERIODIC_EVENT
        - ARCHIVE_EVENT
        - USER_EVENT
        - ATTR_CONF_EVENT
        - DATA_READY_EVENT

        *DATA_READY_EVENT - New in PyTango 7.0.0*
    
    """ )

    document_enum("AttrSerialModel", """
    An enumeration representing the AttrSerialModel
    
        - ATTR_NO_SYNC
        - ATTR_BY_KERNEL
        - ATTR_BY_USER
        
    New in PyTango 7.1.0
    """ )
    
    document_enum("KeepAliveCmdCode", """
    An enumeration representing the KeepAliveCmdCode

        - EXIT_TH
        
    New in PyTango 7.0.0
    """ )

    document_enum("AccessControlType", """
    An enumeration representing the AccessControlType
    
        - ACCESS_READ
        - ACCESS_WRITE
        
    New in PyTango 7.0.0
    """ )

    document_enum("asyn_req_type", """
    An enumeration representing the asynchronous request type
    
        - POLLING
        - CALLBACK
        - ALL_ASYNCH
    """ )
    
    document_enum("cb_sub_model", """
    An enumeration representing callback sub model
    
        - PUSH_CALLBACK
        - PULL_CALLBACK
    """ )
    
    document_enum("AttrQuality", """
    An enumeration representing the attribute quality
    
        - ATTR_VALID
        - ATTR_INVALID
        - ATTR_ALARM
        - ATTR_CHANGING
        - ATTR_WARNING
    """ )
    
    document_enum("AttrWriteType", """
    An enumeration representing the attribute type
    
        - READ
        - READ_WITH_WRITE
        - WRITE
        - READ_WRITE
    """ )
    
    document_enum("AttrDataFormat", """
    An enumeration representing the attribute format
    
        - SCALAR
        - SPECTRUM
        - IMAGE
        - FMT_UNKNOWN
    """ )
    
    document_enum("DevSource", """
    An enumeration representing the device source for data
    
        - DEV
        - CACHE
        - CACHE_DEV
    """ )
    
    document_enum("ErrSeverity", """
    An enumeration representing the error severity
    
        - WARN
        - ERR
        - PANIC
    """ )
    
    document_enum("DevState", """
    An enumeration representing the device state
    
        - ON
        - OFF
        - CLOSE
        - OPEN
        - INSERT
        - EXTRACT
        - MOVING
        - STANDBY
        - FAULT
        - INIT
        - RUNNING
        - ALARM
        - DISABLE
        - UNKNOWN
    """ )
    
    document_enum("DispLevel", """
    An enumeration representing the display level
    
        - OPERATOR
        - EXPERT
    """ )
    
    ArchiveEventInfo.__doc__ = """
    A structure containing available archiving event information for an attribute
    with the folowing members:
        
        - archive_rel_change : (str) relative change that will generate an event
        - archive_abs_change : (str) absolute change that will generate an event
        - extensions : (sequence<str>) extensions (currently not used)"""

    EventData.__doc__ = """
    This class is used to pass data to the callback method when an event
    is sent to the client. It contains the following public fields:
    
         - device : (DeviceProxy) The DeviceProxy object on which the call was
           executed.
         - attr_name : (str) The attribute name
         - event : (str) The event name
         - attr_value : (DeviceAttribute) The attribute data (DeviceAttribute)
         - err : (bool) A boolean flag set to true if the request failed. False
           otherwise
         - errors : (sequence<DevError>) The error stack
         - reception_date: (TimeVal)
    """

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

            Returns the timestamp of the event.

        Parameters : None
        Return     : (TimeVal) the timestamp of the event

        New in PyTango 7.0.0
    """ )

    AttrConfEventData.__doc__ = """
    This class is used to pass data to the callback method when a
    configuration event is sent to the client. It contains the
    following public fields:
    
        - device : (DeviceProxy) The DeviceProxy object on which the call was executed
        - attr_name : (str) The attribute name
        - event : (str) The event name
        - attr_conf : (AttributeInfoEx) The attribute data
        - err : (bool) A boolean flag set to true if the request failed. False
          otherwise
        - errors : (sequence<DevError>) The error stack
        - reception_date: (TimeVal)
    """

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

            Returns the timestamp of the event.

        Parameters : None
        Return     : (TimeVal) the timestamp of the event

        New in PyTango 7.0.0
    """ )

    AttributeAlarmInfo.__doc__ = """
    A structure containing available alarm information for an attribute
    with the folowing members:
        
        - min_alarm : (str) low alarm level
        - max_alarm : (str) high alarm level
        - min_warning : (str) low warning level
        - max_warning : (str) high warning level
        - delta_t : (str) time delta
        - delta_val : (str) value delta
        - extensions : (StdStringVector) extensions (currently not used)"""

    AttributeDimension.__doc__ = """
    A structure containing x and y attribute data dimensions with
    the following members:
    
        - dim_x : (int) x dimension
        - dim_y : (int) y dimension"""

    AttributeEventInfo.__doc__ = """
    A structure containing available event information for an attribute
    with the folowing members:
        
        - ch_event : (ChangeEventInfo) change event information
        - per_event : (PeriodicEventInfo) periodic event information
        - arch_event :  (ArchiveEventInfo) archiving event information"""

    DeviceAttributeConfig.__doc__ = """
    A base structure containing available information for an attribute
    with the following members:
        
        - name : (str) attribute name
        - writable : (AttrWriteType) write type (R, W, RW, R with W)
        - data_format : (AttrDataFormat) data format (SCALAR, SPECTRUM, IMAGE)
        - data_type : (int) attribute type (float, string,..)
        - max_dim_x : (int) first dimension of attribute (spectrum or image attributes)
        - max_dim_y : (int) second dimension of attribute(image attribute)
        - description : (int) attribute description
        - label : (str) attribute label (Voltage, time, ...)
        - unit : (str) attribute unit (V, ms, ...)
        - standard_unit : (str) standard unit
        - display_unit : (str) display unit
        - format : (str) how to display the attribute value (ex: for floats could be '%6.2f')
        - min_value : (str) minimum allowed value
        - max_value : (str) maximum allowed value
        - min_alarm : (str) low alarm level
        - max_alarm : (str) high alarm level
        - writable_attr_name : (str) name of the writable attribute
        - extensions : (StdStringVector) extensions (currently not used)"""

    AttributeInfo.__doc__ = """
    A structure (inheriting from :class:`DeviceAttributeConfig`) containing
    available information for an attribute with the following members:
    
        - disp_level : (DispLevel) display level (OPERATOR, EXPERT)

        Inherited members are:
        
            - name : (str) attribute name
            - writable : (AttrWriteType) write type (R, W, RW, R with W)
            - data_format : (AttrDataFormat) data format (SCALAR, SPECTRUM, IMAGE)
            - data_type : (int) attribute type (float, string,..)
            - max_dim_x : (int) first dimension of attribute (spectrum or image attributes)
            - max_dim_y : (int) second dimension of attribute(image attribute)
            - description : (int) attribute description
            - label : (str) attribute label (Voltage, time, ...)
            - unit : (str) attribute unit (V, ms, ...)
            - standard_unit : (str) standard unit
            - display_unit : (str) display unit
            - format : (str) how to display the attribute value (ex: for floats could be '%6.2f')
            - min_value : (str) minimum allowed value
            - max_value : (str) maximum allowed value
            - min_alarm : (str) low alarm level
            - max_alarm : (str) high alarm level
            - writable_attr_name : (str) name of the writable attribute
            - extensions : (StdStringVector) extensions (currently not used)"""

    AttributeInfoEx.__doc__ = """
    A structure (inheriting from :class:`AttributeInfo`) containing
    available information for an attribute with the following members:
    
        - alarms : object containing alarm information (see AttributeAlarmInfo).
        - events : object containing event information (see AttributeEventInfo).
        - sys_extensions : StdStringVector

        Inherited members are:
        
            - name : (str) attribute name
            - writable : (AttrWriteType) write type (R, W, RW, R with W)
            - data_format : (AttrDataFormat) data format (SCALAR, SPECTRUM, IMAGE)
            - data_type : (int) attribute type (float, string,..)
            - max_dim_x : (int) first dimension of attribute (spectrum or image attributes)
            - max_dim_y : (int) second dimension of attribute(image attribute)
            - description : (int) attribute description
            - label : (str) attribute label (Voltage, time, ...)
            - unit : (str) attribute unit (V, ms, ...)
            - standard_unit : (str) standard unit
            - display_unit : (str) display unit
            - format : (str) how to display the attribute value (ex: for floats could be '%6.2f')
            - min_value : (str) minimum allowed value
            - max_value : (str) maximum allowed value
            - min_alarm : (str) low alarm level
            - max_alarm : (str) high alarm level
            - writable_attr_name : (str) name of the writable attribute
            - extensions : (StdStringVector) extensions (currently not used)
            - disp_level : (DispLevel) display level (OPERATOR, EXPERT)"""

    ChangeEventInfo.__doc__ = """
    A structure containing available change event information for an attribute
    with the folowing members:
        
        - rel_change : (str) relative change that will generate an event
        - abs_change : (str) absolute change that will generate an event
        - extensions : (StdStringVector) extensions (currently not used)"""

    PeriodicEventInfo.__doc__ = """
    A structure containing available periodic event information for an attribute
    with the folowing members:
        
        - period : (str) event period
        - extensions : (StdStringVector) extensions (currently not used)"""

    DevCommandInfo.__doc__ = """
    A device command info with the following members:
    
        - cmd_name : (str) command name
        - cmd_tag : command as binary value (for TACO)
        - in_type : (CmdArgType) input type
        - out_type : (CmdArgType) output type
        - in_type_desc : (str) description of input type
        - out_type_desc : (str) description of output type

    New in PyTango 7.0.0"""

    CommandInfo.__doc__ = """
    A device command info (inheriting from :class:`DevCommandInfo`) with the following members:
    
        - disp_level : (DispLevel) command display level

        Inherited members are (from :class:`DevCommandInfo`):
        
            - cmd_name : (str) command name
            - cmd_tag : (str) command as binary value (for TACO)
            - in_type : (CmdArgType) input type
            - out_type : (CmdArgType) output type
            - in_type_desc : (str) description of input type
            - out_type_desc : (str) description of output type"""

    DataReadyEventData.__doc__ = """
    This class is used to pass data to the callback method when an
    attribute data ready event is sent to the clien. It contains the
    following public fields:
    
        - device : (DeviceProxy) The DeviceProxy object on which the call was executed
        - attr_name : (str) The attribute name
        - event : (str) The event name
        - attr_data_type : (int) The attribute data type
        - ctr : (int) The user counter. Set to 0 if not defined when sent by the
          server
        - err : (bool) A boolean flag set to true if the request failed. False
          otherwise
        - errors : (sequence<DevError>) The error stack
        - reception_date: (TimeVal)

        New in PyTango 7.0.0"""

    DeviceInfo.__doc__ = """
    A structure containing available information for a device with the"
    following members:
    
        - dev_class : (str) device class
        - server_id : (str) server ID
        - server_host : (str) host name
        - server_version : (str) server version
        - doc_url : (str) document url"""

    LockerInfo.__doc__ = """
    A structure with information about the locker with the folowing members:
    
        - ll : (PyTango.LockerLanguage) the locker language
        - li : (pid_t / UUID) the locker id
        - locker_host : (str) the host
        - locker_class : (str) the class
        
        pid_t should be an int, UUID should be a tuple of four numbers.
        
        New in PyTango 7.0.0"""
    
    PollDevice.__doc__ = """
    A structure containing PollDevice information with the folowing members:
    
        - dev_name : (str) device name
        - ind_list : (sequence<int>) index list
        
        New in PyTango 7.0.0"""
    
    document_method(DataReadyEventData, "get_date", """
    get_date(self) -> TimeVal

            Returns the timestamp of the event.

        Parameters : None
        Return     : (TimeVal) the timestamp of the event

        New in PyTango 7.0.0
    """ )

    TimeVal.__doc__ = """
    Time value structure with the following members:
    
        - tv_sec : seconds
        - tv_usec : microseconds
        - tv_nsec : nanoseconds"""

def init(doc=True):
    __init_base_types()
    if doc:
        __doc_base_types()