mod_generics_cache.py 433 B

123456789101112131415161718192021
  1. """Module for testing the behavior of generics across different modules."""
  2. from typing import TypeVar, Generic, Optional
  3. default_a: Optional['A'] = None
  4. default_b: Optional['B'] = None
  5. T = TypeVar('T')
  6. class A(Generic[T]):
  7. some_b: 'B'
  8. class B(Generic[T]):
  9. class A(Generic[T]):
  10. pass
  11. my_inner_a1: 'B.A'
  12. my_inner_a2: A
  13. my_outer_a: 'A' # unless somebody calls get_type_hints with localns=B.__dict__