New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary import exceptions #319

Merged
merged 1 commit into from Mar 9, 2018

Conversation

Projects
None yet
3 participants
@epilicer
Contributor

epilicer commented Feb 22, 2018

BEGINRELEASENOTES

  • Remove unnecessary import exceptions from python

ENDRELEASENOTES

@@ -264,16 +272,24 @@ def _get(self, name):
# return getattr(self,name)
#traceback.print_stack()
msg = 'Geant4Action::GetProperty [Unhandled]: Cannot access property '+a.name()+'.'+name
raise exceptions.KeyError(msg)
if sys.version_info[0] < 3:
import exceptions

This comment has been minimized.

@andresailer

andresailer Feb 22, 2018

Member

This check and import is not necessary for python2:
https://docs.python.org/2/library/exceptions.html

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

Just dropping import exceptions and exceptions. should be fine.

@petricm petricm force-pushed the epilicer:check_python branch 2 times, most recently from 4f7de65 to 38b5a37 Mar 8, 2018

@petricm petricm changed the title from Check python version to Remove unnecessary import exceptions Mar 8, 2018

@petricm petricm requested a review from andresailer Mar 8, 2018

@@ -121,7 +121,7 @@ def _registerGlobalFilter(self,filter):
self.get().registerGlobalFilter(Interface.toAction(filter))
#---------------------------------------------------------------------------
def _getKernelProperty(self, name):
import exceptions
import sys

This comment has been minimized.

@andresailer

andresailer Mar 8, 2018

Member

sys is not used

#---------------------------------------------------------------------------
def _setKernelProperty(self, name, value):
import exceptions
import sys

This comment has been minimized.

@andresailer

andresailer Mar 8, 2018

Member

sys is not used

@@ -250,7 +250,7 @@ def _adopt(self,action): self.__adopt(action.get(),action.callback())
#---------------------------------------------------------------------------
def _get(self, name):
import exceptions, traceback
import sys, traceback

This comment has been minimized.

@andresailer

andresailer Mar 8, 2018

Member

sys is not used

def _set(self, name, value):
import exceptions
import sys

This comment has been minimized.

@andresailer

andresailer Mar 8, 2018

Member

sys is not used

@petricm petricm force-pushed the epilicer:check_python branch from 38b5a37 to ec58041 Mar 8, 2018

@petricm petricm merged commit 68b699f into AIDASoft:master Mar 9, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment