I have following two classes in two different python Modules
class Node(object):
def __init__(self, data: int) -> None:
if data is not None:
self._index: int = data
def get_node_index(self) -> int:
if self._index is not None:
return self._index
AND
from Graph import Node
class NodeTest(object):
def func(self):
n = Node(4)
print(n.get_node_index())
data: bool = n.get_node_index()
print(type(data))
if __name__ == '__main__':
a = A()
a.func()
I get the following output when i run main in second class
4
<class 'int'>
I can't understand why mypy is not warning that type of data has to be int if i'm assigning it using n.get_node_index() which has a return type of int