Skip to content

Commit

Permalink
Apply Python 3 futurize transform lib2to3.fixes.fix_funcattrs.
Browse files Browse the repository at this point in the history
  • Loading branch information
timabbott committed Nov 1, 2015
1 parent 8c34c40 commit 5ce6a3c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/zulip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def call(self, *args, **kwargs):
else:
req_url = url
return self.do_api_query(request, API_VERSTRING + req_url, method=method, **query_kwargs)
call.func_name = name
call.__name__ = name
setattr(cls, name, call)

def call_on_each_event(self, callback, event_types=None, narrow=[]):
Expand Down
10 changes: 5 additions & 5 deletions zerver/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,13 @@ def __init__(self, whence=None, converter=None, default=NotSpecified, validator=
# expected to call json_error or json_success, as it uses json_error
# internally when it encounters an error
def has_request_variables(view_func):
num_params = view_func.func_code.co_argcount
if view_func.func_defaults is None:
num_params = view_func.__code__.co_argcount
if view_func.__defaults__ is None:
num_default_params = 0
else:
num_default_params = len(view_func.func_defaults)
default_param_names = view_func.func_code.co_varnames[num_params - num_default_params:]
default_param_values = view_func.func_defaults
num_default_params = len(view_func.__defaults__)
default_param_names = view_func.__code__.co_varnames[num_params - num_default_params:]
default_param_values = view_func.__defaults__
if default_param_values is None:
default_param_values = []

Expand Down
2 changes: 1 addition & 1 deletion zerver/lib/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def cache(func):
Uses a key based on the function's name, filename, and
the repr() of its arguments."""

func_uniqifier = '%s-%s' % (func.func_code.co_filename, func.func_name)
func_uniqifier = '%s-%s' % (func.__code__.co_filename, func.__name__)

@wraps(func)
def keyfunc(*args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion zerver/management/commands/runtornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def get_response(self, request):

if response is None:
try:
view_name = callback.func_name
view_name = callback.__name__
except AttributeError:
view_name = callback.__class__.__name__ + '.__call__'
raise ValueError("The view %s.%s returned None." %
Expand Down

0 comments on commit 5ce6a3c

Please sign in to comment.