Lines Matching full:foo*

257         class Foo:
259 class FooStr:
261 class FooStrTyping:
264 for target in [Foo, FooStr, FooStrTyping]:
313 class Foo:
315 class FooStr:
317 class FooStrTyping:
320 for target in [Foo, FooStr, FooStrTyping]:
1968 def foo(a: Callable[..., T]):
1971 self.assertEqual(get_type_hints(foo, globals(), locals()),
2207 Literal[b"foo", u"bar"]
2221 Literal[{"foo": 3, "bar": 4}]
2226 List[Literal[("foo", "bar", "baz")]]
2230 self.assertEqual(repr(Literal[1, True, "foo"]), "typing.Literal[1, True, 'foo']")
2266 class Foo(Literal[1]): pass
2875 class Foo: ...
2877 f = Foo()
3238 c.foo = 42
3243 self.assertEqual(x.foo, 42)
3246 self.assertEqual(x.__dict__, {'foo': 42, 'bar': 'abc'})
3346 class Foo(P):
3350 Foo() # Previously triggered RecursionError
3495 b.foo = 42
3496 self.assertEqual(b.__dict__, {'foo': 42})
3708 def foobar(x: List[List['CC']]): ...
3709 def foobar2(x: list[list[ForwardRef('CC')]]): ...
3710 def foobar3(x: list[ForwardRef('CC | int')] | int): ...
3713 get_type_hints(foobar, globals(), locals()),
3717 get_type_hints(foobar2, globals(), locals()),
3721 get_type_hints(foobar3, globals(), locals()),
3863 c.foo = 42
3868 self.assertEqual(x.foo, 42)
3870 self.assertEqual(x.__dict__, {'foo': 42, 'bar': 'abc'})
3976 def foo(x: C['C']): ...
3977 self.assertEqual(get_type_hints(foo, globals(), locals())['x'], C[C])
3991 d.foobar = 'no'
3993 d_int.foobar = 'no'
4117 def foo(x: T):
4128 foo(42)
4164 c = C('foo')
4165 self.assertEqual(c.arg, 'foo')
4182 c = C('foo')
4183 self.assertEqual(c.from_a, 'foo')
4184 self.assertEqual(c.from_c, 'foo')
4192 A('foo')
4212 c = C('foo')
4213 self.assertEqual(c.arg, 'foo')
4231 class Foo(obj):
4559 def foo(a: c1_gth, b: c2_gth):
4562 self.assertEqual(get_type_hints(foo, globals(), locals()), {'a': C, 'b': C})
4578 def foo(a: c1_gth, b: c2_gth):
4580 get_type_hints(foo, globals(), locals())
4625 def foo(a: Union['T']):
4628 self.assertEqual(get_type_hints(foo, globals(), locals()),
4631 def foo(a: tuple[ForwardRef('T')] | int):
4634 self.assertEqual(get_type_hints(foo, globals(), locals()),
4639 def foo(a: Tuple['T']):
4642 self.assertEqual(get_type_hints(foo, globals(), locals()),
4645 def foo(a: tuple[ForwardRef('T')]):
4648 self.assertEqual(get_type_hints(foo, globals(), locals()),
4652 def foo(a: 'List[\'int\']'):
4654 self.assertEqual(get_type_hints(foo, globals(), locals()),
4687 foo: List[Value]
4689 foo: Union[Value, ValueList]
4691 foo: Union[List[Value], ValueList]
4693 foo: Union[Value, List[Value], ValueList]
4697 {'foo': List[Union[str, List[Union[str, List['Value']]]]]})
4699 {'foo': Union[str, List[Union[str, List['Value']]]]})
4701 {'foo': Union[
4707 {'foo': Union[
4716 def foo(a: Callable[['T'], 'T']):
4719 self.assertEqual(get_type_hints(foo, globals(), locals()),
4724 def foo(a: 'Callable[..., T]'):
4727 self.assertEqual(get_type_hints(foo, globals(), locals()),
4755 def foo(a: 'Node[T'):
4759 get_type_hints(foo)
4763 def foo(a: 'Noode[T]'):
4767 get_type_hints(foo, locals())
4772 def foo(a: 'whatevers') -> {}:
4775 th = get_type_hints(foo)
4782 def foo(a: 'whatevers') -> {}:
4785 cth = get_type_hints(C.foo)
4787 ith = get_type_hints(C().foo)
4802 def foo(self, x: int): ...
4804 self.assertEqual(get_type_hints(Child.foo), {'x': int})
4890 foo: typing.ClassVar[int] = 7
4892 foo: ClassVar[int] = 7
4894 foo: 'typing.ClassVar[int]' = 7
4896 foo: 'ClassVar[int]' = 7
4898 expected_result = {'foo': typing.ClassVar[int]}
4904 foo: 'typing.ClassVar[typing.ClassVar[int]]' = 7
4906 foo: ClassVar['ClassVar[int]'] = 7
4921 def foo(a: 'whatevers') -> {}:
4926 def foo(a: 'whatevers') -> {}:
4929 self.assertEqual(foo.__name__, 'foo')
4930 th = get_type_hints(foo)
4932 cth = get_type_hints(C.foo)
4934 ith = get_type_hints(C().foo)
4939 " def foo(self, a: 'C') -> 'D': pass\n"
4945 hints = get_type_hints(ns['C'].foo)
5150 class Bar(_typed_dict_helper.Foo, total=False):
5153 class BarGeneric(_typed_dict_helper.FooGeneric[T], total=False):
5177 title: Annotated[Annotated[Required[str], "foobar"], "another level"]
5183 title: Annotated[Required[str], "foobar"]
5187 title: Annotated[Annotated[Required[str], "foobar"], "another level"]
5191 title: Annotated['Annotated[Required[str], "foobar"]', "another level"]
5257 self.assertEqual(gth(ann_module.foo), {'x': int})
5330 def foobar(x: List['X']): ...
5333 get_type_hints(foobar, globals(), locals()),
5337 get_type_hints(foobar, globals(), locals(), include_extras=True),
5341 def foobar(x: list[ForwardRef('X')]): ...
5344 get_type_hints(foobar, globals(), locals()),
5348 get_type_hints(foobar, globals(), locals(), include_extras=True),
5441 class Foo:
5445 self.assertEqual(get_type_hints(Foo), {'x': str})
5458 foo: tuple
5463 self.assertEqual(get_type_hints(BadType), {'foo': tuple, 'bar': list})
5490 'title': Annotated[Required[str], "foobar"],
5496 'title': Annotated[Required[str], "foobar", "another level"],
5502 'title': Annotated[Required[str], "foobar", "another level"],
5518 "title": Annotated[Required[str], "foobar", "another level"],
5641 "async def foo() -> typing.Awaitable[int]:\n"
5644 foo = ns['foo']
5645 g = foo()
5647 self.assertNotIsInstance(foo, typing.Awaitable)
5648 g.send(None) # Run foo() till completion, to avoid warning.
5653 "async def foo():\n"
5656 foo = ns['foo']
5657 g = foo()
5661 self.assertNotIsInstance(foo, typing.Coroutine)
5910 def foo():
5912 g = foo()
6036 if other.__name__ == 'Foo':
6042 class Foo: ...
6044 self.assertIsSubclass(Foo, Base)
6045 self.assertIsSubclass(Foo, C)
6148 def foo(a: A) -> Optional[BaseException]:
6154 self.assertIsInstance(foo(KeyboardInterrupt), KeyboardInterrupt)
6155 self.assertIsNone(foo(None))
6419 a = NT(cls=str, self=42, typename='foo', fields=[('bar', tuple)])
6422 self.assertEqual(a.typename, 'foo')
6512 a = TD(cls=str, self=42, typename='foo', _typename=53, fields=[('bar', tuple)], _fields={'baz', set})
6515 self.assertEqual(a['typename'], 'foo')
6797 class FooBarGeneric(BarGeneric[int]):
6801 get_type_hints(FooBarGeneric),
7263 G.foo = 42
7269 self.assertEqual(x.foo, 42)
7518 def foo(self, *args: "P.args", **kwargs: "P.kwargs"):
7523 gth(C.foo, globals(), locals()), {"args": P.args, "kwargs": P.kwargs}
7895 def foo(arg) -> TypeGuard[int]: ...
7896 self.assertEqual(gth(foo), {'return': TypeGuard[int]})
8117 class Foo(Generic[T]):
8125 dir_items = set(dir(Foo[int]))