title: How to define the type of a dictionary of classes for mypy?
body: <p>I have several classes that use static methods to implement behaviour. I collect them in a python dictionary. How do I write down the type of the dictionary for mypy? Example below.</p>
  
  <pre><code>#!/usr/bin/env python3
  
  
  from typing import Dict
  from abc import ABCMeta, abstractmethod
  import enum
  
  
  class Cuties(enum.Enum):
      Doggo = enum.auto()
      Kitty = enum.auto()
      Birb = enum.auto()
  
  
  class Animal(metaclass=ABCMeta):
  
      @staticmethod
      @abstractmethod
      def give_sound() -&gt; str:
          ...
  
      @staticmethod
      @abstractmethod
      def likes_ferrets(ferret_fur_colour: str) -&gt; bool:
          ...
  
  
  class Doggo_Specifics(Animal):
  
      @staticmethod
      def give_sound() -&gt; str:
          return 'woofle'
  
      @staticmethod
      def likes_ferrets(ferret_fur_colour: str) -&gt; bool:
          return False
  
  
  class Kitty_Specifics(Animal):
  
      @staticmethod
      def give_sound() -&gt; str:
          return 'meow'
  
      @staticmethod
      def likes_ferrets(ferret_fur_colour: str) -&gt; bool:
          return True
  
  
  class Birb_Specifics(Animal):
  
      @staticmethod
      def give_sound() -&gt; str:
          return 'peep'
  
      @staticmethod
      def likes_ferrets(ferret_fur_colour: str) -&gt; bool:
          return ferret_fur_colour == 'brown'
  
  
  Specifics: Dict[Cuties, Animal] = {
      Cuties.Doggo: Doggo_Specifics,
      Cuties.Kitty: Kitty_Specifics,
      Cuties.Birb: Birb_Specifics,
  }
  </code></pre>
  
  <p>mypy gives errors for the type of <code>Specifics</code>:</p>
  
  <pre><code>test.py:62: error: Dict entry 0 has incompatible type "Cuties": "Type[Doggo_Specifics]"; expected "Cuties": "Animal"
  test.py:63: error: Dict entry 1 has incompatible type "Cuties": "Type[Kitty_Specifics]"; expected "Cuties": "Animal"
  test.py:64: error: Dict entry 2 has incompatible type "Cuties": "Type[Birb_Specifics]"; expected "Cuties": "Animal"
  </code></pre>
  
  <p>How should I define the type of <code>Specifics</code>?</p>