File: mypy_test.py

package info (click to toggle)
domdf-python-tools 3.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,784 kB
  • sloc: python: 10,838; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 410 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# stdlib
from typing import Any, Dict

# this package
from domdf_python_tools.bases import Dictable


class MyDictable(Dictable):

	def __init__(self, foo: str, bar: int):
		super().__init__()

		self.foo: str = foo
		self.bar: float = float(bar)

	@property
	def __dict__(self):
		return dict(foo=self.foo, bar=self.bar)


def myfunc() -> Dict[str, Any]:
	a = MyDictable("foo", 12)
	return dict(a)


myfunc()