title: How to type Python mixin with superclass calls?
body: <p>I'm trying to use the <a href="https://stackoverflow.com/a/47120048/96588"><code>FieldMixin</code> from this answer</a> in my project, but I'm having trouble getting it to pass <code>mypy</code> checks. The current code:</p>
  
  <pre><code>class DynamicFieldsMixin(Serializer):
      context: Dict[str, Any]
  
      def get_field_names(
          self, declared_fields: OrderedDict, info: FieldInfo
      ) -&gt; Set[str]:
          field_names: Set[str] = self.context.get(
              "fields",
              super().get_field_names(declared_fields, info)
          )
          return field_names
  </code></pre>
  
  <p>Inheriting from <code>rest_framework.serializers.Serializer</code> seems weird, and I wonder if there's a way to avoid that, since it's meant to be mixed into actual <code>Serializer</code> classes. Just removing the superclass results in this error:</p>
  
  <blockquote>
    <p>error: "get_field_names" undefined in superclass</p>
  </blockquote>
  
  <p><code>mypy</code> configuration:</p>
  
  <pre><code>[mypy]
  check_untyped_defs = true
  disallow_untyped_defs = true
  ignore_missing_imports = true
  no_implicit_optional = true
  warn_redundant_casts = true
  warn_return_any = true
  warn_unused_ignores = true
  </code></pre>