mirror of
https://github.com/Unidata/python-awips.git
synced 2025-02-23 22:57:56 -05:00
code cleanup, rm unused imports, various bug fixes
This commit is contained in:
parent
4313260994
commit
7a88a6d3db
14 changed files with 37 additions and 90 deletions
|
@ -1,8 +1,3 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
from string import Template
|
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
from . import stomp
|
from . import stomp
|
||||||
import socket
|
import socket
|
||||||
|
@ -13,7 +8,6 @@ import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
from . import ThriftClient
|
from . import ThriftClient
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.alertviz import AlertVizRequest
|
from dynamicserialize.dstypes.com.raytheon.uf.common.alertviz import AlertVizRequest
|
||||||
from dynamicserialize import DynamicSerializationManager
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provides a capability of constructing notification messages and sending
|
# Provides a capability of constructing notification messages and sending
|
||||||
|
@ -122,7 +116,7 @@ class NotificationMessage:
|
||||||
sm.set("filters", self.filters)
|
sm.set("filters", self.filters)
|
||||||
msg = ET.SubElement(sm, "message")
|
msg = ET.SubElement(sm, "message")
|
||||||
msg.text = self.message
|
msg.text = self.message
|
||||||
details = ET.SubElement(sm, "details")
|
# details = ET.SubElement(sm, "details")
|
||||||
msg = ET.tostring(sm, "UTF-8")
|
msg = ET.tostring(sm, "UTF-8")
|
||||||
|
|
||||||
try :
|
try :
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import http.client as httpcl
|
import http.client as httpcl
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import httplib as httpcl
|
import httplib as httpcl
|
||||||
from dynamicserialize import DynamicSerializationManager
|
from dynamicserialize import DynamicSerializationManager
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.serialization.comm.response import ServerErrorResponse
|
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.serialization import SerializableExceptionWrapper
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provides a Python-based interface for executing Thrift requests.
|
# Provides a Python-based interface for executing Thrift requests.
|
||||||
|
|
|
@ -74,7 +74,7 @@ def _getJmsConnectionInfo(notifFilterResponse):
|
||||||
serverString = notifFilterResponse.getJmsConnectionInfo()
|
serverString = notifFilterResponse.getJmsConnectionInfo()
|
||||||
try:
|
try:
|
||||||
host, port = JMS_HOST_PATTERN.match(serverString).groups()
|
host, port = JMS_HOST_PATTERN.match(serverString).groups()
|
||||||
except AttributeError as e:
|
except AttributeError:
|
||||||
raise RuntimeError('Got bad JMS connection info from server: ' + serverString)
|
raise RuntimeError('Got bad JMS connection info from server: ' + serverString)
|
||||||
return {'host': host, 'port': port}
|
return {'host': host, 'port': port}
|
||||||
|
|
||||||
|
|
|
@ -29,15 +29,15 @@ else: # Python 3 module renamed to 'queue'
|
||||||
from queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
|
|
||||||
|
|
||||||
"""Used to indicate a DataQueue that will produce geometry data."""
|
# Used to indicate a DataQueue that will produce geometry data.
|
||||||
GEOMETRY = object()
|
GEOMETRY = object()
|
||||||
|
|
||||||
|
|
||||||
"""Used to indicate a DataQueue that will produce grid data."""
|
# Used to indicate a DataQueue that will produce grid data.
|
||||||
GRID = object()
|
GRID = object()
|
||||||
|
|
||||||
|
|
||||||
"""Default maximum queue size."""
|
# Default maximum queue size.
|
||||||
_DEFAULT_MAXSIZE = 100
|
_DEFAULT_MAXSIZE = 100
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# #
|
|
||||||
# #
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Notification object that produces geometry data
|
# Notification object that produces geometry data
|
||||||
#
|
#
|
||||||
|
@ -15,7 +12,7 @@
|
||||||
|
|
||||||
import dynamicserialize
|
import dynamicserialize
|
||||||
from awips.dataaccess.PyNotification import PyNotification
|
from awips.dataaccess.PyNotification import PyNotification
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataquery.requests import RequestConstraint
|
|
||||||
|
|
||||||
class PyGeometryNotification(PyNotification):
|
class PyGeometryNotification(PyNotification):
|
||||||
|
|
||||||
|
@ -30,7 +27,7 @@ class PyGeometryNotification(PyNotification):
|
||||||
try:
|
try:
|
||||||
data = self.getData(self.request, list(dataTimes))
|
data = self.getData(self.request, list(dataTimes))
|
||||||
self.callback(data)
|
self.callback(data)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
def getData(self, request, dataTimes):
|
def getData(self, request, dataTimes):
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# #
|
|
||||||
# #
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Notification object that produces grid data
|
# Notification object that produces grid data
|
||||||
#
|
#
|
||||||
|
@ -14,8 +11,9 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import dynamicserialize
|
import dynamicserialize
|
||||||
|
import traceback
|
||||||
from awips.dataaccess.PyNotification import PyNotification
|
from awips.dataaccess.PyNotification import PyNotification
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataquery.requests import RequestConstraint
|
|
||||||
|
|
||||||
class PyGridNotification(PyNotification):
|
class PyGridNotification(PyNotification):
|
||||||
|
|
||||||
|
@ -35,7 +33,7 @@ class PyGridNotification(PyNotification):
|
||||||
newReq.setParameters(self.request.getParameters())
|
newReq.setParameters(self.request.getParameters())
|
||||||
data = self.getData(newReq, [])
|
data = self.getData(newReq, [])
|
||||||
self.callback(data)
|
self.callback(data)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
def getData(self, request, dataTimes):
|
def getData(self, request, dataTimes):
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Implements IData for use by native Python clients to the Data Access
|
# Implements IData for use by native Python clients to the Data Access
|
||||||
# Framework.
|
# Framework.
|
||||||
|
@ -17,14 +14,10 @@
|
||||||
|
|
||||||
from six import with_metaclass
|
from six import with_metaclass
|
||||||
import abc
|
import abc
|
||||||
import time
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
import dynamicserialize
|
|
||||||
from awips.dataaccess import DataAccessLayer
|
from awips.dataaccess import DataAccessLayer
|
||||||
from awips.dataaccess import INotificationSubscriber
|
from awips.dataaccess import INotificationSubscriber
|
||||||
from awips.QpidSubscriber import QpidSubscriber
|
from awips.QpidSubscriber import QpidSubscriber
|
||||||
from awips.ThriftClient import ThriftRequestException
|
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import DataTime
|
from dynamicserialize.dstypes.com.raytheon.uf.common.time import DataTime
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,23 @@
|
||||||
#!/usr/bin/env python
|
from __future__ import print_function
|
||||||
##
|
import hashlib
|
||||||
##
|
import math
|
||||||
|
import random
|
||||||
|
import re
|
||||||
|
import socket
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
import xml.dom.minidom
|
||||||
|
try:
|
||||||
|
from StringIO import StringIO
|
||||||
|
except ImportError:
|
||||||
|
from io import StringIO
|
||||||
|
from functools import reduce
|
||||||
|
try:
|
||||||
|
import _thread
|
||||||
|
except ImportError:
|
||||||
|
import thread as _thread
|
||||||
|
|
||||||
"""Stomp Protocol Connectivity
|
"""Stomp Protocol Connectivity
|
||||||
|
|
||||||
This provides basic connectivity to a message broker supporting the 'stomp' protocol.
|
This provides basic connectivity to a message broker supporting the 'stomp' protocol.
|
||||||
|
@ -64,27 +81,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import hashlib
|
|
||||||
import math
|
|
||||||
import random
|
|
||||||
import re
|
|
||||||
import socket
|
|
||||||
import sys
|
|
||||||
import threading
|
|
||||||
import time
|
|
||||||
import types
|
|
||||||
import xml.dom.minidom
|
|
||||||
try:
|
|
||||||
from StringIO import StringIO
|
|
||||||
except ImportError:
|
|
||||||
from io import StringIO
|
|
||||||
from functools import reduce
|
|
||||||
try:
|
|
||||||
import _thread
|
|
||||||
except ImportError:
|
|
||||||
import thread
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# stomp.py version number
|
# stomp.py version number
|
||||||
#
|
#
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
class Record():
|
class Record():
|
||||||
def __init__(self, level=0, msg='Test Message'):
|
def __init__(self, level=0, msg='Test Message'):
|
||||||
self.levelno=level
|
self.levelno = level
|
||||||
self.message=msg
|
self.message = msg
|
||||||
self.exc_info=sys.exc_info()
|
self.exc_info = sys.exc_info()
|
||||||
self.exc_text="TEST"
|
self.exc_text = "TEST"
|
||||||
|
|
||||||
def getMessage(self):
|
def getMessage(self):
|
||||||
return self.message
|
return self.message
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# A port of the Java ThriftSerializationContext, used for reading/writing
|
# A port of the Java ThriftSerializationContext, used for reading/writing
|
||||||
# DynamicSerialize objects to/from thrift.
|
# DynamicSerialize objects to/from thrift.
|
||||||
|
@ -28,10 +24,7 @@
|
||||||
from thrift.Thrift import TType
|
from thrift.Thrift import TType
|
||||||
import inspect
|
import inspect
|
||||||
import sys
|
import sys
|
||||||
import types
|
|
||||||
import time
|
|
||||||
import numpy
|
import numpy
|
||||||
import collections
|
|
||||||
import dynamicserialize
|
import dynamicserialize
|
||||||
from dynamicserialize import dstypes, adapters
|
from dynamicserialize import dstypes, adapters
|
||||||
from dynamicserialize import SelfDescribingBinaryProtocol
|
from dynamicserialize import SelfDescribingBinaryProtocol
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Efficient adapter for GetGeometryDataResponse
|
# Efficient adapter for GetGeometryDataResponse
|
||||||
#
|
#
|
||||||
|
@ -15,8 +11,6 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
from thrift.Thrift import TType
|
|
||||||
from dynamicserialize import SelfDescribingBinaryProtocol
|
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import GeometryResponseData
|
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import GeometryResponseData
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import GetGeometryDataResponse
|
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.response import GetGeometryDataResponse
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
# File auto-generated against equivalent DynamicSerialize Java class
|
# File auto-generated against equivalent DynamicSerialize Java class
|
||||||
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import GridLocation
|
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import GridLocation
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import ParmID
|
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import ParmID
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import TimeConstraints
|
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import TimeConstraints
|
||||||
|
@ -101,7 +96,7 @@ class GridParmInfo(object):
|
||||||
status.append("GridParmInfo.Units are not defined.")
|
status.append("GridParmInfo.Units are not defined.")
|
||||||
if self.precision < -2 or self.precision > 5:
|
if self.precision < -2 or self.precision > 5:
|
||||||
status.append("GridParmInfo is invalid. Precision out of limits." +
|
status.append("GridParmInfo is invalid. Precision out of limits." +
|
||||||
" Precision is: " + str(precision) + ". Must be between -2 and 5.")
|
" Precision is: " + str(self.precision) + ". Must be between -2 and 5.")
|
||||||
|
|
||||||
retVal = True
|
retVal = True
|
||||||
if len(status) > 0:
|
if len(status) > 0:
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
# File auto-generated against equivalent DynamicSerialize Java class
|
# File auto-generated against equivalent DynamicSerialize Java class
|
||||||
|
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import GFERecord
|
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import GFERecord
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.message import WsId
|
|
||||||
|
|
||||||
|
|
||||||
class GetGridRequest(object):
|
class GetGridRequest(object):
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
##
|
|
||||||
##
|
|
||||||
|
|
||||||
# File auto-generated against equivalent DynamicSerialize Java class
|
# File auto-generated against equivalent DynamicSerialize Java class
|
||||||
|
|
||||||
import os
|
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.localization.stream import AbstractLocalizationStreamRequest
|
from dynamicserialize.dstypes.com.raytheon.uf.common.localization.stream import AbstractLocalizationStreamRequest
|
||||||
from dynamicserialize.dstypes.com.raytheon.uf.common.auth.user import User
|
|
||||||
|
|
||||||
class LocalizationStreamGetRequest(AbstractLocalizationStreamRequest):
|
class LocalizationStreamGetRequest(AbstractLocalizationStreamRequest):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue