Skip to content

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul Kumar committed Jul 4, 2011
1 parent 0759600 commit 3295036
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions augment.py
Expand Up @@ -6,7 +6,7 @@
from inspect import getouterframes, currentframe
from functools import wraps

def get_args_and_name(fn):
def _get_args_and_name(fn):
"""
Returns `(args, name)` where `args` are names of positional
arguments `fn` takes and `name` is `fn.__name__`
Expand Down Expand Up @@ -65,7 +65,7 @@ def ensure_args(error_handler=None, **rules):
TypeError: Errors in 'foo'. 'b = ab' violates constraint.
"""
def decorator(fn):
allargs, fn_name = get_args_and_name(fn)
allargs, fn_name = _get_args_and_name(fn)
@wraps(fn)
def wrapper(*args, **kwargs):
pargs = list(allargs)[:len(args)]
Expand Down Expand Up @@ -137,7 +137,7 @@ def ensure_one_of(exclusive=False, **rules):
TypeError: Errors in 'foo'. Only one of '['a', 'b']' must validate.
"""
def decorator(fn):
allargs, fn_name = get_args_and_name(fn)
allargs, fn_name = _get_args_and_name(fn)
@wraps(fn)
def wrapper(*args, **kwargs):
pargs = list(allargs)[:len(args)]
Expand Down Expand Up @@ -172,7 +172,7 @@ def transform_args(**rules):
4
"""
def decorator(fn):
allargs, fn_name = get_args_and_name(fn)
allargs, fn_name = _get_args_and_name(fn)
@wraps(fn)
def wrapper(*args, **kwargs):
pargs = list(allargs)[:len(args)]
Expand Down

0 comments on commit 3295036

Please sign in to comment.