(root)/
Python-3.11.7/
Lib/
test/
typinganndata/
ann_module2.py
       1  """
       2  Some correct syntax for variable annotation here.
       3  More examples are in test_grammar and test_parser.
       4  """
       5  
       6  from typing import no_type_check, ClassVar
       7  
       8  i: int = 1
       9  j: int
      10  x: float = i/10
      11  
      12  def f():
      13      class ESC[4;38;5;81mC: ...
      14      return C()
      15  
      16  f().new_attr: object = object()
      17  
      18  class ESC[4;38;5;81mC:
      19      def __init__(self, x: int) -> None:
      20          self.x = x
      21  
      22  c = C(5)
      23  c.new_attr: int = 10
      24  
      25  __annotations__ = {}
      26  
      27  
      28  @no_type_check
      29  class ESC[4;38;5;81mNTC:
      30      def meth(self, param: complex) -> None:
      31          ...
      32  
      33  class ESC[4;38;5;81mCV:
      34      var: ClassVar['CV']
      35  
      36  CV.var = CV()