1 | # |
||
2 | # Implements IData for use by native Python clients to the Data Access |
||
3 | # Framework. |
||
4 | # |
||
5 | # |
||
6 | # SOFTWARE HISTORY |
||
7 | # |
||
8 | # Date Ticket# Engineer Description |
||
9 | # ------------ ---------- ----------- -------------------------- |
||
10 | # 06/03/13 dgilling Initial Creation. |
||
11 | # 10/05/18 mjames@ucar Encode/decode attribute names. |
||
12 | # |
||
13 | # |
||
14 | |||
15 | from awips.dataaccess import IData |
||
16 | import six |
||
17 | |||
18 | |||
19 | View Code Duplication | class PyData(IData): |
|
0 ignored issues
–
show
Duplication
introduced
by
![]() |
|||
20 | |||
21 | def __init__(self, dataRecord): |
||
22 | self.__time = dataRecord.getTime() |
||
23 | self.__level = dataRecord.getLevel() |
||
24 | self.__locationName = dataRecord.getLocationName() |
||
25 | self.__attributes = dataRecord.getAttributes() |
||
26 | |||
27 | def getAttribute(self, key): |
||
28 | return self.__attributes[key] |
||
29 | |||
30 | def getAttributes(self): |
||
31 | return self.__attributes.keys() |
||
32 | |||
33 | def getDataTime(self): |
||
34 | return self.__time |
||
35 | |||
36 | def getLevel(self): |
||
37 | if six.PY2: |
||
38 | return self.__level |
||
39 | if not isinstance(self.__level, str): |
||
40 | return self.__level.decode('utf-8') |
||
41 | return self.__level |
||
42 | |||
43 | def getLocationName(self): |
||
44 | return self.__locationName |
||
45 |