aboutsummaryrefslogtreecommitdiffstats
path: root/iceci/decorator
diff options
context:
space:
mode:
authorEdan Binshtok <eb578m@intl.att.com>2017-11-19 11:50:50 +0200
committerEdan Binshtok <eb578m@intl.att.com>2017-11-19 11:51:04 +0200
commit71891b3040605103397ffa7fb349215eced3a2c3 (patch)
tree22dda04edd1b8ee0d0de2a6a260d6d60e42cba25 /iceci/decorator
parent433a8256e31f755f5e236491bbe39d3db24d6d6d (diff)
Pep8 another fixes
Add more fixes to pep8 Issue-ID: VVP-25 Change-Id: Icc3bd3977ced2b537c858a9801e04a6bf6d1db05 Signed-off-by: Edan Binshtok <eb578m@intl.att.com>
Diffstat (limited to 'iceci/decorator')
-rw-r--r--iceci/decorator/__init__.py4
-rw-r--r--iceci/decorator/exception_decor.py9
-rw-r--r--iceci/decorator/logFuncEntry.py18
-rw-r--r--iceci/decorator/repeat.py9
4 files changed, 24 insertions, 16 deletions
diff --git a/iceci/decorator/__init__.py b/iceci/decorator/__init__.py
index 30d7152..32b601a 100644
--- a/iceci/decorator/__init__.py
+++ b/iceci/decorator/__init__.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
diff --git a/iceci/decorator/exception_decor.py b/iceci/decorator/exception_decor.py
index 467f2ce..2bbced7 100644
--- a/iceci/decorator/exception_decor.py
+++ b/iceci/decorator/exception_decor.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,6 @@
# ============LICENSE_END============================================
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import logging
import traceback
from services.logging_service import LoggingServiceFactory
@@ -48,7 +47,7 @@ logger = LoggingServiceFactory.get_logger()
def exception():
"""
- A decorator that wraps the passed in function and logs
+ A decorator that wraps the passed in function and logs
exceptions should one occur
@param logger: The logging object
@@ -59,7 +58,7 @@ def exception():
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
- except:
+ except BaseException:
err = "There was an exception in %s" % func.__name__
logger.error(err)
session.errorCounter += 1
diff --git a/iceci/decorator/logFuncEntry.py b/iceci/decorator/logFuncEntry.py
index 0995f3b..3caac92 100644
--- a/iceci/decorator/logFuncEntry.py
+++ b/iceci/decorator/logFuncEntry.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -39,6 +39,7 @@
from services.logging_service import LoggingServiceFactory
logger = LoggingServiceFactory.get_logger()
+
def _aop(decorator):
'''This decorator can be used to turn simple functions
into well-behaved decorators, so long as the decorators
@@ -55,7 +56,7 @@ def _aop(decorator):
g.__doc__ = f.__doc__
g.__dict__.update(f.__dict__)
return g
-
+
# Now a few lines needed to make _aop itself
# be a well-behaved decorator.
new_decorator.__name__ = decorator.__name__
@@ -66,10 +67,17 @@ def _aop(decorator):
#
# Sample Use:
#
+
+
@_aop
def logFuncEntry(func):
def foo(*args, **kwargs):
- logger.debug('calling {}'.format(func.__name__)+" | "+str(args)+" | "+str(kwargs))
+ logger.debug(
+ 'calling {}'.format(
+ func.__name__) +
+ " | " +
+ str(args) +
+ " | " +
+ str(kwargs))
return func(*args, **kwargs)
return foo
-
diff --git a/iceci/decorator/repeat.py b/iceci/decorator/repeat.py
index 38eac03..cf57a14 100644
--- a/iceci/decorator/repeat.py
+++ b/iceci/decorator/repeat.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -36,7 +36,9 @@
# ============LICENSE_END============================================
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-import unittest,time
+import time
+
+
def repeat(times):
def repeatHelper(f):
def callHelper(*args):
@@ -46,4 +48,3 @@ def repeat(times):
return callHelper
time.sleep(3)
return repeatHelper
-