Skip to content

Commit

Permalink
Do not import exceptions module
Browse files Browse the repository at this point in the history
Required for compatibility with Python >= 2.7 and 3.

According to the Python 2.7 documentation:

"The exceptions are defined in the module exceptions. This module never needs to be imported explicitly: the exceptions are provided in the built-in namespace as well as the exceptions module."

The Python 3 manual makes no mention of the exceptions module.
  • Loading branch information
lpsinger committed Jan 26, 2017
1 parent 77e30db commit 8d51843
Show file tree
Hide file tree
Showing 63 changed files with 19 additions and 85 deletions.
1 change: 0 additions & 1 deletion glue/bin/LSCdataFind
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import sys
import os
import getopt
import re
import exceptions

try:
from pyGlobus import security
Expand Down
2 changes: 0 additions & 2 deletions glue/bin/dmtdq_seg_insert
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import sys
import os
import getopt
import re
import exceptions
import re

try:
from glue.segmentdb import segmentdb_utils
Expand Down
2 changes: 0 additions & 2 deletions glue/bin/ldbdc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import sys
import os
import getopt
import re
import exceptions
import re

try:
from glue.segmentdb import segmentdb_utils
Expand Down
3 changes: 1 addition & 2 deletions glue/bin/ldbdd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import getopt
import time
import socket
import six.moves.configparser
import exceptions
import logging
import logging.handlers
from pyGlobus import io
Expand Down Expand Up @@ -223,7 +222,7 @@ if runAsDaemon:
logger = logging.getLogger('ldbdd')


class LDBDDaemonException(exceptions.Exception):
class LDBDDaemonException(Exception):
"""
Class representing exceptions withing the LDBDDaemon class.
"""
Expand Down
1 change: 0 additions & 1 deletion glue/bin/ligo_data_find
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ __date__ = git_version.date
import os
import getopt
import re
import exceptions
import six.moves.http_client
import urlparse
import time
Expand Down
1 change: 0 additions & 1 deletion glue/bin/ligolw_publish_dqxml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import sys
import pwd
import os
import re
import exceptions
import signal
import re
import time
Expand Down
1 change: 0 additions & 1 deletion glue/bin/ligolw_segment_insert
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import time
import sys
import commands
import StringIO
import exceptions
import binascii
from optparse import OptionParser
import six
Expand Down
2 changes: 0 additions & 2 deletions glue/bin/segdb_coalesce
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import sys
import pwd
import os
import re
import exceptions
import re
import time
import logging
import logging.handlers
Expand Down
1 change: 0 additions & 1 deletion glue/glue/LDBDClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import sys
import os
import exceptions
import types
import re
import six.moves.cPickle
Expand Down
3 changes: 1 addition & 2 deletions glue/glue/LDBDServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import pyRXP
except ImportError:
import pyRXPU as pyRXP
import exceptions
import socket
import six.moves.socketserver
import six.moves.cPickle
Expand Down Expand Up @@ -110,7 +109,7 @@ def shutdown():
del dmt_proc_dict
del dmt_seg_def_dict

class ServerHandlerException(exceptions.Exception):
class ServerHandlerException(Exception):
"""
Class representing exceptions within the ServerHandler class.
"""
Expand Down
1 change: 0 additions & 1 deletion glue/glue/LDBDWClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import sys
import os
import exceptions
import types
import re
import six.moves.cPickle
Expand Down
3 changes: 1 addition & 2 deletions glue/glue/LDBDWServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import pyRXP
except ImportError:
import pyRXPU as pyRXP
import exceptions
import socket
import six.moves.cPickle
import logging
Expand Down Expand Up @@ -760,7 +759,7 @@ def insertdmt(self, environ, start_response):

return [ result ]

class GridMapError(exceptions.Exception):
class GridMapError(Exception):
"""
Raised for errors in GridMap class
"""
Expand Down
5 changes: 2 additions & 3 deletions glue/glue/LDRdataFindClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import sys
import os
import exceptions

from pyGlobus import io
from pyGlobus import security
Expand All @@ -35,7 +34,7 @@ def version():
return __version__


class LSCdataFindClientException(exceptions.Exception):
class LSCdataFindClientException(Exception):
"""
Exceptions raised by the classes and methods in this client
will be instances of this class.
Expand All @@ -51,7 +50,7 @@ def __init__(self, args=None):
self.args = args


class LDRdataFindClientException(exceptions.Exception):
class LDRdataFindClientException(Exception):
"""
Exceptions raised by the classes and methods in this module
will be instances of this class.
Expand Down
3 changes: 1 addition & 2 deletions glue/glue/auth/saml.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

import re
from six.moves import urllib
import exceptions

class LIGOSAMLClientException(exceptions.Exception):
class LIGOSAMLClientException(Exception):
"""
"""
pass
Expand Down
5 changes: 2 additions & 3 deletions glue/glue/ldbd.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import string
import re
import csv
import exceptions
try:
import DB2
except:
Expand Down Expand Up @@ -68,12 +67,12 @@ class LIGOLWStream(csv.Dialect):
csv.register_dialect("LIGOLWStream",LIGOLWStream)


