      """
      pass
  
  
  def is_simple_callable(obj):
      """
      True if the object is a callable that takes no arguments.
      """
      function = inspect.isfunction(obj)
      method = inspect.ismethod(obj)
  
      if not (function or method):
          return False
  
      args, _, _, defaults = inspect.getargspec(obj)
 
</s> remove     if not (function or method):
        return False
 </s> add         args, _, _, defaults = inspect.getargspec(obj) </s> remove     args, _, _, defaults = inspect.getargspec(obj)
    len_args = len(args) if function else len(args) - 1
    len_defaults = len(defaults) if defaults else 0
    return len_args <= len_defaults
 </s> add         len_args = len(args) if function or is_unbound else len(args) - 1
        len_defaults = len(defaults) if defaults else 0
        return len_args <= len_defaults </s> remove     Same as `django.core.urlresolvers.reverse`, but optionally takes a request
 </s> add     Same as `django.urls.reverse`, but optionally takes a request </s> remove         path_components = path.strip('/').split('/')
        path_components = [
            component for component in path_components
            if '{' not in component
        ]
        if action in self.known_actions:
            # Default action, eg "/users/", "/users/{pk}/"
            idx = -1
        else:
            # Custom action, eg "/users/{pk}/activate/", "/users/active/"
            idx = -2
 </s> add         Given a list of all paths, return the common prefix which should be
        discounted when generating a schema structure.

        This will be the longest common string that does not include that last
        component of the URL, or the last component before a path parameter.

        For example:

        /api/v1/users/
        /api/v1/users/{pk}/

        The path prefix is '/api/v1/'
        """
        prefixes = []
        for path in paths:
            components = path.strip('/').split('/')
            initial_components = []
            for component in components:
                if '{' in component:
                    break
                initial_components.append(component)
            prefix = '/'.join(initial_components[:-1])
            if not prefix:
                # We can just break early in the case that there's at least
                # one URL that doesn't have a path prefix.
                return '/'
            prefixes.append('/' + prefix + '/')
        return os.path.commonprefix(prefixes)

    def create_view(self, callback, method, request=None):
        """
        Given a callback, return an actual view instance.
        """
        view = callback.cls()
        for attr, val in getattr(callback, 'initkwargs', {}).items():
            setattr(view, attr, val)
        view.args = ()
        view.kwargs = {}
        view.format_kwarg = None
        view.request = None
        view.action_map = getattr(callback, 'actions', None)

        actions = getattr(callback, 'actions', None)
        if actions is not None:
            if method == 'OPTIONS':
                view.action = 'metadata'
            else:
                view.action = actions.get(method.lower())

        if request is not None:
            view.request = clone_request(request, method)

        return view

    def has_view_permissions(self, path, method, view):
        """
        Return `True` if the incoming request has the correct view permissions.
        """
        if view.request is None:
            return True </s> remove         if not links:
            return None
 </s> add def is_list_view(path, method, view):
    """
    Return True if the given path/method appears to represent a list view.
    """
    if hasattr(view, 'action'):
        # Viewsets have an explicitly defined action, which we can inspect.
        return view.action == 'list'

    if method.lower() != 'get':
        return False
    path_components = path.strip('/').split('/')
    if path_components and '{' in path_components[-1]:
        return False
    return True


def endpoint_ordering(endpoint):
    path, method, callback = endpoint
    method_priority = {
        'GET': 0,
        'POST': 1,
        'PUT': 2,
        'PATCH': 3,
        'DELETE': 4
    }.get(method, 5)
    return (path, method_priority)


class EndpointInspector(object):
    """
    A class to determine the available API endpoints that a project exposes.
    """
    def __init__(self, patterns=None, urlconf=None):
        if patterns is None:
            if urlconf is None:
                # Use the default Django URL conf
                urlconf = settings.ROOT_URLCONF
if six.PY3:
    def is_simple_callable(obj):
        """
        True if the object is a callable that takes no arguments.
        """
        if not callable(obj):
            return False

        sig = inspect.signature(obj)
        params = sig.parameters.values()
        return all(param.default != param.empty for param in params)

