Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
[util/reflection] fix deprecation warning for Py35
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher committed Mar 11, 2016
1 parent f9f5cbd commit a4323cf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pyemma/util/reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
from __future__ import division, print_function, absolute_import

import inspect
from six import string_types
import six
#from six import string_types
from collections import namedtuple

__author__ = 'noe, marscher'
Expand Down Expand Up @@ -87,10 +88,10 @@ def getargspec_no_self(func):
if (p.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD and
p.default is not p.empty)
] or None

if args[0] == 'self':
args.pop(0)

return ArgSpec(args, varargs, varkw, defaults)

except AttributeError:
Expand Down Expand Up @@ -137,7 +138,7 @@ def call_member(obj, f, *args, **kwargs):
in that case
"""
# get function name
if not isinstance(f, string_types):
if not isinstance(f, six.string_types):
fname = f.__func__.__name__
else:
fname = f
Expand All @@ -155,5 +156,5 @@ def get_default_args(func):
"""
returns a dictionary of arg_name:default_values for the input function
"""
args, varargs, keywords, defaults = inspect.getargspec(func)
args, varargs, keywords, defaults = getargspec_no_self(func)
return dict(zip(args[-len(defaults):], defaults))

0 comments on commit a4323cf

Please sign in to comment.