          """
          Return a list of the valid HTTP methods for this endpoint.
          """
          if hasattr(callback, 'actions'):
              actions = set(callback.actions.keys())
              http_method_names = set(callback.cls.http_method_names)
              methods = [method.upper() for method in actions & http_method_names]
          else:
              methods = callback.cls().allowed_methods
  
 
</s> remove         columns = [key for key in header.keys() if key != 'url']
        details = [key for key in header.keys() if key != 'url']
 </s> add         columns = [key for key in header if key != 'url']
        details = [key for key in header if key != 'url'] </s> remove         assert set(serializer.data.keys()) == {'name', 'ref'}
 </s> add         assert set(serializer.data) == {'name', 'ref'} </s> remove     return [ret[item] for item in sorted(ret.keys())]
 </s> add     return [ret[item] for item in sorted(ret)] </s> remove         for key in kwargs.keys():
 </s> add         for key in kwargs: </s> remove             for key in list(field_kwargs.keys()):
 </s> add             for key in list(field_kwargs):
            actions = set(callback.actions)
          """
          Return a list of the valid HTTP methods for this endpoint.
          """
          if hasattr(callback, 'actions'):
            actions = set(callback.actions)
              http_method_names = set(callback.cls.http_method_names)
              methods = [method.upper() for method in actions & http_method_names]
          else:
              methods = callback.cls().allowed_methods
  
keep keep keep keep replace keep keep keep keep keep
 Perfer iter(dict) over iter(dict.keys()) (#5736)

Calling dict.keys() is unnecessary. The two are functionally equivalent
on modern Pythons.

Inspired by Lennart Regebro's talk "Prehistoric Patterns in Python" from
PyCon 2017.

https://www.youtube.com/watch?v=V5-JH23Vk0I 
rest_framework/schemas/generators.py