else:
    def is_simple_callable(obj):
        function = inspect.isfunction(obj)
        method = inspect.ismethod(obj)

        if not (function or method):
            return False

        if method:
            is_unbound = obj.im_self is None
      """
      pass
  
  
if six.PY3:
    def is_simple_callable(obj):
        """
        True if the object is a callable that takes no arguments.
        """
        if not callable(obj):
            return False

        sig = inspect.signature(obj)
        params = sig.parameters.values()
        return all(param.default != param.empty for param in params)

else:
    def is_simple_callable(obj):
        function = inspect.isfunction(obj)
        method = inspect.ismethod(obj)

        if not (function or method):
            return False

        if method:
            is_unbound = obj.im_self is None
if six.PY3:
    def is_simple_callable(obj):
        """
        True if the object is a callable that takes no arguments.
        """
        if not callable(obj):
            return False

        sig = inspect.signature(obj)
        params = sig.parameters.values()
        return all(param.default != param.empty for param in params)

else:
    def is_simple_callable(obj):
        function = inspect.isfunction(obj)
        method = inspect.ismethod(obj)

        if not (function or method):
            return False

        if method:
            is_unbound = obj.im_self is None
if six.PY3:
    def is_simple_callable(obj):
        """
        True if the object is a callable that takes no arguments.
        """
        if not callable(obj):
            return False

        sig = inspect.signature(obj)
        params = sig.parameters.values()
        return all(param.default != param.empty for param in params)

else:
    def is_simple_callable(obj):
        function = inspect.isfunction(obj)
        method = inspect.ismethod(obj)

        if not (function or method):
            return False

        if method:
            is_unbound = obj.im_self is None
if six.PY3:
    def is_simple_callable(obj):
        """
        True if the object is a callable that takes no arguments.
        """
        if not callable(obj):
            return False

        sig = inspect.signature(obj)
        params = sig.parameters.values()
        return all(param.default != param.empty for param in params)

else:
    def is_simple_callable(obj):
        function = inspect.isfunction(obj)
        method = inspect.ismethod(obj)

        if not (function or method):
            return False

        if method:
            is_unbound = obj.im_self is None
if six.PY3:
    def is_simple_callable(obj):
        """
        True if the object is a callable that takes no arguments.
        """
        if not callable(obj):
            return False

        sig = inspect.signature(obj)
        params = sig.parameters.values()
        return all(param.default != param.empty for param in params)

else:
    def is_simple_callable(obj):
        function = inspect.isfunction(obj)
        method = inspect.ismethod(obj)

        if not (function or method):
            return False

        if method:
            is_unbound = obj.im_self is None
if six.PY3:
    def is_simple_callable(obj):
        """
        True if the object is a callable that takes no arguments.
        """
        if not callable(obj):
            return False

        sig = inspect.signature(obj)
        params = sig.parameters.values()
        return all(param.default != param.empty for param in params)

else:
    def is_simple_callable(obj):
        function = inspect.isfunction(obj)
        method = inspect.ismethod(obj)

        if not (function or method):
            return False

        if method:
            is_unbound = obj.im_self is None
  
      if not (function or method):
          return False
  
      args, _, _, defaults = inspect.getargspec(obj)
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
 Version 3.5 (#4525)

* Start test case

* Added 'requests' test client

* Address typos

* Graceful fallback if requests is not installed.

* Add cookie support

* Tests for auth and CSRF

* Py3 compat

* py3 compat

* py3 compat

* Add get_requests_client

* Added SchemaGenerator.should_include_link

* add settings for html cutoff on related fields

* Router doesn't work if prefix is blank, though project urls.py handles prefix

* Fix Django 1.10 to-many deprecation

* Add django.core.urlresolvers compatibility

* Update django-filter & django-guardian

* Check for empty router prefix; adjust URL accordingly

It's easiest to fix this issue after we have made the regex.  To try
to fix it before would require doing something different for List vs
Detail, which means we'd have to know which type of url we're
constructing before acting accordingly.

* Fix misc django deprecations

* Use TOC extension instead of header

* Fix deprecations for py3k

* Add py3k compatibility to is_simple_callable

* Add is_simple_callable tests

* Drop python 3.2 support (EOL, Dropped by Django)

* schema_renderers= should *set* the renderers, not append to them.

* API client (#4424)

* Fix release notes

* Add note about 'User account is disabled.' vs 'Unable to log in'

* Clean up schema generation (#4527)

* Handle multiple methods on custom action (#4529)

* RequestsClient, CoreAPIClient

* exclude_from_schema

* Added 'get_schema_view()' shortcut

* Added schema descriptions

* Better descriptions for schemas

* Add type annotation to schema generation

* Coerce schema 'pk' in path to actual field name

* Deprecations move into assertion errors

* Use get_schema_view in tests

* Updte CoreJSON media type

* Handle schema structure correctly when path prefixs exist. Closes #4401

* Add PendingDeprecation to Router schema generation.

* Added SCHEMA_COERCE_PATH_PK and SCHEMA_COERCE_METHOD_NAMES

* Renamed and documented 'get_schema_fields' interface. 
rest_framework/fields.py