code cleanup, rm unused imports, various bug fixes

This commit is contained in:
Michael James 2018-10-06 08:35:30 -06:00
parent 4313260994
commit 7a88a6d3db
14 changed files with 37 additions and 90 deletions

View file

@ -1,8 +1,3 @@
##
##
from string import Template
import ctypes
from . import stomp
import socket
@ -13,7 +8,6 @@ import xml.etree.ElementTree as ET
from . import ThriftClient
from dynamicserialize.dstypes.com.raytheon.uf.common.alertviz import AlertVizRequest
from dynamicserialize import DynamicSerializationManager
#
# Provides a capability of constructing notification messages and sending
@ -122,7 +116,7 @@ class NotificationMessage:
sm.set("filters", self.filters)
msg = ET.SubElement(sm, "message")
msg.text = self.message
details = ET.SubElement(sm, "details")
# details = ET.SubElement(sm, "details")
msg = ET.tostring(sm, "UTF-8")
try :

View file

@ -1,13 +1,8 @@
##
##
try:
import http.client as httpcl
except ImportError:
import httplib as httpcl
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.

View file

@ -74,7 +74,7 @@ def _getJmsConnectionInfo(notifFilterResponse):
serverString = notifFilterResponse.getJmsConnectionInfo()
try:
host, port = JMS_HOST_PATTERN.match(serverString).groups()
except AttributeError as e:
except AttributeError:
raise RuntimeError('Got bad JMS connection info from server: ' + serverString)
return {'host': host, 'port': port}

View file

@ -29,15 +29,15 @@ else: # Python 3 module renamed to 'queue'
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()
"""Used to indicate a DataQueue that will produce grid data."""
# Used to indicate a DataQueue that will produce grid data.
GRID = object()
"""Default maximum queue size."""
# Default maximum queue size.
_DEFAULT_MAXSIZE = 100

View file

@ -1,6 +1,3 @@
# #
# #
#
# Notification object that produces geometry data
#
@ -15,7 +12,7 @@
import dynamicserialize
from awips.dataaccess.PyNotification import PyNotification
from dynamicserialize.dstypes.com.raytheon.uf.common.dataquery.requests import RequestConstraint
class PyGeometryNotification(PyNotification):
@ -30,7 +27,7 @@ class PyGeometryNotification(PyNotification):
try:
data = self.getData(self.request, list(dataTimes))
self.callback(data)
except Exception as e:
except Exception:
traceback.print_exc()
def getData(self, request, dataTimes):

View file

@ -1,6 +1,3 @@
# #
# #
#
# Notification object that produces grid data
#
@ -14,8 +11,9 @@
#
import dynamicserialize
import traceback
from awips.dataaccess.PyNotification import PyNotification
from dynamicserialize.dstypes.com.raytheon.uf.common.dataquery.requests import RequestConstraint
class PyGridNotification(PyNotification):
@ -35,7 +33,7 @@ class PyGridNotification(PyNotification):
newReq.setParameters(self.request.getParameters())
data = self.getData(newReq, [])
self.callback(data)
except Exception as e:
except Exception:
traceback.print_exc()
def getData(self, request, dataTimes):

View file

@ -1,6 +1,3 @@
##
##
#
# Implements IData for use by native Python clients to the Data Access
# Framework.
@ -17,14 +14,10 @@
from six import with_metaclass
import abc
import time
import traceback
import dynamicserialize
from awips.dataaccess import DataAccessLayer
from awips.dataaccess import INotificationSubscriber
from awips.QpidSubscriber import QpidSubscriber
from awips.ThriftClient import ThriftRequestException
from dynamicserialize.dstypes.com.raytheon.uf.common.time import DataTime

View file

@ -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
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
#

View file

@ -13,15 +13,15 @@
#
#
import os
import sys
class Record():
def __init__(self, level=0, msg='Test Message'):
self.levelno=level
self.message=msg
self.exc_info=sys.exc_info()
self.exc_text="TEST"
self.levelno = level
self.message = msg
self.exc_info = sys.exc_info()
self.exc_text = "TEST"
def getMessage(self):
return self.message

View file

@ -1,7 +1,3 @@
##
##
#
# A port of the Java ThriftSerializationContext, used for reading/writing
# DynamicSerialize objects to/from thrift.
@ -28,10 +24,7 @@
from thrift.Thrift import TType
import inspect
import sys
import types
import time
import numpy
import collections
import dynamicserialize
from dynamicserialize import dstypes, adapters
from dynamicserialize import SelfDescribingBinaryProtocol

View file

@ -1,7 +1,3 @@
##
##
#
# 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 GetGeometryDataResponse

View file

@ -1,10 +1,5 @@
##
##
# 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 ParmID
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.")
if self.precision < -2 or self.precision > 5:
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
if len(status) > 0:

View file

@ -1,10 +1,6 @@
##
##
# 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.message import WsId
class GetGridRequest(object):

View file

@ -1,11 +1,7 @@
##
##
# 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.auth.user import User
class LocalizationStreamGetRequest(AbstractLocalizationStreamRequest):