Skip to content

Commit

Permalink
:update: typo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
b3j0f committed Aug 21, 2015
1 parent 0f80a71 commit b63e8f1
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions b3j0f/aop/joinpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ class JoinpointError(Exception):
"""Handle Joinpoint errors
"""

pass


class Joinpoint(object):
"""Manage joinpoint execution with Advices.
Expand Down Expand Up @@ -199,9 +197,9 @@ class Joinpoint(object):
)

def __init__(
self,
target=None, args=None, kwargs=None, advices=None, ctx=None,
exec_ctx=None
self,
target=None, args=None, kwargs=None, advices=None, ctx=None,
exec_ctx=None
):
"""Initialize a new Joinpoint with optional parameters such as a
target, its calling arguments (args and kwargs) and a list of
Expand Down Expand Up @@ -276,8 +274,8 @@ def set_target(self, target, ctx=None):
self.apply_pointcut(target, ctx=ctx)

def start(
self, target=None, args=None, kwargs=None, advices=None, exec_ctx=None,
ctx=None
self, target=None, args=None, kwargs=None, advices=None,
exec_ctx=None, ctx=None
):
""" Start to proceed this Joinpoint in initializing target, its
arguments and advices. Call self.proceed at the end.
Expand Down Expand Up @@ -335,11 +333,13 @@ def proceed(self):

except StopIteration: # if no advice can be applied
# call target
return self.target(*self.args, **self.kwargs)
result = self.target(*self.args, **self.kwargs)

else:
# if has next, apply advice on self
return advice(self)
result = advice(self)

return result

def apply_pointcut(self, target, function=None, ctx=None):
"""Apply pointcut on input target and returns final interception.
Expand Down Expand Up @@ -384,8 +384,11 @@ def apply_pointcut(self, target, function=None, ctx=None):
updated.append(wrapper_update)

@wraps(function, assigned=assigned, updated=updated)
def function(*args, **kwargs):
pass
def wrapper(*args, **kwargs):
"""Default wrapper.
"""

function = wrapper

# get params from target wrapper
args, varargs, kwargs, _ = getargspec(function)
Expand Down Expand Up @@ -566,7 +569,7 @@ def get_advices(self, target):


def _apply_interception(
target, interception_fn, ctx=None, _globals=None
target, interception_fn, ctx=None, _globals=None
):
"""Apply interception on input target and return the final target.
Expand Down Expand Up @@ -603,7 +606,7 @@ def _apply_interception(

if module is not None:
# update all references by value
for name, member in getmembers(
for name, _ in getmembers(
module, lambda member: member is target):
setattr(module, name, interception_fn)
found = True
Expand Down

0 comments on commit b63e8f1

Please sign in to comment.