class LIGOLwParseError(exceptions.Exception):
class LIGOLwParseError(Exception):
"""Error parsing LIGO lightweight XML file"""
pass


class LIGOLwDBError(exceptions.Exception):
class LIGOLwDBError(Exception):
"""Error interacting with database"""
pass

Expand Down
5 changes: 2 additions & 3 deletions glue/glue/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import os
import sys
import string, re
import exceptions
import time
import random
import math
Expand Down Expand Up @@ -347,7 +346,7 @@ def recurse_pfn_cache(node,caches=[]):
return caches


class CondorError(exceptions.Exception):
class CondorError(Exception):
"""Error thrown by Condor Jobs"""
def __init__(self, args=None):
self.args = args
Expand All @@ -361,7 +360,7 @@ class CondorDAGJobError(CondorError):
pass
class CondorDAGNodeError(CondorError):
pass
class SegmentError(exceptions.Exception):
class SegmentError(Exception):
def __init__(self, args=None):
self.args = args

Expand Down
5 changes: 0 additions & 5 deletions glue/misc/generate_vcs_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
from __future__ import print_function
__author__ = 'Adam Mercer <[email protected]>'

try: # python 3
LookupError
except NameError: # python 2
from exceptions import LookupError

# import required system modules
import os
import sys
Expand Down
3 changes: 1 addition & 2 deletions lalapps/src/calibration/strain.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
__version__ = '$Revision$'

import string,sys,os
import exceptions
from glue import pipeline
from pylab import *
import operator
from math import *
import numpy
import time

class StringError(exceptions.Exception):
class StringError(Exception):
def __init__(self, args=None):
self.args = args

Expand Down
2 changes: 1 addition & 1 deletion lalapps/src/findchirp/plotbankefficiency.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__name__ = "plotbankefficiency"
__title__ = "Figure of merits for BankEfficiency results."

import getopt, sys, os, re, glob, exceptions, dircache, string
import getopt, sys, os, re, glob, dircache, string
from optparse import *
from matplotlib.ticker import FormatStrFormatter
from numpy import *
Expand Down
1 change: 0 additions & 1 deletion lalapps/src/inspiral/add_septime.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import sys
from optparse import *
import exceptions
from types import *

import matplotlib
Expand Down
1 change: 0 additions & 1 deletion lalapps/src/inspiral/combinedFAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os
from optparse import *
import re
import exceptions
import glob
from types import * #!!!what does this do?
from operator import itemgetter
Expand Down
1 change: 0 additions & 1 deletion lalapps/src/inspiral/ifar_generate_dag.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys
import os
from optparse import *
import exceptions
import subprocess
import ConfigParser as cp

Expand Down
3 changes: 1 addition & 2 deletions lalapps/src/inspiral/inspiral.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@

import copy
import string
import exceptions
import sys, os, re, subprocess
from glue import pipeline
from glue import lal


class InspiralError(exceptions.Exception):
class InspiralError(Exception):
def __init__(self, args=None):
self.args = args

Expand Down
1 change: 0 additions & 1 deletion lalapps/src/inspiral/lalapps_link_old_ihope.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
from optparse import *
import re
import exceptions
import glob
from types import *

Expand Down
1 change: 0 additions & 1 deletion lalapps/src/inspiral/simulate_galaxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os
import shutil
import re
import exceptions
import glob
import string

Expand Down
1 change: 0 additions & 1 deletion lalapps/src/inspiral/test/find_rms_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
from optparse import *
import re
import exceptions
import glob
#from types import *

Expand Down
1 change: 0 additions & 1 deletion lalapps/src/pulsar/HeterodyneSearch/knope_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
__version__ = '$Revision$'

import string
import exceptions
import os
from glue import pipeline
import sys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import re
import string
import tempfile
import ConfigParser
import exceptions

# append the lalapps python path
# sys.path.append('/home/matthew/lscsoft/lib/python')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import re
import string
import tempfile
import ConfigParser
import exceptions

# import the lalapps pipeline modules
from glue import pipeline
Expand Down
1 change: 0 additions & 1 deletion lalapps/src/pulsar/HeterodyneSearch/make_frame_cache
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import sys
import os
import string
import re
import exceptions
import getopt

# program usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import re
import string
import tempfile
import exceptions
import random
import math

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
__version__ = '$Revision$'

import string
import exceptions
import os
from glue import pipeline

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
__version__ = '$Revision$'

import string
import exceptions
import os
from glue import pipeline

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import re
import string
import tempfile
import ConfigParser
import exceptions

# append the lalapps python path
sys.path.append('/home/matthew/lscsoft/lib/python')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import re
import string
import tempfile
import exceptions
import random
import math
import ConfigParser
Expand Down
3 changes: 1 addition & 2 deletions lalapps/src/ring/ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
__version__ = '$Revision$'

import string
import exceptions
from glue import pipeline


class RingError(exceptions.Exception):
class RingError(Exception):
def __init__(self, args=None):
self.args = args

Expand Down
Loading

0 comments on commit 8d51843

Please sign in to comment.