(self, method)
If method's id matches our parent's path, add it there, return True.
If method's id matches our parent's path, add it there, return True.
If method s id matches our parent s path add it there return True .
def reparent(self, method):
    """If method's id matches our parent's path, add it there, return True."""
    if not self.api.get('reparentMethodsUsingId'):
      return False
    id_ancestors = method.get('id', '').split('.')[:-1]
    if [a.codeName for a in self.ancestors] == id_ancestors:
      if isinstance(self.parent, Api):
        methods = self.parent.top_level_methods
      else:
        methods = self.parent.methods
      methods.append(method)
      methods.sort(key=lambda m: m.get('name'))
      method.SetParent(self.parent)
      return True
def reparent ( self , method ) : if not self . api . get ( 'reparentMethodsUsingId' ) : return False id_ancestors = method . get ( 'id' , '' ) . split ( '.' ) [ : - 1 ] if [ a . codeName for a in self . ancestors ] == id_ancestors : if isinstance ( self . parent , Api ) : methods = self . parent . top_level_methods else : methods = self . parent . methods methods . append ( method ) methods . sort ( key = lambda m : m . get ( 'name' ) ) method . SetParent ( self . parent ) return True