parameters: (bases)
return_statement: return tuple(new_bases)
docstring: Resolve MRO entries dynamically as specified by PEP 560.
docstring_summary: Resolve MRO entries dynamically as specified by PEP 560.
docstring_tokens: Resolve MRO entries dynamically as specified by PEP 560 .
function: def resolve_bases(bases):
      """Resolve MRO entries dynamically as specified by PEP 560."""
      new_bases = list(bases)
      updated = False
      shift = 0
      for i, base in enumerate(bases):
          if isinstance(base, type) and not isinstance(base, GenericAlias):
              continue
          if not hasattr(base, "__mro_entries__"):
              continue
          new_base = base.__mro_entries__(bases)
          updated = True
          if not isinstance(new_base, tuple):
              raise TypeError("__mro_entries__ must return a tuple")
          else:
              new_bases[i+shift:i+shift+1] = new_base
              shift += len(new_base) - 1
      if not updated:
          return bases
      return tuple(new_bases)
function_tokens: def resolve_bases ( bases ) : new_bases = list ( bases ) updated = False shift = 0 for i , base in enumerate ( bases ) : if isinstance ( base , type ) and not isinstance ( base , GenericAlias ) : continue if not hasattr ( base , "__mro_entries__" ) : continue new_base = base . __mro_entries__ ( bases ) updated = True if not isinstance ( new_base , tuple ) : raise TypeError ( "__mro_entries__ must return a tuple" ) else : new_bases [ i + shift : i + shift + 1 ] = new_base shift += len ( new_base ) - 1 if not updated : return bases return tuple ( new_bases )